@@ -35,48 +35,48 @@ function! s:EditorConfiguration() abort
35
35
endfunction
36
36
37
37
function ! copilot#Init (... )abort
38
- call copilot#util#Defer ({- >exists (' s:agent ' )|| s: Start () })
38
+ call copilot#util#Defer ({- >exists (' s:client ' )|| s: Start () })
39
39
endfunction
40
40
41
41
function ! 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' )
43
43
endfunction
44
44
45
45
function ! s: Start ()abort
46
46
if s: Running ()
47
47
return
48
48
endif
49
- let s: agent = copilot#agent #New ({' editorConfiguration' :s: EditorConfiguration ()})
49
+ let s: client = copilot#client #New ({' editorConfiguration' :s: EditorConfiguration ()})
50
50
endfunction
51
51
52
52
function ! 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 ()
56
56
endif
57
57
endfunction
58
58
59
- function ! copilot#Agent ()abort
59
+ function ! copilot#Client ()abort
60
60
call s: Start ()
61
- return s: agent
61
+ return s: client
62
62
endfunction
63
63
64
- function ! copilot#RunningAgent ()abort
64
+ function ! copilot#RunningClient ()abort
65
65
if s: Running ()
66
- return s: agent
66
+ return s: client
67
67
else
68
68
return v: null
69
69
endif
70
70
endfunction
71
71
72
72
function ! 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]\.'
74
74
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."
76
76
echohl NONE
77
- elseif exists (' s:agent .node_version_warning' )
77
+ elseif exists (' s:client .node_version_warning' )
78
78
echohl WarningMsg
79
- echo ' Warning:' s: agent .node_version_warning
79
+ echo ' Warning:' s: client .node_version_warning
80
80
echohl NONE
81
81
endif
82
82
endfunction
@@ -96,18 +96,18 @@ function! s:EditorVersionWarning() abort
96
96
endfunction
97
97
98
98
function ! 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 )
101
101
endfunction
102
102
103
103
function ! 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 )
106
106
endfunction
107
107
108
108
function ! 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 )
111
111
endfunction
112
112
113
113
function ! copilot#NvimNs ()abort
@@ -119,8 +119,8 @@ function! copilot#Clear() abort
119
119
call timer_stop (remove (g: ,' _copilot_timer' ))
120
120
endif
121
121
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' , {}))
124
124
endif
125
125
call s: UpdatePreview ()
126
126
unlet ! b: _copilot
@@ -182,10 +182,10 @@ function! copilot#Complete(...) abort
182
182
let target= [bufnr (' ' ),getbufvar (' ' ,' changedtick' ),line (' .' ),col (' .' )]
183
183
if ! exists (' b:_copilot.target' )|| b: _copilot .target!=# target
184
184
if exists (' b:_copilot.first' )
185
- call copilot#agent #Cancel (b: _copilot .first )
185
+ call copilot#client #Cancel (b: _copilot .first )
186
186
endif
187
187
if exists (' b:_copilot.cycling' )
188
- call copilot#agent #Cancel (b: _copilot .cycling)
188
+ call copilot#client #Cancel (b: _copilot .cycling)
189
189
endif
190
190
let params= {
191
191
\ ' textDocument' : {' uri' :bufnr (' ' )},
@@ -202,9 +202,9 @@ function! copilot#Complete(...) abort
202
202
if ! a: 0
203
203
return completion.Await ()
204
204
else
205
- call copilot#agent #Result (completion,a: 1 )
205
+ call copilot#client #Result (completion,a: 1 )
206
206
if a: 0 > 1
207
- call copilot#agent #Error (completion,a: 2 )
207
+ call copilot#client #Error (completion,a: 2 )
208
208
endif
209
209
endif
210
210
endfunction
@@ -414,7 +414,7 @@ endfunction
414
414
415
415
function ! s: Attach (bufnr ,... )abort
416
416
try
417
- return copilot#Agent ().Attach (a: bufnr )
417
+ return copilot#Client ().Attach (a: bufnr )
418
418
catch
419
419
call copilot#logger#Exception ()
420
420
endtry
@@ -427,8 +427,8 @@ function! copilot#OnFileType() abort
427
427
endfunction
428
428
429
429
function ! 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}})
432
432
endif
433
433
endfunction
434
434
@@ -577,7 +577,7 @@ function! s:EnabledStatusMessage() abort
577
577
endfunction
578
578
579
579
function ! s: VerifySetup ()abort
580
- let error = copilot#Agent ().StartupError ()
580
+ let error = copilot#Client ().StartupError ()
581
581
if ! empty (error )
582
582
echo ' Copilot:' .error
583
583
return
@@ -608,10 +608,10 @@ function! s:commands.status(opts) abort
608
608
return
609
609
endif
610
610
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
615
615
endif
616
616
return
617
617
endif
@@ -638,7 +638,7 @@ function! s:commands.signout(opts) abort
638
638
endfunction
639
639
640
640
function ! s: commands .setup (opts)abort
641
- let startup_error= copilot#Agent ().StartupError ()
641
+ let startup_error= copilot#Client ().StartupError ()
642
642
if ! empty (startup_error)
643
643
echo ' Copilot:' . startup_error
644
644
return
@@ -718,25 +718,25 @@ function! s:commands.help(opts) abort
718
718
endfunction
719
719
720
720
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 ()
723
723
echo editorInfo.name .' ' . editorInfo.version
724
724
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
728
728
else
729
729
echo ' GitHub Copilot Language Server' . versions.Await ().version
730
730
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
733
733
else
734
734
echo ' Node.js' .substitute (get (versions.Await (),' runtimeVersion' ,' ?' ),' ^node/' ,' ' ,' g' )
735
735
endif
736
736
else
737
737
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
740
740
endif
741
741
endif
742
742
if has (' win32' )
@@ -775,7 +775,7 @@ endfunction
775
775
776
776
function ! s: commands .restart (opts)abort
777
777
call s: Stop ()
778
- let err= copilot#Agent ().StartupError ()
778
+ let err= copilot#Client ().StartupError ()
779
779
if ! empty (err)
780
780
return ' echoerr' .string (' Copilot:' . err)
781
781
endif
@@ -818,7 +818,7 @@ function! copilot#Command(line1, line2, range, bang, mods, arg) abort
818
818
return ' echoerr' .string (' Copilot: unknown command' .string (cmd))
819
819
endif
820
820
try
821
- let err= copilot#Agent ().StartupError ()
821
+ let err= copilot#Client ().StartupError ()
822
822
if ! empty (err)
823
823
return ' echo' .string (' Copilot:' . err)
824
824
endif