@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55
66scriptencoding utf- 8
77
8- let s: plugin_version = ' 1.10.3 '
8+ let s: plugin_version = ' 1.11.0 '
99
1010let s: error_exit = -1
1111
@@ -400,7 +400,8 @@ function! s:GetNodeVersion(command) abort
400400 let string = ' '
401401 endif
402402 let major = str2nr (string )
403- return {' status' : status, ' string' : string , ' major' : major}
403+ let minor = str2nr (matchstr (string , ' \.\zs\d\+' ))
404+ return {' status' : status, ' string' : string , ' major' : major, ' minor' : minor}
404405endfunction
405406
406407function ! s: Command () abort
@@ -422,7 +423,7 @@ function! s:Command() abort
422423 endif
423424 let node_version = s: GetNodeVersion (node)
424425 let warning = ' '
425- if node_version.major < 18 && get (node, 0 , ' ' ) !=# ' node'
426+ if node_version.major < 18 && get (node, 0 , ' ' ) !=# ' node' && executable ( ' node ' )
426427 let node_version_from_path = s: GetNodeVersion ([' node' ])
427428 if node_version_from_path.major >= 18
428429 let warning = ' Ignoring g:copilot_node_command: Node.js ' . node_version.string . ' is end-of-life'
@@ -436,8 +437,9 @@ function! s:Command() abort
436437 if ! get (g: , ' copilot_ignore_node_version' )
437438 if node_version.major == 0
438439 return [v: null , node_version.string , ' Could not determine Node.js version' ]
439- elseif node_version.major < 16
440- return [v: null , node_version.string , ' Node.js version 16.x or newer required but found ' . node_version.string ]
440+ elseif node_version.major < 16 || node_version.major == 16 && node_version.minor < 14
441+ " 16.14+ still works for now, but is end-of-life
442+ return [v: null , node_version.string , ' Node.js version 18.x or newer required but found ' . node_version.string ]
441443 endif
442444 endif
443445 let agent = get (g: , ' copilot_agent_command' , ' ' )
@@ -447,7 +449,7 @@ function! s:Command() abort
447449 return [v: null , node_version.string , ' Could not find dist/agent.js (bad install?)' ]
448450 endif
449451 endif
450- return [node + [agent], node_version.string , warning]
452+ return [node + [agent, ' --stdio ' ], node_version.string , warning]
451453endfunction
452454
453455function ! s: UrlDecode (str) abort
@@ -490,13 +492,7 @@ endfunction
490492
491493function ! s: GetCapabilitiesResult (result, agent) abort
492494 let a: agent .capabilities = get (a: result , ' capabilities' , {})
493- let info = deepcopy (copilot#agent#EditorInfo ())
494- let info.editorInfo.version .= ' + Node.js ' . a: agent .node_version
495- if has_key (a: agent , ' node_version_warning' )
496- let info.editorInfo.version .= ' (ignored g:copilot_node_command)'
497- elseif ! empty (get (g: , ' copilot_node_command' , ' ' ))
498- let info.editorInfo.version .= ' (used g:copilot_node_command)'
499- endif
495+ let info = copilot#agent#EditorInfo ()
500496 call a: agent .Request (' setEditorInfo' , extend ({' editorConfiguration' : a: agent .editorConfiguration}, info))
501497endfunction
502498
0 commit comments