From ea2f602e5f07d734f08eb87b36225f1707c0bd39 Mon Sep 17 00:00:00 2001 From: Mandy Noto Date: Sat, 17 Jun 2023 15:25:57 -0700 Subject: [PATCH] feat: add functionality to check for Copilot suggestions This commit introduces a new feature that checks whether a Copilot suggestion is currently being shown. The new function `copilot#SuggestionBeingShown` has been added to provide this functionality. It is implemented by checking the existence of the local script variables `s:uuid` and `b:_copilot`. This feature allows for better integration of Copilot with other plugins such as cmp, luasnip, and neogen, by enabling conditional dismissal of Copilot suggestions. --- autoload/copilot.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/copilot.vim b/autoload/copilot.vim index a1abccec..ef841e6e 100644 --- a/autoload/copilot.vim +++ b/autoload/copilot.vim @@ -119,6 +119,7 @@ function! copilot#Clear() abort endif call s:UpdatePreview() unlet! b:_copilot + let g:copilot_suggestion_shown = 0 return '' endfunction @@ -397,6 +398,7 @@ function! s:UpdatePreview() abort endif if uuid !=# get(s:, 'uuid', '') let s:uuid = uuid + let g:copilot_suggestion_shown = 1 call copilot#Request('notifyShown', {'uuid': uuid}) endif catch