@@ -51,7 +51,7 @@ function! s:RejectRequest(request, error) abort
5151 if empty (reject)
5252 call copilot#logger#Error (msg)
5353 else
54- call copilot#logger#Warn (msg)
54+ call copilot#logger#Debug (msg)
5555 endif
5656endfunction
5757
@@ -185,7 +185,7 @@ function! s:RegisterWorkspaceFolderForBuffer(agent, buf) abort
185185 return
186186 endif
187187 let a: agent .workspaceFolders[root] = v: true
188- call a: agent .Notify (' workspace/didChangeWorkspaceFolders' , {' event' : {' added' : [{' uri' : root, ' name' : fnamemodify (root, ' :t' )}]}})
188+ call a: agent .Notify (' workspace/didChangeWorkspaceFolders' , {' event' : {' added' : [{' uri' : root, ' name' : fnamemodify (root, ' :t' )}], ' removed ' : [] }})
189189endfunction
190190
191191function ! s: PreprocessParams (agent, params) abort
@@ -275,15 +275,15 @@ endfunction
275275
276276function ! s: DispatchMessage (agent, method, handler, id, params, ... ) abort
277277 try
278- let response = {' result' : call (a: handler , [a: params ])}
278+ let response = {' result' : call (a: handler , [a: params, a: agent ])}
279279 if response.result is # 0
280280 let response.result = v: null
281281 endif
282282 catch
283283 call copilot#logger#Exception (' lsp.request.' . a: method )
284284 let response = {' error' : {' code' : -32000 , ' message' : v: exception }}
285285 endtry
286- if ! empty ( a: id)
286+ if a: id isnot # v: null
287287 call s: Send (a: agent , extend ({' id' : a: id }, response))
288288 endif
289289 return response
@@ -556,12 +556,18 @@ function! s:AgentStartupError() dict abort
556556 endif
557557endfunction
558558
559+ function ! s: StatusNotification (params, agent) abort
560+ call copilot#logger#Info (' StatusNotification ' . string (a: params ))
561+ let a: agent .status = a: params
562+ endfunction
563+
559564function ! s: Nop (... ) abort
560565 return v: null
561566endfunction
562567
563568let s: common_handlers = {
564569 \ ' featureFlagsNotification' : function (' s:Nop' ),
570+ \ ' statusNotification' : function (' s:StatusNotification' ),
565571 \ ' window/logMessage' : function (' copilot#handlers#window_logMessage' ),
566572 \ }
567573
@@ -579,6 +585,7 @@ function! copilot#agent#New(...) abort
579585 let opts = a: 0 ? a: 1 : {}
580586 let instance = {' requests' : {},
581587 \ ' workspaceFolders' : {},
588+ \ ' status' : {' status' : ' Starting' , ' message' : ' ' },
582589 \ ' Close' : function (' s:AgentClose' ),
583590 \ ' Notify' : function (' s:AgentNotify' ),
584591 \ ' Request' : function (' s:AgentRequest' ),
0 commit comments