Skip to content

Commit c79d711

Browse files
committed
Copilot.vim 1.33.0
1 parent 25feddf commit c79d711

File tree

11 files changed

+300656
-200662
lines changed

11 files changed

+300656
-200662
lines changed

‎autoload/copilot.vim‎

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,48 @@ function! s:EditorConfiguration() abort
3535
endfunction
3636

3737
function!copilot#Init(...) abort
38-
callcopilot#util#Defer({-> exists('s:agent') ||s:Start() })
38+
callcopilot#util#Defer({-> exists('s:client') ||s:Start() })
3939
endfunction
4040

4141
function!s:Running() abort
42-
returnexists('s:agent.job') ||exists('s:agent.client_id')
42+
returnexists('s:client.job') ||exists('s:client.client_id')
4343
endfunction
4444

4545
function!s:Start() abort
4646
ifs:Running()
4747
return
4848
endif
49-
lets:agent=copilot#agent#New({'editorConfiguration' : s:EditorConfiguration()})
49+
lets:client=copilot#client#New({'editorConfiguration' : s:EditorConfiguration()})
5050
endfunction
5151

5252
function!s:Stop() abort
53-
ifexists('s:agent')
54-
letagent=remove(s:, 'agent')
55-
callagent.Close()
53+
ifexists('s:client')
54+
letclient=remove(s:, 'client')
55+
callclient.Close()
5656
endif
5757
endfunction
5858

59-
function!copilot#Agent() abort
59+
function!copilot#Client() abort
6060
calls:Start()
61-
returns:agent
61+
returns:client
6262
endfunction
6363

64-
function!copilot#RunningAgent() abort
64+
function!copilot#RunningClient() abort
6565
ifs:Running()
66-
returns:agent
66+
returns:client
6767
else
6868
returnv:null
6969
endif
7070
endfunction
7171

7272
function!s:NodeVersionWarning() abort
73-
ifexists('s:agent.node_version') &&s:agent.node_version =~# '^1[67]\.'
73+
ifexists('s:client.node_version') &&s:client.node_version =~# '^1[67]\.'
7474
echohlWarningMsg
75-
echo"Warning: Node.js"matchstr(s:agent.node_version, '^\d\+') "is end-of-life and support will be dropped in a future release of copilot.vim."
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."
7676
echohlNONE
77-
elseifexists('s:agent.node_version_warning')
77+
elseifexists('s:client.node_version_warning')
7878
echohlWarningMsg
79-
echo'Warning:'s:agent.node_version_warning
79+
echo'Warning:'s:client.node_version_warning
8080
echohlNONE
8181
endif
8282
endfunction
@@ -96,18 +96,18 @@ function! s:EditorVersionWarning() abort
9696
endfunction
9797

9898
function!copilot#Request(method, params, ...) abort
99-
letagent=copilot#Agent()
100-
returncall(agent.Request, [a:method, a:params] +a:000)
99+
letclient=copilot#Client()
100+
returncall(client.Request, [a:method, a:params] +a:000)
101101
endfunction
102102

103103
function!copilot#Call(method, params, ...) abort
104-
letagent=copilot#Agent()
105-
returncall(agent.Call, [a:method, a:params] +a:000)
104+
letclient=copilot#Client()
105+
returncall(client.Call, [a:method, a:params] +a:000)
106106
endfunction
107107

108108
function!copilot#Notify(method, params, ...) abort
109-
letagent=copilot#Agent()
110-
returncall(agent.Notify, [a:method, a:params] +a:000)
109+
letclient=copilot#Client()
110+
returncall(client.Notify, [a:method, a:params] +a:000)
111111
endfunction
112112

