Skip to content

Commit ad102c7

Browse files
committed
Copilot.vim 1.3.2
1 parent f6cdb5c commit ad102c7

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

autoload/copilot/agent.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55

66
scriptencoding utf-8
77

8-
let s:plugin_version = '1.3.1'
8+
let s:plugin_version = '1.3.2'
99

1010
let s:error_exit = -1
1111

@@ -71,7 +71,7 @@ function! s:RequestAwait() dict abort
7171
endfunction
7272

7373
function s:RequestAgent() dict abort
74-
return get(s:instances, self.agent_pid, v:null)
74+
return get(s:instances, self.agent_id, v:null)
7575
endfunction
7676

7777
if !exists('s:id')
@@ -82,7 +82,7 @@ function! s:AgentRequest(method, params, ...) dict abort
8282
let request = {'method': a:method, 'params': a:params, 'id': s:id}
8383
call s:Send(self, request)
8484
call extend(request, {
85-
\ 'agent_pid': self.pid,
85+
\ 'agent_id': self.id,
8686
\ 'Agent': function('s:RequestAgent'),
8787
\ 'Wait': function('s:RequestWait'),
8888
\ 'Await': function('s:RequestAwait'),
@@ -173,7 +173,7 @@ function! s:OnMessage(agent, body, ...) abort
173173
elseif has_key(a:agent.methods, response.method)
174174
call timer_start(0, function('s:DispatchMessage', [a:agent, a:agent.methods[response.method], id, params]))
175175
else
176-
return s:Send(a:agent, {"id": id, "code": -32700, "message": "Method not found: " . method})
176+
return s:Send(a:agent, {"id": id, "error": {"code": -32700, "message": "Method not found: " . response.method}})
177177
endif
178178
return
179179
endif
@@ -257,7 +257,7 @@ function! s:OnExit(agent, code) abort
257257
let request.waiting[timer_start(0, function('s:Callback', [request, 'error', Cb]))] = 1
258258
endfor
259259
endfor
260-
call timer_start(0, { _ -> get(s:instances, a:agent.pid) is# a:agent ? remove(s:instances, a:agent.pid) : {} })
260+
call timer_start(0, { _ -> get(s:instances, a:agent.id) is# a:agent ? remove(s:instances, a:agent.id) : {} })
261261
call copilot#logger#Info('agent exited with status ' . a:code)
262262
endfunction
263263

@@ -372,7 +372,7 @@ function! copilot#agent#New(...) abort
372372
\ }
373373
let [command, command_error] = s:Command()
374374
if len(command_error)
375-
let instance.pid = -1
375+
let instance.id = -1
376376
let instance.startup_error = command_error
377377
return instance
378378
endif
@@ -381,9 +381,9 @@ function! copilot#agent#New(...) abort
381381
\ function('s:OnOut', [instance, state]),
382382
\ function('s:OnErr', [instance]),
383383
\ function('s:OnExit', [instance]))
384-
let instance.pid = exists('*jobpid') ? jobpid(instance.job) : job_info(instance.job).process
384+
let instance.id = exists('*jobpid') ? jobpid(instance.job) : job_info(instance.job).process
385385
let request = instance.Request('initialize', {'capabilities': {}}, function('s:GetCapabilitiesResult'), function('s:GetCapabilitiesError'), instance)
386-
let s:instances[instance.pid] = instance
386+
let s:instances[instance.id] = instance
387387
return instance
388388
endfunction
389389

copilot/dist/agent.js

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

doc/copilot.txt

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ COMMANDS *:Copilot*
3737
to solution. This is the default command if :Copilot
3838
is called without an argument.
3939

40-
OPTIONS
40+
OPTIONS *copilot-options*
4141

4242
*g:copilot_filetypes*
4343
g:copilot_filetypes A dictionary mapping file types to their enabled
@@ -62,6 +62,14 @@ b:copilot_enabled Set to v:false to disable GitHub Copilot for the
6262
current buffer. Or set to v:true to force enabling
6363
it, overriding g:copilot_filetypes.
6464

65+
*g:copilot_node_command*
66+
g:copilot_node_command Tell Copilot what `node` binary to use with
67+
g:copilot_node_command. This is useful if the `node`
68+
in your PATH is an unsupported version.
69+
>
70+
let g:copilot_node_command =
71+
\ "~/.nodenv/versions/16.15.0/bin/node"
72+
6573
MAPS *copilot-maps*
6674

6775
*copilot-i_<Tab>*
@@ -102,17 +110,5 @@ after/colors/<colorschemename>.vim in your 'runtimepath' (e.g.,
102110
~/.config/nvim/after/colors/solarized.vim). Example declaration:
103111
>
104112
highlight CopilotSuggestion guifg=#555555 ctermfg=8
105-
<
106-
CONFIGURATION *copilot-configuration*
107-
108-
*g:copilot_node_command*
109-
Tell Copilot what `node` binary to use with g:copilot_node_command.
110-
This is useful if the `node` in your PATH is an unsupported version.
111-
>
112-
let g:copilot_node_command = "~/.nodenv/versions/16.15.0/bin/node"
113-
<
114-
Lua version:
115-
>
116-
vim.g.copilot_node_command = "$NVM_DIR/versions/node/v16.15.0/bin/node"
117113
<
118114
vim:tw=78:et:ft=help:norl:

0 commit comments

Comments
 (0)