Skip to content

Commit f53a906

Browse files
committed
Copilot.vim 1.2.1
1 parent 05e1298 commit f53a906

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

autoload/copilot.vim

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ function! s:GetSuggestionsCycling(callback) abort
325325
elseif exists('b:_copilot.suggestions')
326326
let b:_copilot.cycling_callbacks = [a:callback]
327327
let b:_copilot.cycling = copilot#Request('getCompletionsCycling',
328-
\ params,
328+
\ b:_copilot.first.params,
329329
\ function('s:GetSuggestionsCyclingCallback', [b:_copilot]),
330330
\ function('s:GetSuggestionsCyclingCallback', [b:_copilot]),
331331
\ )
@@ -587,6 +587,10 @@ function! s:DevicePoll(result, login_data, timer) abort
587587
\ function('s:DeviceResponse', [a:result, a:login_data]))
588588
endfunction
589589

590+
function! s:BrowserCallback(into, code) abort
591+
let a:into.code = a:code
592+
endfunction
593+
590594
function! copilot#Browser() abort
591595
if type(get(g:, 'copilot_browser')) == v:t_list
592596
return copy(g:copilot_browser)
@@ -731,8 +735,13 @@ function! s:commands.setup(opts) abort
731735
while c isnot# 13 && c isnot# 10 && c isnot# 0
732736
let c = getchar()
733737
endwhile
734-
let exit_status = copilot#job#Stream(browser + [data.verification_uri], v:null, v:null)
735-
if exit_status
738+
let status = {}
739+
call copilot#job#Stream(browser + [data.verification_uri], v:null, v:null, function('s:BrowserCallback', [status]))
740+
let time = reltime()
741+
while empty(status) && reltimefloat(reltime(time)) < 5
742+
sleep 10m
743+
endwhile
744+
if get(status, 'code', browser[0] !=# 'xdg-open') != 0
736745
echo "Failed to open browser. Visit " . data.verification_uri
737746
else
738747
echo "Opened " . data.verification_uri

autoload/copilot/agent.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55

66
scriptencoding utf-8
77

8-
let s:plugin_version = '1.2.0'
8+
let s:plugin_version = '1.2.1'
99

1010
let s:error_exit = -1
1111

0 commit comments

Comments
 (0)