From 38d9e4bf9da42e34ef79e1d495d71458efec5faa Mon Sep 17 00:00:00 2001 From: Eugene Gelfand Date: Sat, 28 May 2022 11:22:19 +0200 Subject: [PATCH] update --- autoload/copilot.vim | 13 +++++-------- autoload/copilot/agent.vim | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/autoload/copilot.vim b/autoload/copilot.vim index 6917569c..d9674e86 100644 --- a/autoload/copilot.vim +++ b/autoload/copilot.vim @@ -249,11 +249,11 @@ function! copilot#Complete(...) abort endif let params = copilot#doc#Params() if !exists('b:_copilot.params') || b:_copilot.params !=# params - let b:_copilot = {'params': params, 'first': - \ copilot#Request('getCompletions', params)} + let b:_copilot = {'params': params, 'cycling': + \ copilot#Request('getCompletionsCycling', params)} let g:_copilot_last = b:_copilot endif - let completion = b:_copilot.first + let completion = b:_copilot.cycling if !a:0 return completion.Await() else @@ -410,7 +410,6 @@ endfunction function! s:ClearPreview() abort if exists('*nvim_buf_del_extmark') - call nvim_buf_del_extmark(0, copilot#NvimNs(), 1) endif endfunction @@ -444,8 +443,6 @@ function! s:UpdatePreview() abort let data.virt_text += annot endif let data.hl_mode = 'combine' - call nvim_buf_del_extmark(0, copilot#NvimNs(), 1) - call nvim_buf_set_extmark(0, copilot#NvimNs(), line('.')-1, col('.')-1, data) if uuid !=# get(s:, 'uuid', '') let s:uuid = uuid call copilot#Request('notifyShown', {'uuid': uuid}) @@ -471,7 +468,7 @@ function! s:Trigger(bufnr, timer) abort return endif if exists('s:auth_request') - let g:_copilot_timer = timer_start(100, function('s:Trigger', [a:bufnr])) + let g:_copilot_timer = timer_start(50, function('s:Trigger', [a:bufnr])) return endif call copilot#Complete(function('s:HandleTriggerResult'), function('s:HandleTriggerResult')) @@ -488,7 +485,7 @@ function! copilot#Schedule(...) abort if !s:is_mapped || !s:dest || !copilot#Enabled() return endif - let delay = a:0 ? a:1 : get(g:, 'copilot_idle_delay', 75) + let delay = a:0 ? a:1 : get(g:, 'copilot_idle_delay', 50) let g:_copilot_timer = timer_start(delay, function('s:Trigger', [bufnr('')])) endfunction diff --git a/autoload/copilot/agent.vim b/autoload/copilot/agent.vim index fe7924f8..19fe570b 100644 --- a/autoload/copilot/agent.vim +++ b/autoload/copilot/agent.vim @@ -300,16 +300,16 @@ function! s:Command() abort endif let node_version = matchstr(join(out, ''), '^v\zs\d\+\.[^[:space:]]*') let major = str2nr(node_version) - let too_new = major >= 18 && node_version !=# '18.0.0' - if !get(g:, 'copilot_ignore_node_version') - if major == 0 - return [v:null, 'Could not determine Node.js version'] - elseif (major < 16 || too_new) && s:IsArmMacOS() - return [v:null, 'Node.js version 16.x or 17.x required on Apple Silicon but found ' . node_version] - elseif major < 12 || too_new - return [v:null, 'Node.js version 12.x–17.x required but found ' . node_version] - endif - endif + " let too_new = major >= 18 && node_version !=# '18.0.0' + " if !get(g:, 'copilot_ignore_node_version') + " if major == 0 + " return [v:null, 'Could not determine Node.js version'] + " elseif (major < 16 || too_new) && s:IsArmMacOS() + " return [v:null, 'Node.js version 16.x or 17.x required on Apple Silicon but found ' . node_version] + " elseif major < 12 || too_new + " return [v:null, 'Node.js version 12.x–17.x required but found ' . node_version] + " endif + " endif let agent = s:root . '/copilot/dist/agent.js' if !filereadable(agent) let agent = get(g:, 'copilot_agent_command', '')