@@ -26,15 +26,6 @@ function! s:Warn(msg) abort
26
26
echohl NONE
27
27
endfunction
28
28
29
- let s: node_target = ' 18.x or newer'
30
- function ! s: UpgradeNodeMsg (node) abort
31
- if get (a: node , 0 , ' node' ) == # ' node'
32
- return ' Upgrade to ' . s: node_target
33
- else
34
- return ' Change g:copilot_node_command to ' . s: node_target
35
- endif
36
- endfunction
37
-
38
29
function ! s: VimClose () dict abort
39
30
if ! has_key (self , ' job' )
40
31
return
@@ -387,8 +378,10 @@ function! s:OnExit(instance, code, ...) abort
387
378
call remove (a: instance , ' client_id' )
388
379
endif
389
380
let message = ' Process exited with status ' . a: code
390
- if a: code == 2
391
- let message = ' Node.js too old. ' . s: UpgradeNodeMsg (a: instance .node)
381
+ if a: code >= 18 && a: code < 100
382
+ let message = ' Node.js too old. ' .
383
+ \ (get (a: instance .node, 0 , ' node' ) == # ' node' ? ' Upgrade' : ' Change g:copilot_node_command' ) .
384
+ \ ' to ' . a: code . ' .x or newer'
392
385
endif
393
386
if ! has_key (a: instance , ' serverInfo' ) && ! has_key (a: instance , ' startup_error' )
394
387
let a: instance .startup_error = message
@@ -496,7 +489,7 @@ endfunction
496
489
497
490
let s: script_name = ' dist/language-server.js'
498
491
function ! s: Command () abort
499
- if ! has (' nvim-0.6 ' ) && v: version < 900
492
+ if ! has (' nvim-0.7 ' ) && v: version < 900
500
493
return [[], [], ' Vim version too old' ]
501
494
endif
502
495
let script = get (g: , ' copilot_command' , ' ' )
@@ -566,10 +559,6 @@ function! s:PostInit(result, instance) abort
566
559
let a: instance .serverInfo = get (a: result , ' serverInfo' , {})
567
560
if ! has_key (a: instance , ' node_version' ) && has_key (a: result .serverInfo, ' nodeVersion' )
568
561
let a: instance .node_version = a: result .serverInfo.nodeVersion
569
- if a: instance .node_version = ~# ' ^1[67]\.'
570
- let a: instance .node_version_warning = ' Node.js ' . a: instance .node_version . ' support will soon be dropped. ' . s: UpgradeNodeMsg (a: instance .node)
571
- call s: Warn (a: instance .node_version_warning)
572
- endif
573
562
endif
574
563
let a: instance .AfterInitialized = function (' copilot#util#Defer' )
575
564
for Fn in remove (a: instance , ' after_initialized' )
@@ -686,21 +675,21 @@ function! copilot#client#New(...) abort
686
675
endfor
687
676
if has (' nvim' )
688
677
call extend (instance, {
689
- \ ' Close' : function (' s:NvimClose' ),
690
- \ ' Notify' : function (' s:NvimNotify' ),
691
- \ ' Request' : function (' s:NvimRequest' ),
692
- \ ' Attach' : function (' s:NvimAttach' ),
693
- \ ' IsAttached' : function (' s:NvimIsAttached' ),
694
- \ })
678
+ \ ' Close' : function (' s:NvimClose' ),
679
+ \ ' Notify' : function (' s:NvimNotify' ),
680
+ \ ' Request' : function (' s:NvimRequest' ),
681
+ \ ' Attach' : function (' s:NvimAttach' ),
682
+ \ ' IsAttached' : function (' s:NvimIsAttached' ),
683
+ \ })
695
684
let instance.client_id = eval (" v:lua.require'_copilot'.lsp_start_client(command, keys(instance.methods), opts, settings)" )
696
685
let instance.id = instance.client_id
697
686
else
698
687
call extend (instance, {
699
- \ ' Close' : function (' s:VimClose' ),
700
- \ ' Notify' : function (' s:VimNotify' ),
701
- \ ' Attach' : function (' s:VimAttach' ),
702
- \ ' IsAttached' : function (' s:VimIsAttached' ),
703
- \ })
688
+ \ ' Close' : function (' s:VimClose' ),
689
+ \ ' Notify' : function (' s:VimNotify' ),
690
+ \ ' Attach' : function (' s:VimAttach' ),
691
+ \ ' IsAttached' : function (' s:VimIsAttached' ),
692
+ \ })
704
693
let state = {' headers' : {}, ' mode' : ' headers' , ' buffer' : ' ' }
705
694
let instance.open_buffers = {}
706
695
let instance.methods = extend (s: vim_handlers , instance.methods)
0 commit comments