Skip to content

Commit 74dab52

Browse files
authored
refactor!: rename lsp to copilot_ls (#20)
1 parent 028fc35 commit 74dab52

File tree

5 files changed

+21
-32
lines changed

5 files changed

+21
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ return {
2626
"copilotlsp-nvim/copilot-lsp",
2727
init = function()
2828
vim.g.copilot_nes_debounce = 500
29-
vim.lsp.enable("copilot")
29+
vim.lsp.enable("copilot_ls")
3030
vim.keymap.set("n", "<tab>", function()
3131
-- Try to jump to the start of the suggestion edit.
3232
-- If already at the start, then apply the pending suggestion and jump to the end of the edit.

lsp/copilot.lua renamed to lsp/copilot_ls.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ local version = vim.version()
33
---@type vim.lsp.Config
44
return {
55
--NOTE: This name means that existing blink completion works
6-
name = "copilot",
6+
name = "copilot_ls",
77
cmd = {
88
"copilot-language-server",
99
"--stdio",

lua/copilot-lsp/completion/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ local function handle_inlineCompletion_response(_results, _ctx, _config)
1919
-- for _, result in pairs(results1) do
2020
-- --TODO: Ghost text for completions
2121
-- -- This is where we show the completion results
22-
-- -- However, the LSP being named "copilot" is enough for blink-cmp to show the completion
22+
-- -- However, the LSP being named "copilot_ls" is enough for blink-cmp to show the completion
2323
-- end
2424
end
2525

tests/nes/test_nes.lua

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,34 @@ T["nes"] = MiniTest.new_set({
1010
child.restart({ "-u", "scripts/minimal_init.lua" })
1111
child.lua_func(function()
1212
vim.g.copilot_nes_debounce = 450
13-
vim.lsp.config("copilot", {
13+
vim.lsp.config("copilot_ls", {
1414
cmd = require("tests.mock_lsp").server,
1515
})
16-
vim.lsp.enable("copilot")
16+
vim.lsp.enable("copilot_ls")
1717
end)
1818
end,
1919
post_once = child.stop,
2020
},
2121
})
2222

23+
T["nes"]["lsp starts"] = function()
24+
child.cmd("edit tests/fixtures/sameline_edit.txt")
25+
local lsp_count = child.lua_func(function()
26+
local count = 0
27+
local clients = vim.lsp.get_clients()
28+
for _, _ in pairs(clients) do
29+
--NOTE: #clients doesn't work, so we count in the loop
30+
count = count + 1
31+
end
32+
return count
33+
end)
34+
eq(lsp_count, 1)
35+
end
36+
2337
T["nes"]["same line edit"] = function()
2438
child.cmd("edit tests/fixtures/sameline_edit.txt")
2539
ref(child.get_screenshot())
2640
vim.uv.sleep(500)
27-
local lsp_name = child.lua_func(function()
28-
return vim.lsp.get_clients()[1].name
29-
end)
30-
eq(lsp_name, "copilot")
3141
child.lua_func(function()
3242
local copilot = vim.lsp.get_clients()[1]
3343
require("copilot-lsp.nes").request_nes(copilot)
@@ -44,10 +54,6 @@ T["nes"]["multi line edit"] = function()
4454
child.cmd("edit tests/fixtures/multiline_edit.txt")
4555
ref(child.get_screenshot())
4656
vim.uv.sleep(500)
47-
local lsp_name = child.lua_func(function()
48-
return vim.lsp.get_clients()[1].name
49-
end)
50-
eq(lsp_name, "copilot")
5157
child.lua_func(function()
5258
local copilot = vim.lsp.get_clients()[1]
5359
require("copilot-lsp.nes").request_nes(copilot)
@@ -64,10 +70,6 @@ T["nes"]["removal edit"] = function()
6470
child.cmd("edit tests/fixtures/removal_edit.txt")
6571
ref(child.get_screenshot())
6672
vim.uv.sleep(500)
67-
local lsp_name = child.lua_func(function()
68-
return vim.lsp.get_clients()[1].name
69-
end)
70-
eq(lsp_name, "copilot")
7173
child.lua_func(function()
7274
local copilot = vim.lsp.get_clients()[1]
7375
require("copilot-lsp.nes").request_nes(copilot)
@@ -88,10 +90,6 @@ T["nes"]["add only edit"] = function()
8890
child.cmd("edit tests/fixtures/addonly_edit.txt")
8991
ref(child.get_screenshot())
9092
vim.uv.sleep(500)
91-
local lsp_name = child.lua_func(function()
92-
return vim.lsp.get_clients()[1].name
93-
end)
94-
eq(lsp_name, "copilot")
9593
child.lua_func(function()
9694
local copilot = vim.lsp.get_clients()[1]
9795
require("copilot-lsp.nes").request_nes(copilot)
@@ -119,10 +117,6 @@ T["nes"]["highlights replacement"] = function()
119117
end)
120118
ref(child.get_screenshot())
121119
vim.uv.sleep(500)
122-
local lsp_name = child.lua_func(function()
123-
return vim.lsp.get_clients()[1].name
124-
end)
125-
eq(lsp_name, "copilot")
126120
child.lua_func(function()
127121
local copilot = vim.lsp.get_clients()[1]
128122
require("copilot-lsp.nes").request_nes(copilot)

tests/test_signin.lua

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local eq = MiniTest.expect.equality
21
local ref = MiniTest.expect.reference_screenshot
32

43
local child = MiniTest.new_child_neovim()
@@ -9,10 +8,10 @@ T["signin"] = MiniTest.new_set({
98
pre_case = function()
109
child.restart({ "-u", "scripts/minimal_init.lua" })
1110
child.lua_func(function()
12-
vim.lsp.config("copilot", {
11+
vim.lsp.config("copilot_ls", {
1312
cmd = require("tests.mock_lsp").server,
1413
})
15-
vim.lsp.enable("copilot")
14+
vim.lsp.enable("copilot_ls")
1615
end)
1716
end,
1817
post_once = child.stop,
@@ -23,10 +22,6 @@ T["signin"]["shows modal"] = function()
2322
child.cmd("edit tests/fixtures/signin.txt")
2423
ref(child.get_screenshot())
2524
vim.uv.sleep(500)
26-
local lsp_name = child.lua_func(function()
27-
return vim.lsp.get_clients()[1].name
28-
end)
29-
eq(lsp_name, "copilot")
3025
child.lua_func(function()
3126
local copilot = vim.lsp.get_clients()[1]
3227
copilot.handlers["signIn"](nil, {

0 commit comments

Comments
 (0)