Skip to content

Commit a24c3fd

Browse files
committed
Copilot.vim 1.9.4
1 parent 97a9f1a commit a24c3fd

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

autoload/copilot.vim

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ function! copilot#Clear() abort
111111
if exists('g:_copilot_timer')
112112
call timer_stop(remove(g:, '_copilot_timer'))
113113
endif
114-
if exists('s:uuid')
115-
call copilot#Request('notifyRejected', {'uuids': [remove(s:, 'uuid')]})
116-
endif
117114
if exists('b:_copilot')
118115
call copilot#agent#Cancel(get(b:_copilot, 'first', {}))
119116
call copilot#agent#Cancel(get(b:_copilot, 'cycling', {}))
@@ -123,7 +120,14 @@ function! copilot#Clear() abort
123120
return ''
124121
endfunction
125122

123+
function! s:Reject() abort
124+
if exists('s:uuid')
125+
call copilot#Request('notifyRejected', {'uuids': [remove(s:, 'uuid')]})
126+
endif
127+
endfunction
128+
126129
function! copilot#Dismiss() abort
130+
call s:Reject()
127131
call copilot#Clear()
128132
call s:UpdatePreview()
129133
return ''
@@ -388,6 +392,7 @@ function! s:UpdatePreview() abort
388392
endif
389393
endif
390394
if uuid !=# get(s:, 'uuid', '')
395+
call s:Reject()
391396
let s:uuid = uuid
392397
call copilot#Request('notifyShown', {'uuid': uuid})
393398
endif
@@ -466,6 +471,10 @@ function! copilot#OnCursorMovedI() abort
466471
return copilot#Schedule()
467472
endfunction
468473

474+
function! copilot#OnVimLeavePre() abort
475+
return s:Reject()
476+
endfunction
477+
469478
function! copilot#TextQueuedForInsertion() abort
470479
try
471480
return remove(s:, 'suggestion_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.9.3'
8+
let s:plugin_version = '1.9.4'
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.

plugin/copilot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ augroup github_copilot
6060
autocmd CompleteChanged * call s:Event('CompleteChanged')
6161
autocmd ColorScheme,VimEnter * call s:ColorScheme()
6262
autocmd VimEnter * call s:MapTab()
63+
autocmd VimLeavePre * call s:Event('VimLeavePre')
6364
autocmd BufReadCmd copilot://* setlocal buftype=nofile bufhidden=wipe nobuflisted readonly nomodifiable
6465
augroup END
6566

0 commit comments

Comments
 (0)