@@ -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
4646 if s: Running ()
4747 return
4848 endif
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 ()
5656 endif
5757endfunction
5858
59- function ! copilot#Agent () abort
59+ function ! copilot#Client () abort
6060 call s: Start ()
61- return s: agent
61+ return s: client
6262endfunction
6363
64- function ! copilot#RunningAgent () abort
64+ function ! copilot#RunningClient () abort
6565 if s: Running ()
66- return s: agent
66+ return s: client
6767 else
6868 return v: null
6969 endif
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]\.'
7474 echohl 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."
7676 echohl NONE
77- elseif exists (' s:agent .node_version_warning' )
77+ elseif exists (' s:client .node_version_warning' )
7878 echohl WarningMsg
79- echo ' Warning:' s: agent .node_version_warning
79+ echo ' Warning:' s: client .node_version_warning
8080 echohl NONE
8181 endif
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
119119 call timer_stop (remove (g: , ' _copilot_timer' ))
120120 endif
121121 if 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' , {}))
124124 endif
125125 call s: 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 if exists (' b:_copilot.first' )
185- call copilot#agent #Cancel (b: _copilot .first )
185+ call copilot#client #Cancel (b: _copilot .first )
186186 endif
187187 if exists (' b:_copilot.cycling' )
188- call copilot#agent #Cancel (b: _copilot .cycling)
188+ call copilot#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- call copilot#agent #Result (completion, a: 1 )
205+ call copilot#client #Result (completion, a: 1 )
206206 if a: 0 > 1
207- call copilot#agent #Error (completion, a: 2 )
207+ call copilot#client #Error (completion, a: 2 )
208208 endif
209209 endif
210210endfunction
@@ -414,7 +414,7 @@ endfunction
414414
415415function ! s: Attach (bufnr , ... ) abort
416416 try
417- return copilot#Agent ().Attach (a: bufnr )
417+ return copilot#Client ().Attach (a: bufnr )
418418 catch
419419 call copilot#logger#Exception ()
420420 endtry
@@ -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}})
432432 endif
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 ()
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- 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
615615 endif
616616 return
617617 endif
@@ -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 ()
642642 if ! empty (startup_error)
643643 echo ' Copilot: ' . startup_error
644644 return
@@ -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 ()
723723 echo editorInfo.name . ' ' . editorInfo.version
724724 if 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
728728 else
729729 echo ' GitHub Copilot Language Server ' . versions.Await ().version
730730 endif
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
733733 else
734734 echo ' Node.js ' . substitute (get (versions.Await (), ' runtimeVersion' , ' ?' ), ' ^node/' , ' ' , ' g' )
735735 endif
736736 else
737737 echo ' 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
740740 endif
741741 endif
742742 if has (' win32' )
@@ -775,7 +775,7 @@ endfunction
775775
776776function ! s: commands .restart (opts) abort
777777 call s: 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
0 commit comments