@@ -88,6 +88,17 @@ function! copilot#RunningAgent() abort
8888 endif
8989endfunction
9090
91+ function ! s: NodeVersionWarning () abort
92+ if exists (' s:agent.node_version' ) && s: agent .node_version = ~# ' ^16\.'
93+ echohl WarningMsg
94+ echo " Warning: Node.js 16 is approaching end of life and support will be dropped in a future release of copilot.vim."
95+ if get (g: , ' copilot_node_command' , ' node' ) isnot # ' node'
96+ echo " g:copilot_node_command is set to a non-default value. Consider removing it from your" (has (' nvim' ) ? ' Neovim' : ' Vim' ) " configuration."
97+ endif
98+ echohl NONE
99+ endif
100+ endfunction
101+
91102function ! copilot#Request (method, params, ... ) abort
92103 let agent = copilot#Agent ()
93104 return call (agent.Request, [a: method , a: params ] + a: 000 )
@@ -395,11 +406,10 @@ function! copilot#IsMapped() abort
395406 return get (g: , ' copilot_assume_mapped' ) ||
396407 \ hasmapto (' copilot#Accept(' , ' i' )
397408endfunction
398- let s: is_mapped = copilot#IsMapped ()
399409
400410function ! copilot#Schedule (... ) abort
401411 call copilot#Clear ()
402- if ! s: is_mapped || ! s: has_ghost_text || ! copilot#Enabled ()
412+ if ! s: has_ghost_text || ! copilot#Enabled () || ! copilot#IsMapped ()
403413 return
404414 endif
405415 let delay = a: 0 ? a: 1 : get (g: , ' copilot_idle_delay' , 75 )
@@ -568,6 +578,7 @@ function! s:commands.status(opts) abort
568578 endif
569579
570580 echo ' Copilot: Enabled and online'
581+ call s: NodeVersionWarning ()
571582endfunction
572583
573584function ! s: commands .signout (opts) abort
@@ -662,6 +673,7 @@ function! s:commands.version(opts) abort
662673 if exists (' s:agent.node_version' )
663674 echo ' dist/agent.js ' . s: agent .Call (' getVersion' , {}).version
664675 echo ' Node.js ' . s: agent .node_version
676+ call s: NodeVersionWarning ()
665677 else
666678 echo ' dist/agent.js not running'
667679 endif
0 commit comments