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

Commit3b39e78

Browse files
committed
Copilot.vim 1.25.1
1 parent037f594 commit3b39e78

File tree

6 files changed

+43
-22
lines changed

6 files changed

+43
-22
lines changed

‎autoload/copilot.vim

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function! s:StatusNotification(params, ...) abort
4444
endfunction
4545

4646
function!copilot#Init(...)abort
47-
calltimer_start(0, { _->exists('s:agent')||s:Start() })
47+
callcopilot#util#Defer({->exists('s:agent')||s:Start() })
4848
endfunction
4949

5050
function!s:Running()abort
@@ -442,7 +442,7 @@ endfunction
442442

443443
function!copilot#OnFileType()abort
444444
ifempty(s:BufferDisabled())&& &l:modifiable&& &l:buflisted
445-
calltimer_start(0,function('s:Attach', [bufnr('')]))
445+
callcopilot#util#Defer(function('s:Attach'),bufnr(''))
446446
endif
447447
endfunction
448448

@@ -454,7 +454,7 @@ endfunction
454454

455455
function!copilot#OnBufEnter()abort
456456
letbufnr=bufnr('')
457-
calltimer_start(0, { _->timer_start(0,function('s:Focus', [bufnr]))})
457+
callcopilot#util#Defer(function('s:Focus'),bufnr)
458458
endfunction
459459

460460
function!copilot#OnInsertLeave()abort
@@ -676,8 +676,14 @@ function! s:commands.setup(opts) abort
676676
ifhas_key(data,'verificationUri')
677677
let uri= data.verificationUri
678678
ifhas('clipboard')
679-
let@+= data.userCode
680-
let@*= data.userCode
679+
try
680+
let@+= data.userCode
681+
catch
682+
endtry
683+
try
684+
let@*= data.userCode
685+
catch
686+
endtry
681687
endif
682688
let codemsg="First copy your one-time code:" . data.userCode ."\n"
683689
try

‎autoload/copilot/agent.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function! s:AgentRequest(method, params, ...) dict abort
240240
ifhas_key(self,'initialization_pending')
241241
calladd(self.initialization_pending, request)
242242
else
243-
calltimer_start(0, { _->s:SendRequest(self, request) })
243+
callcopilot#util#Defer(function('s:SendRequest'),self, request)
244244
endif
245245
returncall('s:SetUpRequest', [self,s:id,a:method, params]+a:000)
246246
endfunction
@@ -330,7 +330,7 @@ function! s:OnResponse(agent, response, ...) abort
330330
endif
331331
endfunction
332332

