@@ -18,10 +18,11 @@ function! s:handle_finish(data) abort
1818 echomsg l: command [' status' ]
1919endfunction
2020
21- function ! s: handle_singin (data) abort
21+ function ! s: handle_signin (data) abort
2222 let l: command = a: data [' response' ][' result' ]
23- echomsg printf (' Set %s on %s' , l: command [' userCode' ], l: command [' verificationUri' ])
24- call getchar ()
23+ while getchar () !=# 13
24+ echomsg printf (' Set %s on %s then type ENTER' , l: command [' userCode' ], l: command [' verificationUri' ])
25+ endwhile
2526 call lsp#send_request (' copilot-language-server' , {
2627 \ ' method' : ' workspace/executeCommand' ,
2728 \ ' params' : {' command' : ' github.copilot.finishDeviceFlow' , ' arguments' : []},
@@ -30,14 +31,24 @@ function! s:handle_singin(data) abort
3031 \ })
3132endfunction
3233
34+ function ! s: handle_signout (data) abort
35+ let l: command = a: data [' response' ][' result' ]
36+ echomsg l: command [' status' ]
37+ endfunction
38+
3339function ! s: on_lsp_buffer_enabled () abort
3440 command ! - buffer -nargs =0 CopilotSignIn call lsp#send_request (' copilot-language-server' , {
3541 \ ' method' : ' signIn' ,
36- \ ' params' : {' command ' : ' github.copilot.signin ' , ' arguments ' : [] },
42+ \ ' params' : {},
3743 \ ' sync' : v: false ,
3844 \ ' on_notification' : function (' s:handle_signin' ),
3945 \ })
40-
46+ command ! - buffer -nargs =0 CopilotSignOut call lsp#send_request (' copilot-language-server' , {
47+ \ ' method' : ' signOut' ,
48+ \ ' params' : {},
49+ \ ' sync' : v: false ,
50+ \ ' on_notification' : function (' s:handle_signout' ),
51+ \ })
4152endfunction
4253
4354augroup lsp_install_copilot
0 commit comments