@@ -13,25 +13,29 @@ augroup vim_lsp_settings_copilot_language_server
1313 \ }
1414augroup END
1515
16- function ! s: handle_execute_command (data) abort
17- echom json_encode (a: data )
18- " if lsp#client#is_error(a:data['response'])
19- " call lsp#utils#error('Execute command failed on ' . a:server_name . ': ' . string(a:command) . ' -> ' . string(a:data))
20- " endif
16+ function ! s: handle_finish (data) abort
17+ let l: command = a: data [' response' ][' result' ]
18+ echomsg l: command [' status' ]
2119endfunction
2220
23- function ! s: on_lsp_buffer_enabled () abort
24- command ! - buffer -nargs =0 CopilotFinishDeviceFlow call lsp#send_request (' copilot-language-server' , {
21+ function ! s: handle_singin (data) abort
22+ let l: command = a: data [' response' ][' result' ]
23+ echomsg printf (' Set %s on %s' , l: command [' userCode' ], l: command [' verificationUri' ])
24+ call getchar ()
25+ call lsp#send_request (' copilot-language-server' , {
2526 \ ' method' : ' workspace/executeCommand' ,
2627 \ ' params' : {' command' : ' github.copilot.finishDeviceFlow' , ' arguments' : []},
2728 \ ' sync' : v: false ,
28- \ ' on_notification' : function (' s:handle_execute_command ' ),
29+ \ ' on_notification' : function (' s:handle_finish ' ),
2930 \ })
31+ endfunction
32+
33+ function ! s: on_lsp_buffer_enabled () abort
3034 command ! - buffer -nargs =0 CopilotSignIn call lsp#send_request (' copilot-language-server' , {
3135 \ ' method' : ' workspace/executeCommand' ,
3236 \ ' params' : {' command' : ' github.copilot.signIn' , ' arguments' : []},
3337 \ ' sync' : v: false ,
34- \ ' on_notification' : function (' s:handle_execute_command ' ),
38+ \ ' on_notification' : function (' s:handle_signin ' ),
3539 \ })
3640
3741endfunction
0 commit comments