@@ -35,48 +35,48 @@ function! s:EditorConfiguration() abort
3535endfunction
3636
3737function ! copilot#Init (... ) abort
38- call copilot#util#Defer ({- > exists (' s:agent ' ) || s: Start () })
38+ call copilot#util#Defer ({- > exists (' s:client ' ) || s: Start () })
3939endfunction
4040
4141function ! s: Running () abort
42- return exists (' s:agent .job' ) || exists (' s:agent .client_id' )
42+ return exists (' s:client .job' ) || exists (' s:client .client_id' )
4343endfunction
4444
4545function ! s: Start () abort
4646if s: Running ()
4747return
4848endif
49- let s: agent = copilot#agent #New ({' editorConfiguration' : s: EditorConfiguration ()})
49+ let s: client = copilot#client #New ({' editorConfiguration' : s: EditorConfiguration ()})
5050endfunction
5151
5252function ! s: Stop () abort
53- if exists (' s:agent ' )
54- let agent = remove (s: , ' agent ' )
55- call agent .Close ()
53+ if exists (' s:client ' )
54+ let client = remove (s: , ' client ' )
55+ call client .Close ()
5656endif
5757endfunction
5858
59- function ! copilot#Agent () abort
59+ function ! copilot#Client () abort
6060call s: Start ()
61- return s: agent
61+ return s: client
6262endfunction
6363
64- function ! copilot#RunningAgent () abort
64+ function ! copilot#RunningClient () abort
6565if s: Running ()
66- return s: agent
66+ return s: client
6767else
6868return v: null
6969endif
7070endfunction
7171
7272function ! s: NodeVersionWarning () abort
73- if exists (' s:agent .node_version' ) && s: agent .node_version = ~# ' ^1[67]\.'
73+ if exists (' s:client .node_version' ) && s: client .node_version = ~# ' ^1[67]\.'
7474echohl WarningMsg
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."
7676echohl NONE
77- elseif exists (' s:agent .node_version_warning' )
77+ elseif exists (' s:client .node_version_warning' )
7878echohl WarningMsg
79- echo ' Warning:' s: agent .node_version_warning
79+ echo ' Warning:' s: client .node_version_warning
8080echohl NONE
8181endif
8282endfunction
@@ -96,18 +96,18 @@ function! s:EditorVersionWarning() abort
9696endfunction
9797
9898function ! copilot#Request (method, params, ... ) abort
99- let agent = copilot#Agent ()
100- return call (agent .Request, [a: method , a: params ] + a: 000 )
99+ let client = copilot#Client ()
100+ return call (client .Request, [a: method , a: params ] + a: 000 )
101101endfunction
102102
103103function ! copilot#Call (method, params, ... ) abort
104- let agent = copilot#Agent ()
105- return call (agent .Call, [a: method , a: params ] + a: 000 )
104+ let client = copilot#Client ()
105+ return call (client .Call, [a: method , a: params ] + a: 000 )
106106endfunction
107107
108108function ! copilot#Notify (method, params, ... ) abort
109- let agent = copilot#Agent ()
110- return call (agent .Notify, [a: method , a: params ] + a: 000 )
109+ let client = copilot#Client ()
110+ return call (client .Notify, [a: method , a: params ] + a: 000 )
111111endfunction
112112
113113function ! copilot#NvimNs () abort
@@ -119,8 +119,8 @@ function! copilot#Clear() abort
119119call timer_stop (remove (g: , ' _copilot_timer' ))
120120endif
121121if exists (' b:_copilot' )
122- call copilot#agent #Cancel (get (b: _copilot , ' first' ,{}))
123- call copilot#agent #Cancel (get (b: _copilot , ' cycling' ,{}))
122+ call copilot#client #Cancel (get (b: _copilot , ' first' ,{}))
123+ call copilot#client #Cancel (get (b: _copilot , ' cycling' ,{}))
124124endif
125125call s: UpdatePreview ()
126126unlet ! b: _copilot
@@ -182,10 +182,10 @@ function! copilot#Complete(...) abort
182182let target = [bufnr (' ' ), getbufvar (' ' , ' changedtick' ), line (' .' ), col (' .' )]
183183if ! exists (' b:_copilot.target' ) || b: _copilot .target !=# target
184184if exists (' b:_copilot.first' )
185- call copilot#agent #Cancel (b: _copilot .first )
185+ call copilot#client #Cancel (b: _copilot .first )
186186endif
187187if exists (' b:_copilot.cycling' )
188- call copilot#agent #Cancel (b: _copilot .cycling)
188+ call copilot#client #Cancel (b: _copilot .cycling)
189189endif
190190let params = {
191191\ ' textDocument' :{' uri' : bufnr (' ' )},
@@ -202,9 +202,9 @@ function! copilot#Complete(...) abort
202202if ! a: 0
203203return completion.Await ()
204204else
205- call copilot#agent #Result (completion, a: 1 )
205+ call copilot#client #Result (completion, a: 1 )
206206if a: 0 > 1
207- call copilot#agent #Error (completion, a: 2 )
207+ call copilot#client #Error (completion, a: 2 )
208208endif
209209endif
210210endfunction
@@ -414,7 +414,7 @@ endfunction
414414
415415function ! s: Attach (bufnr , ... ) abort
416416try
417- return copilot#Agent ().Attach (a: bufnr )
417+ return copilot#Client ().Attach (a: bufnr )
418418catch
419419call copilot#logger#Exception ()
420420endtry
@@ -427,8 +427,8 @@ function! copilot#OnFileType() abort
427427endfunction
428428
429429function ! s: Focus (bufnr , ... ) abort
430- if s: Running () && copilot#Agent ().IsAttached (a: bufnr )
431- call copilot#Agent ().Notify (' textDocument/didFocus' ,{' textDocument' :{' uri' : copilot#Agent ().Attach (a: bufnr ).uri}})
430+ if s: Running () && copilot#Client ().IsAttached (a: bufnr )
431+ call copilot#Client ().Notify (' textDocument/didFocus' ,{' textDocument' :{' uri' : copilot#Client ().Attach (a: bufnr ).uri}})
432432endif
433433endfunction
434434
@@ -577,7 +577,7 @@ function! s:EnabledStatusMessage() abort
577577endfunction
578578
579579function ! s: VerifySetup () abort
580- let error = copilot#Agent ().StartupError ()
580+ let error = copilot#Client ().StartupError ()
581581if ! empty (error )
582582echo ' Copilot: ' . error
583583return
@@ -608,10 +608,10 @@ function! s:commands.status(opts) abort
608608return
609609endif
610610
611- if exists (' 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+ if exists (' 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
615615endif
616616return
617617endif
@@ -638,7 +638,7 @@ function! s:commands.signout(opts) abort
638638endfunction
639639
640640function ! s: commands .setup (opts) abort
641- let startup_error = copilot#Agent ().StartupError ()
641+ let startup_error = copilot#Client ().StartupError ()
642642if ! empty (startup_error)
643643echo ' Copilot: ' . startup_error
644644return
@@ -718,25 +718,25 @@ function! s:commands.help(opts) abort
718718endfunction
719719
720720function ! 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 ()
723723echo editorInfo.name . ' ' . editorInfo.version
724724if s: Running ()
725- let versions = s: agent .Request (' getVersion' ,{})
726- if exists (' s:agent .serverInfo.version' )
727- echo s: agent .serverInfo.name . ' ' . s: agent .serverInfo.version
725+ let versions = s: client .Request (' getVersion' ,{})
726+ if exists (' s:client .serverInfo.version' )
727+ echo s: client .serverInfo.name . ' ' . s: client .serverInfo.version
728728else
729729echo ' GitHub Copilot Language Server ' . versions.Await ().version
730730endif
731- if exists (' s:agent .node_version' )
732- echo ' Node.js ' . s: agent .node_version
731+ if exists (' s:client .node_version' )
732+ echo ' Node.js ' . s: client .node_version
733733else
734734echo ' Node.js ' . substitute (get (versions.Await (), ' runtimeVersion' , ' ?' ), ' ^node/' , ' ' , ' g' )
735735endif
736736else
737737echo ' Not running'
738- if exists (' s:agent .node_version' )
739- echo ' Node.js ' . s: agent .node_version
738+ if exists (' s:client .node_version' )
739+ echo ' Node.js ' . s: client .node_version
740740endif
741741endif
742742if has (' win32' )
@@ -775,7 +775,7 @@ endfunction
775775
776776function ! s: commands .restart (opts) abort
777777call s: Stop ()
778- let err = copilot#Agent ().StartupError ()
778+ let err = copilot#Client ().StartupError ()
779779if ! empty (err)
780780return ' echoerr ' . string (' Copilot: ' . err)
781781endif
@@ -818,7 +818,7 @@ function! copilot#Command(line1, line2, range, bang, mods, arg) abort
818818return ' echoerr ' . string (' Copilot: unknown command ' . string (cmd))
819819endif
820820try
821- let err = copilot#Agent ().StartupError ()
821+ let err = copilot#Client ().StartupError ()
822822if ! empty (err)
823823return ' echo ' . string (' Copilot: ' . err)
824824endif
0 commit comments