@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55
66scriptencoding utf- 8
77
8- let s: plugin_version = ' 1.11.1 '
8+ let s: plugin_version = ' 1.11.2 '
99
1010let s: error_exit = -1
1111
@@ -58,14 +58,18 @@ function! s:AgentNotify(method, params) dict abort
5858 return v: true
5959endfunction
6060
61+ function ! s: IsFinished (request) abort
62+ return a: request .status !=# ' running' && empty (get (a: request , ' waiting' , {}))
63+ endfunction
64+
6165function ! s: RequestWait () dict abort
62- while self .status == # ' running '
63- sleep 1 m
64- endwhile
65- while ! empty ( get ( self , ' waiting ' , {}) )
66- sleep 1 m
67- endwhile
68- return self
66+ if exists ( ' *wait ' )
67+ call wait ( -1 , function ( ' s:IsFinished ' , [ self ]), 2 )
68+ else
69+ while ! s: IsFinished ( self )
70+ sleep 2 m
71+ endwhile
72+ endif
6973endfunction
7074
7175function ! s: RequestAwait () dict abort
@@ -423,7 +427,7 @@ function! s:Command() abort
423427 endif
424428 let node_version = s: GetNodeVersion (node)
425429 let warning = ' '
426- if node_version.major < 18 && get (node, 0 , ' ' ) !=# ' node' && executable (' node' )
430+ if ! get ( g: , ' copilot_ignore_node_version ' ) && node_version.major < 18 && get (node, 0 , ' ' ) !=# ' node' && executable (' node' )
427431 let node_version_from_path = s: GetNodeVersion ([' node' ])
428432 if node_version_from_path.major >= 18
429433 let warning = ' Ignoring g:copilot_node_command: Node.js ' . node_version.string . ' is end-of-life'
@@ -506,10 +510,10 @@ function! s:GetCapabilitiesError(error, agent) abort
506510endfunction
507511
508512function ! s: AgentStartupError () dict abort
509- while has_key (self , ' job' ) && ! has_key (self , ' startup_error' ) && ! has_key (self , ' capabilities' )
513+ while ( has_key (self , ' job' ) || has_key ( self , ' client_id ' ) ) && ! has_key (self , ' startup_error' ) && ! has_key (self , ' capabilities' )
510514 sleep 10 m
511515 endwhile
512- if has_key (self , ' capabilities' ) || has_key ( self , ' client_id ' )
516+ if has_key (self , ' capabilities' )
513517 return ' '
514518 else
515519 return get (self , ' startup_error' , ' Something unexpected went wrong spawning the agent' )
0 commit comments