333-
function!s:OnErr(agent,line,...)abort
333+
function!s:OnErr(agent,ch,line,...)abort
334334
if!has_key(a:agent,'serverInfo')
335335
callcopilot#logger#Bare('<-!' .a:line)
336336
endif
@@ -348,7 +348,7 @@ function! s:OnExit(agent, code, ...) abort
348348
for idinsort(keys(a:agent.requests), {a,b->+a > +b })
349349
calls:RejectRequest(remove(a:agent.requests, id), {'code': code,'message':'Agent exited','data': {'status':a:code}})
350350
endfor
351-
calltimer_start(0, { _->get(s:instances,a:agent.id)is#a:agent ?remove(s:instances,a:agent.id) : {} })
351+
callcopilot#util#Defer({->get(s:instances,a:agent.id)is#a:agent ?remove(s:instances,a:agent.id) : {} })
352352
callcopilot#logger#Info('Agent exited with status' .a:code)
353353
endfunction
354354

@@ -532,7 +532,7 @@ function! s:InitializeResult(result, agent) abort
532532
calls:AfterInitialize(a:result,a:agent)
533533
calls:Send(a:agent, {'method':'initialized','params': {}})
534534
for requestinremove(a:agent,'initialization_pending')
535-
calltimer_start(0,function('s:SendRequest', [a:agent, request]))
535+
callcopilot#util#Defer(function('s:SendRequest'),a:agent, request)
536536
endfor
537537
endfunction
538538

@@ -646,9 +646,9 @@ function! copilot#agent#New(...) abort
646646
\'stoponexit':'',
647647
\'in_mode':'lsp',
648648
\'out_mode':'lsp',
649-
\'out_cb': {j,d->timer_start(0,function('s:OnMessage', [instance,d])) },
650-
\'err_cb':{j,d->timer_start(0,function('s:OnErr', [instance,d])) },
651-
\'exit_cb': {j,d->timer_start(0,function('s:OnExit', [instance,d])) },
649+
\'out_cb': {j,d->copilot#util#Defer(function('s:OnMessage'),instance,d) },
650+
\'err_cb':function('s:OnErr', [instance]),
651+
\'exit_cb': {j,d->copilot#util#Defer(function('s:OnExit'),instance,d) },
652652
\})
653653
let instance.id=job_info(instance.job).process
654654
let opts.capabilities=s:vim_capabilities

‎autoload/copilot/logger.vim

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ function! copilot#logger#BufReadCmd() abort
2020
endtry
2121
endfunction
2222

23-
lets:level_prefixes= ['','[ERROR]','[WARN]','[INFO]','[DEBUG]','[TRACE]']
23+
lets:level_prefixes= ['','[ERROR]','[WARN]','[INFO]','[DEBUG]','[DEBUG]']
2424

2525
function!copilot#logger#Raw(level, message)abort
26-
if$COPILOT_AGENT_VERBOSE!~#'^\%(1\|true\)$'&&a:level >3
27-
return
28-
endif
2926
letlines=type(a:message)==v:t_list ?copy(a:message) :split(a:message,"\n",1)
3027
letlines[0]=strftime('[%Y-%m-%d %H:%M:%S]') .get(s:level_prefixes,a:level,'[UNKNOWN]') .get(lines,0,'')
3128
try
@@ -53,11 +50,10 @@ function! copilot#logger#Raw(level, message) abort
5350
endtry
5451
endfunction
5552

56-
function!copilot#logger#Trace(...)abort
57-
callcopilot#logger#Raw(5,a:000)
58-
endfunction
59-
6053
function!copilot#logger#Debug(...)abort
54+
if$COPILOT_AGENT_VERBOSE!~#'^\%(1\|true\)$'
55+
return
56+
endif
6157
callcopilot#logger#Raw(4,a:000)
6258
endfunction
6359

‎autoload/copilot/util.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
lets:deferred= []
2+
3+
function!copilot#util#Defer(fn,...)abort
4+
calladd(s:deferred,function(a:fn,a:000))
5+
returntimer_start(0,function('s:RunDeferred'))
6+
endfunction
7+
8+
function!s:RunDeferred(...)abort
9+
ifempty(s:deferred)
10+
return
11+
endif
12+
let Fn=remove(s:deferred,0)
13+
calltimer_start(0,function('s:RunDeferred'))
14+
callcall(Fn, [])
15+
endfunction

‎autoload/copilot/version.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
function!copilot#version#String()abort
2-
return'1.25.0'
2+
return'1.25.1'
33
endfunction

‎lua/_copilot.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ copilot.lsp_start_client = function(cmd, handler_names, opts, settings)
2222
end
2323
end
2424
end
25+
localworkspace_folders=opts.workspaceFolders
26+
if#workspace_folders==0then
27+
workspace_folders=nil
28+
end
2529
id=vim.lsp.start_client({
2630
cmd=cmd,
2731
cmd_cwd=vim.call('copilot#job#Cwd'),
2832
name='copilot',
2933
init_options=opts.initializationOptions,
30-
workspace_folders=opts.workspace_folders,
34+
workspace_folders=workspace_folders,
3135
settings=settings,
3236
handlers=handlers,
3337
get_language_id=function(bufnr,filetype)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp