Skip to content

Commit 1729557

Browse files
committed
Copilot.vim 1.10.1
1 parent f2a4acd commit 1729557

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

autoload/copilot.vim

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,15 @@ function! copilot#Clear() abort
121121
endfunction
122122

123123
function! s:Reject(bufnr) abort
124-
let uuid = getbufvar(a:bufnr, '_copilot_uuid')
125-
if !empty(uuid)
126-
call setbufvar(a:bufnr, '_copilot_uuid', '')
127-
call copilot#Request('notifyRejected', {'uuids': [uuid]})
128-
endif
124+
try
125+
let dict = getbufvar(a:bufnr, '_copilot')
126+
if type(dict) == v:t_dict && !empty(get(dict, 'shown_choices', {}))
127+
call copilot#Request('notifyRejected', {'uuids': keys(dict.shown_choices)})
128+
let dict.shown_choices = {}
129+
endif
130+
catch
131+
call copilot#logger#Exception()
132+
endtry
129133
endfunction
130134

131135
function! copilot#Dismiss() abort
@@ -350,9 +354,8 @@ function! s:UpdatePreview() abort
350354
call prop_add(line('.'), col('$'), {'type': s:annot_hlgroup, 'text': ' ' . annot})
351355
endif
352356
endif
353-
if uuid !=# get(b:, '_copilot_uuid', '')
354-
call s:Reject('%')
355-
let b:_copilot_uuid = uuid
357+
if !has_key(b:_copilot.shown_choices, uuid)
358+
let b:_copilot.shown_choices[uuid] = v:true
356359
call copilot#Request('notifyShown', {'uuid': uuid})
357360
endif
358361
catch
@@ -366,6 +369,7 @@ function! s:HandleTriggerResult(result) abort
366369
endif
367370
let b:_copilot.suggestions = get(a:result, 'completions', [])
368371
let b:_copilot.choice = 0
372+
let b:_copilot.shown_choices = {}
369373
call s:UpdatePreview()
370374
endfunction
371375

@@ -441,7 +445,6 @@ function! copilot#Accept(...) abort
441445
let s = copilot#GetDisplayedSuggestion()
442446
if !empty(s.text)
443447
unlet! b:_copilot
444-
let b:_copilot_uuid = ''
445448
call copilot#Request('notifyAccepted', {'uuid': s.uuid})
446449
call s:ClearPreview()
447450
let s:suggestion_text = s.text

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.10.0'
8+
let s:plugin_version = '1.10.1'
99

1010
let s:error_exit = -1
1111

dist/agent.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/agent.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)