Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88d08cf

Browse files
committed
Copilot.vim 1.36.0
1 parent1dcaf72 commit88d08cf

File tree

7 files changed

+491
-440
lines changed

7 files changed

+491
-440
lines changed

‎autoload/copilot.vim

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function! s:Running() abort
4343
endfunction
4444

4545
function!s:Start()abort
46-
ifs:Running()
46+
ifs:Running()||exists('s:client.startup_error')
4747
return
4848
endif
4949
lets:client=copilot#client#New({'editorConfiguration' :s:EditorConfiguration()})
@@ -70,11 +70,7 @@ function! copilot#RunningClient() abort
7070
endfunction
7171

7272
function!s:NodeVersionWarning()abort
73-
ifexists('s:client.node_version')&&s:client.node_version=~#'^1[67]\.'
74-
echohlWarningMsg
75-
echo"Warning: Node.js"matchstr(s:client.node_version,'^\d\+')"is end-of-life and support will be dropped in a future release of copilot.vim."
76-
echohlNONE
77-
elseifexists('s:client.node_version_warning')
73+
ifexists('s:client.node_version_warning')
7874
echohlWarningMsg
7975
echo'Warning:'s:client.node_version_warning
8076
echohlNONE
@@ -202,9 +198,9 @@ function! copilot#Complete(...) abort
202198
if!a:0
203199
return completion.Await()
204200
else
205-
callcopilot#client#Result(completion,a:1)
201+
callcopilot#client#Result(completion,function(a:1, [b:_copilot]))
206202
ifa:0 >1
207-
callcopilot#client#Error(completion,a:2)
203+
callcopilot#client#Error(completion,function(a:2, [b:_copilot]))
208204
endif
209205
endif
210206
endfunction
@@ -371,21 +367,29 @@ function! s:UpdatePreview() abort
371367
endtry
372368
endfunction
373369

374-
function!s:HandleTriggerResult(result)abort
375-
if!exists('b:_copilot')
376-
return
370+
function!s:HandleTriggerResult(state, result)abort
371+
leta:state.suggestions=type(a:result)==type([]) ?a:result :get(empty(a:result) ? {} :a:result,'items', [])
372+
leta:state.choice=0
373+
ifget(b:,'_copilot')is#a:state
374+
calls:UpdatePreview()
375+
endif
376+
endfunction
377+
378+
function!s:HandleTriggerError(state, result)abort
379+
leta:state.suggestions= []
380+
leta:state.choice=0
381+
leta:state.error=a:result
382+
ifget(b:,'_copilot')is#a:state
383+
calls:UpdatePreview()
377384
endif
378-
letb:_copilot.suggestions=type(a:result)==type([]) ?a:result :get(empty(a:result) ? {} :a:result,'items', [])
379-
letb:_copilot.choice=0
380-
calls:UpdatePreview()
381385
endfunction
382386

383387
function!copilot#Suggest()abort
384388
if!s:Running()
385389
return''
386390
endif
387391
try
388-
callcopilot#Complete(function('s:HandleTriggerResult'),function('s:HandleTriggerResult'))
392+
callcopilot#Complete(function('s:HandleTriggerResult'),function('s:HandleTriggerError'))
389393
catch
390394
callcopilot#logger#Exception()
391395
endtry

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp