Skip to content

Commit f97a59f

Browse files
zbirenbaumqRoC
andauthored
Update Copilot to use language-server.js (zbirenbaum#319)
* fix: rename agent.js to language-server.js * fix: enable nvim v0.10 features in v0.11+ versions --------- Co-authored-by: Andrii Savytskyi <contact@qroc.pro>
1 parent ec461c0 commit f97a59f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lua/copilot/command.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local function node_version_warning(node_version)
1010
local line = "Warning: Node.js 16 is approaching end of life and support will be dropped in a future release."
1111
if config.get("copilot_node_command") ~= "node" then
1212
line = line
13-
.. " 'copilot_node_command' is set to a non-default value. Consider removing it from your configuration."
13+
.. " 'copilot_node_command' is set to a non-default value. Consider removing it from your configuration."
1414
end
1515
return { line, "MoreMsg" }
1616
end
@@ -31,9 +31,9 @@ function mod.version()
3131
coroutine.wrap(function()
3232
if client then
3333
local _, data = a.get_version(client)
34-
lines[#lines + 1] = "copilot/dist/agent.js" .. " " .. data.version
34+
lines[#lines + 1] = "copilot/dist/language-server.js" .. " " .. data.version
3535
else
36-
lines[#lines + 1] = "copilot/dist/agent.js" .. " " .. "not running"
36+
lines[#lines + 1] = "copilot/dist/language-server.js" .. " " .. "not running"
3737
end
3838

3939
local node_version, node_version_error = c.get_node_version()

lua/copilot/suggestion.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local hl_group = require("copilot.highlight").group
55
local util = require("copilot.util")
66

77
local _, has_nvim_0_10_x = pcall(function()
8-
return vim.version().minor == 10
8+
return vim.version().minor >= 10
99
end)
1010

1111
local mod = {}
@@ -196,11 +196,11 @@ local function get_current_suggestion(ctx)
196196

197197
local ok, choice = pcall(function()
198198
if
199-
not vim.fn.mode():match("^[iR]")
200-
or (copilot.hide_during_completion and vim.fn.pumvisible() == 1)
201-
or vim.b.copilot_suggestion_hidden
202-
or not ctx.suggestions
203-
or #ctx.suggestions == 0
199+
not vim.fn.mode():match("^[iR]")
200+
or (copilot.hide_during_completion and vim.fn.pumvisible() == 1)
201+
or vim.b.copilot_suggestion_hidden
202+
or not ctx.suggestions
203+
or #ctx.suggestions == 0
204204
then
205205
return nil
206206
end
@@ -250,7 +250,7 @@ local function update_preview(ctx)
250250
local cursor_col = vim.fn.col(".")
251251

252252
displayLines[1] =
253-
string.sub(string.sub(suggestion.text, 1, (string.find(suggestion.text, "\n", 1, true) or 0) - 1), cursor_col)
253+
string.sub(string.sub(suggestion.text, 1, (string.find(suggestion.text, "\n", 1, true) or 0) - 1), cursor_col)
254254

255255
local extmark = {
256256
id = copilot.extmark_id,

0 commit comments

Comments
 (0)