@@ -10,24 +10,34 @@ T["nes"] = MiniTest.new_set({
10
10
child .restart ({ " -u" , " scripts/minimal_init.lua" })
11
11
child .lua_func (function ()
12
12
vim .g .copilot_nes_debounce = 450
13
- vim .lsp .config (" copilot " , {
13
+ vim .lsp .config (" copilot_ls " , {
14
14
cmd = require (" tests.mock_lsp" ).server ,
15
15
})
16
- vim .lsp .enable (" copilot " )
16
+ vim .lsp .enable (" copilot_ls " )
17
17
end )
18
18
end ,
19
19
post_once = child .stop ,
20
20
},
21
21
})
22
22
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
+
23
37
T [" nes" ][" same line edit" ] = function ()
24
38
child .cmd (" edit tests/fixtures/sameline_edit.txt" )
25
39
ref (child .get_screenshot ())
26
40
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" )
31
41
child .lua_func (function ()
32
42
local copilot = vim .lsp .get_clients ()[1 ]
33
43
require (" copilot-lsp.nes" ).request_nes (copilot )
@@ -44,10 +54,6 @@ T["nes"]["multi line edit"] = function()
44
54
child .cmd (" edit tests/fixtures/multiline_edit.txt" )
45
55
ref (child .get_screenshot ())
46
56
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" )
51
57
child .lua_func (function ()
52
58
local copilot = vim .lsp .get_clients ()[1 ]
53
59
require (" copilot-lsp.nes" ).request_nes (copilot )
@@ -64,10 +70,6 @@ T["nes"]["removal edit"] = function()
64
70
child .cmd (" edit tests/fixtures/removal_edit.txt" )
65
71
ref (child .get_screenshot ())
66
72
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" )
71
73
child .lua_func (function ()
72
74
local copilot = vim .lsp .get_clients ()[1 ]
73
75
require (" copilot-lsp.nes" ).request_nes (copilot )
@@ -88,10 +90,6 @@ T["nes"]["add only edit"] = function()
88
90
child .cmd (" edit tests/fixtures/addonly_edit.txt" )
89
91
ref (child .get_screenshot ())
90
92
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" )
95
93
child .lua_func (function ()
96
94
local copilot = vim .lsp .get_clients ()[1 ]
97
95
require (" copilot-lsp.nes" ).request_nes (copilot )
@@ -119,10 +117,6 @@ T["nes"]["highlights replacement"] = function()
119
117
end )
120
118
ref (child .get_screenshot ())
121
119
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" )
126
120
child .lua_func (function ()
127
121
local copilot = vim .lsp .get_clients ()[1 ]
128
122
require (" copilot-lsp.nes" ).request_nes (copilot )
0 commit comments