Skip to content

Commit dc579f9

Browse files
committed
fix: broken :Copilot version command
Fixes #466
1 parent 4d4840b commit dc579f9

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

lua/copilot/command.lua

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ function M.version()
99
local info = u.get_editor_info()
1010

1111
---@type string
12-
local lines = {
13-
info.editorInfo.name .. " " .. info.editorInfo.version,
14-
"copilot language server" .. " " .. info.editorPluginInfo.version,
15-
"copilot.lua" .. " " .. u.get_copilot_lua_version(),
16-
}
12+
local lines = info.editorInfo.name
13+
.. " "
14+
.. info.editorInfo.version
15+
.. "\n"
16+
.. "copilot language server"
17+
.. " "
18+
.. info.editorPluginInfo.version
19+
.. "\n"
20+
.. "copilot.lua"
21+
.. " "
22+
.. u.get_copilot_lua_version()
1723

1824
local client = c.get()
1925

tests/test_command.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
local child_helper = require("tests.child_helper")
2+
local child = child_helper.new_child_neovim("test_suggestion")
3+
local u = require("tests.utils")
4+
5+
local T = MiniTest.new_set({
6+
hooks = {
7+
pre_once = function() end,
8+
pre_case = function()
9+
child.run_pre_case()
10+
child.bo.readonly = false
11+
end,
12+
post_once = child.stop,
13+
},
14+
})
15+
16+
T["command()"] = MiniTest.new_set()
17+
18+
T["command()"]["version works"] = function()
19+
child.configure_copilot()
20+
child.cmd("Copilot version")
21+
local result = child.cmd_capture("mess")
22+
u.expect_match(result, ".*copilot language server.*copilot%.lua.*Node%.js.*language%-server%.js.*")
23+
end
24+
25+
return T

0 commit comments

Comments
 (0)