@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55
66scriptencoding utf- 8
77
8- let s: plugin_version = ' 1.5.2 '
8+ let s: plugin_version = ' 1.5.3 '
99
1010let s: error_exit = -1
1111
@@ -76,15 +76,15 @@ function! s:RequestAwait() dict abort
7676 throw ' copilot#agent(' . self .error .code . ' ): ' . self .error .message
7777endfunction
7878
79- function s: RequestAgent () dict abort
79+ function ! s: RequestAgent () dict abort
8080 return get (s: instances , self .agent_id, v: null )
8181endfunction
8282
8383if ! exists (' s:id' )
8484 let s: id = 0
8585endif
8686
87- function s: SetUpRequest (agent, id, method, params, ... ) abort
87+ function ! s: SetUpRequest (agent, id, method, params, ... ) abort
8888 let request = {
8989 \ ' agent_id' : a: agent .id,
9090 \ ' id' : a: id ,
@@ -329,7 +329,7 @@ function! s:LspNotify(method, params) dict abort
329329 return v: lua .require' _copilot' .rpc_notify (self .id, a: method , a: params )
330330endfunction
331331
332- function copilot#agent#LspHandle (agent_id, response) abort
332+ function ! copilot#agent#LspHandle (agent_id, response) abort
333333 if ! has_key (s: instances , a: agent_id )
334334 return
335335 endif
@@ -352,7 +352,7 @@ endfunction
352352
353353function ! s: Command () abort
354354 if ! has (' nvim-0.6' ) && v: version < 802
355- return [v: null , ' Vim version too old' ]
355+ return [v: null , ' ' , ' Vim version too old' ]
356356 endif
357357 let node = get (g: , ' copilot_node_command' , ' ' )
358358 if empty (node)
@@ -362,9 +362,9 @@ function! s:Command() abort
362362 endif
363363 if ! executable (get (node, 0 , ' ' ))
364364 if get (node, 0 , ' ' ) == # ' node'
365- return [v: null , ' Node.js not found in PATH' ]
365+ return [v: null , ' ' , ' Node.js not found in PATH' ]
366366 else
367- return [v: null , ' Node.js executable `' . get (node, 0 , ' ' ) . " ' not found" ]
367+ return [v: null , ' ' , ' Node.js executable `' . get (node, 0 , ' ' ) . " ' not found" ]
368368 endif
369369 endif
370370 let out = []
@@ -378,21 +378,21 @@ function! s:Command() abort
378378 let too_new = major >= 18
379379 if ! get (g: , ' copilot_ignore_node_version' )
380380 if major == 0
381- return [v: null , ' Could not determine Node.js version' ]
381+ return [v: null , node_version, ' Could not determine Node.js version' ]
382382 elseif (major < 16 || too_new) && s: IsArmMacOS ()
383- return [v: null , ' Node.js version 16.x or 17.x required on Apple Silicon but found ' . node_version]
383+ return [v: null , node_version, ' Node.js version 16.x or 17.x required on Apple Silicon but found ' . node_version]
384384 elseif major < 12 || too_new
385- return [v: null , ' Node.js version 12.x–17.x required but found ' . node_version]
385+ return [v: null , node_version, ' Node.js version 12.x–17.x required but found ' . node_version]
386386 endif
387387 endif
388388 let agent = s: root . ' /copilot/dist/agent.js'
389389 if ! filereadable (agent)
390390 let agent = get (g: , ' copilot_agent_command' , ' ' )
391391 if ! filereadable (agent)
392- return [v: null , ' Could not find agent.js (bad install?)' ]
392+ return [v: null , node_version, ' Could not find agent.js (bad install?)' ]
393393 endif
394394 endif
395- return [node + [agent], ' ' ]
395+ return [node + [agent], node_version, ' ' ]
396396endfunction
397397
398398function ! copilot#agent#EditorInfo () abort
@@ -445,12 +445,13 @@ function! copilot#agent#New(...) abort
445445 \ ' Cancel' : function (' s:AgentCancel' ),
446446 \ ' StartupError' : function (' s:AgentStartupError' ),
447447 \ }
448- let [command , command_error] = s: Command ()
448+ let [command , node_version, command_error] = s: Command ()
449449 if len (command_error)
450450 let instance.id = -1
451451 let instance.startup_error = command_error
452452 return instance
453453 endif
454+ let instance.node_version = node_version
454455 if has (' nvim' )
455456 call extend (instance, {
456457 \ ' Close' : function (' s:LspClose' ),
0 commit comments