File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ local function reuse_client_default(client, config)
211
211
212
212
for _ , config_folder in ipairs (config_folders ) do
213
213
local found = false
214
- for _ , client_folder in ipairs (client .workspace_folders ) do
214
+ for _ , client_folder in ipairs (client .workspace_folders or {} ) do
215
215
if config_folder .uri == client_folder .uri then
216
216
found = true
217
217
break
Original file line number Diff line number Diff line change @@ -1854,6 +1854,20 @@ describe('LSP', function()
1854
1854
end ,
1855
1855
}
1856
1856
end )
1857
+
1858
+ it (' vim.lsp.start when existing client has no workspace_folders' , function ()
1859
+ exec_lua (create_server_definition )
1860
+ eq (
1861
+ { 2 , ' foo' , ' foo' },
1862
+ exec_lua (function ()
1863
+ local server = _G ._create_server ()
1864
+ vim .lsp .start { cmd = server .cmd , name = ' foo' }
1865
+ vim .lsp .start { cmd = server .cmd , name = ' foo' , root_dir = ' bar' }
1866
+ local foos = vim .lsp .get_clients ()
1867
+ return { # foos , foos [1 ].name , foos [2 ].name }
1868
+ end )
1869
+ )
1870
+ end )
1857
1871
end )
1858
1872
1859
1873
describe (' parsing tests' , function ()
You can’t perform that action at this time.
0 commit comments