Skip to content

Commit 1bfbaf5

Browse files
committed
Copilot.vim 1.5.3
1 parent e219dd9 commit 1bfbaf5

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

autoload/copilot.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,18 @@ function! s:commands.help(opts) abort
692692
return a:opts.mods . ' help ' . (len(a:opts.arg) ? ':Copilot_' . a:opts.arg : 'copilot')
693693
endfunction
694694

695+
function! s:commands.version(opts) abort
696+
let info = copilot#agent#EditorInfo()
697+
echo 'copilot.vim ' .info.editorPluginInfo.version
698+
echo info.editorInfo.name . ' ' . info.editorInfo.version
699+
if exists('s:agent.node_version')
700+
echo 'copilot/dist/agent.js ' . s:agent.Call('getVersion', {}).version
701+
echo 'Node.js ' . s:agent.node_version
702+
else
703+
echo 'copilot/dist/agent.js not running'
704+
endif
705+
endfunction
706+
695707
let s:feedback_url = 'https://github.com/github-community/community/discussions/categories/copilot'
696708
function! s:commands.feedback(opts) abort
697709
echo s:feedback_url

autoload/copilot/agent.vim

Lines changed: 14 additions & 13 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.5.2'
8+
let s:plugin_version = '1.5.3'
99

1010
let s:error_exit = -1
1111

@@ -76,15 +76,15 @@ function! s:RequestAwait() dict abort
7676
throw 'copilot#agent(' . self.error.code . '): ' . self.error.message
7777
endfunction
7878

79-
function s:RequestAgent() dict abort
79+
function! s:RequestAgent() dict abort
8080
return get(s:instances, self.agent_id, v:null)
8181
endfunction
8282

8383
if !exists('s:id')
8484
let s:id = 0
8585
endif
8686

87-
function s:SetUpRequest(agent, id, method, params, ...) abort
87+
function! s:SetUpRequest(agent, id, method, params, ...) abort
8888
let request = {
8989
\ 'agent_id': a:agent.id,
9090
\ 'id': a:id,
@@ -329,7 +329,7 @@ function! s:LspNotify(method, params) dict abort
329329
return v:lua.require'_copilot'.rpc_notify(self.id, a:method, a:params)
330330
endfunction
331331

332-
function copilot#agent#LspHandle(agent_id, response) abort
332+
function! copilot#agent#LspHandle(agent_id, response) abort
333333
if !has_key(s:instances, a:agent_id)
334334
return
335335
endif
@@ -352,7 +352,7 @@ endfunction
352352

353353
function! s:Command() abort
354354
if !has('nvim-0.6') && v:version < 802
355-
return [v:null, 'Vim version too old']
355+
return [v:null, '', 'Vim version too old']
356356
endif
357357
let node = get(g:, 'copilot_node_command', '')
358358
if empty(node)
@@ -362,9 +362,9 @@ function! s:Command() abort
362362
endif
363363
if !executable(get(node, 0, ''))
364364
if get(node, 0, '') ==# 'node'
365-
return [v:null, 'Node.js not found in PATH']
365+
return [v:null, '', 'Node.js not found in PATH']
366366
else
367-
return [v:null, 'Node.js executable `' . get(node, 0, '') . "' not found"]
367+
return [v:null, '', 'Node.js executable `' . get(node, 0, '') . "' not found"]
368368
endif
369369
endif
370370
let out = []
@@ -378,21 +378,21 @@ function! s:Command() abort
378378
let too_new = major >= 18
379379
if !get(g:, 'copilot_ignore_node_version')
380380
if major == 0
381-
return [v:null, 'Could not determine Node.js version']
381+
return [v:null, node_version, 'Could not determine Node.js version']
382382
elseif (major < 16 || too_new) && s:IsArmMacOS()
383-
return [v:null, 'Node.js version 16.x or 17.x required on Apple Silicon but found ' . node_version]
383+
return [v:null, node_version, 'Node.js version 16.x or 17.x required on Apple Silicon but found ' . node_version]
384384
elseif major < 12 || too_new
385-
return [v:null, 'Node.js version 12.x–17.x required but found ' . node_version]
385+
return [v:null, node_version, 'Node.js version 12.x–17.x required but found ' . node_version]
386386
endif
387387
endif
388388
let agent = s:root . '/copilot/dist/agent.js'
389389
if !filereadable(agent)
390390
let agent = get(g:, 'copilot_agent_command', '')
391391
if !filereadable(agent)
392-
return [v:null, 'Could not find agent.js (bad install?)']
392+
return [v:null, node_version, 'Could not find agent.js (bad install?)']
393393
endif
394394
endif
395-
return [node + [agent], '']
395+
return [node + [agent], node_version, '']
396396
endfunction
397397

398398
function! copilot#agent#EditorInfo() abort
@@ -445,12 +445,13 @@ function! copilot#agent#New(...) abort
445445
\ 'Cancel': function('s:AgentCancel'),
446446
\ 'StartupError': function('s:AgentStartupError'),
447447
\ }
448-
let [command, command_error] = s:Command()
448+
let [command, node_version, command_error] = s:Command()
449449
if len(command_error)
450450
let instance.id = -1
451451
let instance.startup_error = command_error
452452
return instance
453453
endif
454+
let instance.node_version = node_version
454455
if has('nvim')
455456
call extend(instance, {
456457
\ 'Close': function('s:LspClose'),

copilot/dist/agent.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/copilot.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ COMMANDS *:Copilot*
1616
*:Copilot_enable*
1717
:Copilot enable Re-enable GitHub Copilot after :Copilot disable.
1818

19-
*:Copilot_feedback*
20-
:Copilot feedback Open the website for providing GitHub Copilot
21-
feedback.
22-
2319
*:Copilot_setup*
2420
:Copilot setup Authenticate and enable GitHub Copilot.
2521

@@ -37,6 +33,14 @@ COMMANDS *:Copilot*
3733
to solution. This is the default command if :Copilot
3834
is called without an argument.
3935

36+
*:Copilot_version*
37+
:Copilot version Show version information.
38+
39+
*:Copilot_feedback*
40+
:Copilot feedback Open the website for providing GitHub Copilot
41+
feedback. Be sure to include |:Copilot_version|
42+
output when reporting a bug.
43+
4044
OPTIONS *copilot-options*
4145

4246
*g:copilot_filetypes*

0 commit comments

Comments
 (0)