113113
function!copilot#NvimNs() abort
@@ -119,8 +119,8 @@ function! copilot#Clear() abort
119119
calltimer_stop(remove(g:, '_copilot_timer'))
120120
endif
121121
ifexists('b:_copilot')
122-
callcopilot#agent#Cancel(get(b:_copilot, 'first',{}))
123-
callcopilot#agent#Cancel(get(b:_copilot, 'cycling',{}))
122+
callcopilot#client#Cancel(get(b:_copilot, 'first',{}))
123+
callcopilot#client#Cancel(get(b:_copilot, 'cycling',{}))
124124
endif
125125
calls:UpdatePreview()
126126
unlet!b:_copilot
@@ -182,10 +182,10 @@ function! copilot#Complete(...) abort
182182
let target = [bufnr(''), getbufvar('', 'changedtick'), line('.'), col('.')]
183183
if!exists('b:_copilot.target') ||b:_copilot.target !=# target
184184
ifexists('b:_copilot.first')
185-
callcopilot#agent#Cancel(b:_copilot.first)
185+
callcopilot#client#Cancel(b:_copilot.first)
186186
endif
187187
ifexists('b:_copilot.cycling')
188-
callcopilot#agent#Cancel(b:_copilot.cycling)
188+
callcopilot#client#Cancel(b:_copilot.cycling)
189189
endif
190190
let params ={
191191
\ 'textDocument':{'uri': bufnr('')},
@@ -202,9 +202,9 @@ function! copilot#Complete(...) abort
202202
if!a:0
203203
return completion.Await()
204204
else
205-
callcopilot#agent#Result(completion, a:1)
205+
callcopilot#client#Result(completion, a:1)
206206
ifa:0 > 1
207-
callcopilot#agent#Error(completion, a:2)
207+
callcopilot#client#Error(completion, a:2)
208208
endif
209209
endif
210210
endfunction
@@ -414,7 +414,7 @@ endfunction
414414

415415
function!s:Attach(bufnr, ...) abort
416416
try
417-
returncopilot#Agent().Attach(a:bufnr)
417+
returncopilot#Client().Attach(a:bufnr)
418418
catch
419419
callcopilot#logger#Exception()
420420
endtry
@@ -427,8 +427,8 @@ function! copilot#OnFileType() abort
427427
endfunction
428428

429429
function!s:Focus(bufnr, ...) abort
430-
ifs:Running() &&copilot#Agent().IsAttached(a:bufnr)
431-
callcopilot#Agent().Notify('textDocument/didFocus',{'textDocument':{'uri': copilot#Agent().Attach(a:bufnr).uri}})
430+
ifs:Running() &&copilot#Client().IsAttached(a:bufnr)
431+
callcopilot#Client().Notify('textDocument/didFocus',{'textDocument':{'uri': copilot#Client().Attach(a:bufnr).uri}})
432432
endif
433433
endfunction
434434

@@ -577,7 +577,7 @@ function! s:EnabledStatusMessage() abort
577577
endfunction
578578

579579
function!s:VerifySetup() abort
580-
leterror=copilot#Agent().StartupError()
580+
leterror=copilot#Client().StartupError()
581581
if!empty(error)
582582
echo'Copilot: ' . error
583583
return
@@ -608,10 +608,10 @@ function! s:commands.status(opts) abort
608608
return
609609
endif
610610

611-
ifexists('s:agent.status.status') &&s:agent.status.status =~# 'Warning\|Error'
612-
echo'Copilot: ' . s:agent.status.status
613-
if!empty(get(s:agent.status, 'message', ''))
614-
echon': ' . s:agent.status.message
611+
ifexists('s:client.status.status') &&s:client.status.status =~# 'Warning\|Error'
612+
echo'Copilot: ' . s:client.status.status
613+
if!empty(get(s:client.status, 'message', ''))
614+
echon': ' . s:client.status.message
615615
endif
616616
return
617617
endif
@@ -638,7 +638,7 @@ function! s:commands.signout(opts) abort
638638
endfunction
639639

640640
function!s:commands.setup(opts) abort
641-
let startup_error =copilot#Agent().StartupError()
641+
let startup_error =copilot#Client().StartupError()
642642
if!empty(startup_error)
643643
echo'Copilot: ' . startup_error
644644
return
@@ -718,25 +718,25 @@ function! s:commands.help(opts) abort
718718
endfunction
719719

720720
function!s:commands.version(opts) abort
721-
echo'copilot.vim ' .copilot#agent#EditorPluginInfo().version
722-
let editorInfo =copilot#agent#EditorInfo()
721+
echo'copilot.vim ' .copilot#client#EditorPluginInfo().version
722+
let editorInfo =copilot#client#EditorInfo()
723723
echo editorInfo.name . '' . editorInfo.version
724724
ifs:Running()
725-
let versions =s:agent.Request('getVersion',{})
726-
ifexists('s:agent.serverInfo.version')
727-
echos:agent.serverInfo.name . '' . s:agent.serverInfo.version
725+
let versions =s:client.Request('getVersion',{})
726+
ifexists('s:client.serverInfo.version')
727+
echos:client.serverInfo.name . '' . s:client.serverInfo.version
728728
else
729729
echo'GitHub Copilot Language Server ' . versions.Await().version
730730
endif
731-
ifexists('s:agent.node_version')
732-
echo'Node.js ' . s:agent.node_version
731+
ifexists('s:client.node_version')
732+
echo'Node.js ' . s:client.node_version
733733
else
734734
echo'Node.js ' . substitute(get(versions.Await(), 'runtimeVersion', '?'), '^node/', '', 'g')
735735
endif
736736
else
737737
echo'Not running'
738-
ifexists('s:agent.node_version')
739-
echo'Node.js ' . s:agent.node_version
738+
ifexists('s:client.node_version')
739+
echo'Node.js ' . s:client.node_version
740740
endif
741741
endif
742742
ifhas('win32')
@@ -775,7 +775,7 @@ endfunction
775775

776776
function!s:commands.restart(opts) abort
777777
calls:Stop()
778-
let err =copilot#Agent().StartupError()
778+
let err =copilot#Client().StartupError()
779779
if!empty(err)
780780
return'echoerr ' . string('Copilot: ' . err)
781781
endif
@@ -818,7 +818,7 @@ function! copilot#Command(line1, line2, range, bang, mods, arg) abort
818818
return'echoerr ' . string('Copilot: unknown command ' . string(cmd))
819819
endif
820820
try
821-
let err =copilot#Agent().StartupError()
821+
let err =copilot#Client().StartupError()
822822
if!empty(err)
823823
return'echo ' . string('Copilot: ' . err)
824824
endif
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -377,22 +377,22 @@ function! s:OnExit(instance, code, ...) abort
377377
endif
378378
endfunction
379379

380-
function!copilot#agent#LspInit(id, initialize_result) abort
380+
function!copilot#client#LspInit(id, initialize_result) abort
381381
if!has_key(s:instances, a:id)
382382
return
383383
endif
384384
calls:AfterInitialize(a:initialize_result, s:instances[a:id])
385385
endfunction
386386

387-
function!copilot#agent#LspExit(id, code, signal) abort
387+
function!copilot#client#LspExit(id, code, signal) abort
388388
if!has_key(s:instances, a:id)
389389
return
390390
endif
391391
let instance =remove(s:instances, a:id)
392392
calls:OnExit(instance, a:code)
393393
endfunction
394394

395-
function!copilot#agent#LspResponse(id, opts, ...) abort
395+
function!copilot#client#LspResponse(id, opts, ...) abort
396396
if!has_key(s:instances, a:id)
397397
return
398398
endif
@@ -419,7 +419,7 @@ function! s:NvimRequest(method, params, ...) dict abort
419419
returncall('s:SetUpRequest', [self, id, a:method, params, progress] +a:000)
420420
endif
421421
ifhas_key(self, 'client_id')
422-
callcopilot#agent#LspExit(self.client_id, -1, -1)
422+
callcopilot#client#LspExit(self.client_id, -1, -1)
423423
endif
424424
throw'Copilot: LSP client not available'
425425
endfunction
@@ -435,7 +435,7 @@ function! s:NvimNotify(method, params) dict abort
435435
returneval("v:lua.require'_copilot'.rpc_notify(self.id, a:method, a:params)")
436436
endfunction
437437

438-
function!copilot#agent#LspHandle(id, request) abort
438+
function!copilot#client#LspHandle(id, request) abort
439439
if!has_key(s:instances, a:id)
440440
return
441441
endif
@@ -512,7 +512,7 @@ function! s:UrlDecode(str) abort
512512
returnsubstitute(a:str, '%\(\x\x\)', '\=iconv(nr2char("0x".submatch(1)), "utf-8", "latin1")', 'g')
513513
endfunction
514514

515-
function!copilot#agent#EditorInfo() abort
515+
function!copilot#client#EditorInfo() abort
516516
if!exists('s:editor_version')
517517
ifhas('nvim')
518518
lets:editor_version=matchstr(execute('version'), 'NVIM v\zs[^[:space:]]\+')
@@ -523,11 +523,11 @@ function! copilot#agent#EditorInfo() abort
523523
return{'name': has('nvim') ? 'Neovim': 'Vim', 'version': s:editor_version}
524524
endfunction
525525

526-
function!copilot#agent#EditorPluginInfo() abort
526+
function!copilot#client#EditorPluginInfo() abort
527527
return{'name': 'copilot.vim', 'version': s:plugin_version}
528528
endfunction
529529

530-
function!copilot#agent#Settings() abort
530+
function!copilot#client#Settings() abort
531531
let settings ={
532532
\ 'http':{
533533
\ 'proxy': get(g:, 'copilot_proxy', v:null),
@@ -609,7 +609,7 @@ let s:vim_capabilities ={
609609
\ 'window':{'showDocument':{'support': v:true}},
610610
\ }
611611

612-
function!copilot#agent#New(...) abort
612+
function!copilot#client#New(...) abort
613613
let opts =a:0 ? a:1 :{}
614614
let instance ={'requests':{},
615615
\ 'progress':{},
@@ -644,11 +644,11 @@ function! copilot#agent#New(...) abort
644644
endif
645645
let opts ={}
646646
let opts.initializationOptions ={
647-
\ 'editorInfo': copilot#agent#EditorInfo(),
648-
\ 'editorPluginInfo': copilot#agent#EditorPluginInfo(),
647+
\ 'editorInfo': copilot#client#EditorInfo(),
648+
\ 'editorPluginInfo': copilot#client#EditorPluginInfo(),
649649
\ }
650650
let opts.workspaceFolders = []
651-
let settings =extend(copilot#agent#Settings(), get(opts, 'editorConfiguration',{}))
651+
let settings =extend(copilot#client#Settings(), get(opts, 'editorConfiguration',{}))
652652
iftype(get(g:, 'copilot_workspace_folders')) ==v:t_list
653653
for folder ing:copilot_workspace_folders
654654
iftype(folder) ==v:t_string&&!empty(folder) && folder !~#'\*\*\|^/$'
@@ -699,7 +699,7 @@ function! copilot#agent#New(...) abort
699699
return instance
700700
endfunction
701701

702-
function!copilot#agent#Cancel(request) abort
702+
function!copilot#client#Cancel(request) abort
703703
iftype(a:request) ==type({}) &&has_key(a:request, 'Cancel')
704704
calla:request.Cancel()
705705
endif
@@ -712,15 +712,15 @@ function! s:Callback(request, type, callback, timer) abort
712712
endif
713713
endfunction
714714

715-
function!copilot#agent#Result(request, callback) abort
715+
function!copilot#client#Result(request, callback) abort
716716
ifhas_key(a:request, 'resolve')
717717
calladd(a:request.resolve, a:callback)
718718
elseifhas_key(a:request, 'result')
719719
leta:request.waiting[timer_start(0, function('s:Callback', [a:request, 'result', a:callback]))] =1
720720
endif
721721
endfunction
722722

723-
function!copilot#agent#Error(request, callback) abort
723+
function!copilot#client#Error(request, callback) abort
724724
ifhas_key(a:request, 'reject')
725725
calladd(a:request.reject, a:callback)
726726
elseifhas_key(a:request, 'error')

‎autoload/copilot/logger.vim‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ endfunction
7676
function!copilot#logger#Exception(...) abort
7777
if!empty(v:exception) &&v:exception!=#'Vim:Interrupt'
7878
callcopilot#logger#Error('Exception: ' . v:exception . ' @ ' . v:throwpoint)
79-
letagent=copilot#RunningAgent()
80-
if!empty(agent)
79+
letclient=copilot#RunningClient()
80+
if!empty(client)
8181
let [_, type, code, message; __] =matchlist(v:exception, '^\%(\(^[[:alnum:]_#]\+\)\%((\a\+)\)\=\%(\(:E-\=\d\+\)\)\=:\s*\)\=\(.*\)$')
8282
let stacklines = []
8383
for frame insplit(substitute(v:throwpoint, ', \S\+ \(\d\+\)$', '[\1]', ''), '\.\@<!\.\.\.\@!')
@@ -92,7 +92,7 @@ function! copilot#logger#Exception(...) abort
9292
calladd(stacklines,{'function': '[redacted]'})
9393
endif
9494
endfor
95-
returnagent.Request('telemetry/exception',{
95+
returnclient.Request('telemetry/exception',{
9696
\ 'transaction': a:0 ? a:1 : '',
9797
\ 'platform': 'other',
9898
\ 'exception_detail': [{

‎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.32.0'
2+
return'1.33.0'
33
endfunction

‎dist/agent.js‎

Lines changed: 329 additions & 328 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/agent.js.map‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)