@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55
66scriptencoding utf- 8
77
8- let s: plugin_version = ' 1.6.0 '
8+ let s: plugin_version = ' 1.6.1 '
99
1010let s: error_exit = -1
1111
@@ -166,11 +166,7 @@ endfunction
166166
167167function ! s: OnMessage (agent, body, ... ) abort
168168 call copilot#logger#Trace ({ - > ' <-- ' . a: body })
169- try
170- let response = json_decode (a: body )
171- catch
172- return copilot#logger#Exception ()
173- endtry
169+ let response = json_decode (a: body )
174170 if type (response) != v: t_dict
175171 return
176172 endif
@@ -314,6 +310,7 @@ function! s:LspRequest(method, params, ...) dict abort
314310 endif
315311 if has_key (self , ' client_id' )
316312 call copilot#agent#LspExit (self .client_id, -1 , -1 )
313+ unlet ! self .client_id
317314 endif
318315 throw ' copilot#agent: LSP client not available'
319316endfunction
@@ -371,7 +368,7 @@ function! s:Command() abort
371368 let err = []
372369 let status = copilot#job#Stream (node + [' --version' ], function (' add' , [out]), function (' add' , [err]))
373370 if status != 0
374- return [v: null , ' Node.js exited with status ' . status]
371+ return [v: null , ' ' , ' Node.js exited with status ' . status]
375372 endif
376373 let node_version = matchstr (join (out, ' ' ), ' ^v\zs\d\+\.[^[:space:]]*' )
377374 let major = str2nr (node_version)
@@ -428,7 +425,9 @@ endfunction
428425
429426function ! s: GetCapabilitiesResult (result, agent) abort
430427 let a: agent .capabilities = get (a: result , ' capabilities' , {})
431- call a: agent .Request (' setEditorInfo' , extend ({' editorConfiguration' : a: agent .editorConfiguration}, copilot#agent#EditorInfo ()))
428+ let info = deepcopy (copilot#agent#EditorInfo ())
429+ let info.editorInfo.version .= ' + Node.js ' . a: agent .node_version
430+ call a: agent .Request (' setEditorInfo' , extend ({' editorConfiguration' : a: agent .editorConfiguration}, info))
432431endfunction
433432
434433function ! s: GetCapabilitiesError (error , agent) abort
0 commit comments