fix(root): dont use single-file lsps for root detection. use workspaces only
This commit is contained in:
@ -32,13 +32,12 @@ function M.detectors.lsp(buf)
|
|||||||
end
|
end
|
||||||
local roots = {} ---@type string[]
|
local roots = {} ---@type string[]
|
||||||
for _, client in pairs(Util.lsp.get_clients({ bufnr = buf })) do
|
for _, client in pairs(Util.lsp.get_clients({ bufnr = buf })) do
|
||||||
|
-- only check workspace folders, since we're not interested in clients
|
||||||
|
-- running in single file mode
|
||||||
local workspace = client.config.workspace_folders
|
local workspace = client.config.workspace_folders
|
||||||
for _, ws in pairs(workspace or {}) do
|
for _, ws in pairs(workspace or {}) do
|
||||||
roots[#roots + 1] = vim.uri_to_fname(ws.uri)
|
roots[#roots + 1] = vim.uri_to_fname(ws.uri)
|
||||||
end
|
end
|
||||||
if client.config.root_dir then
|
|
||||||
roots[#roots + 1] = client.config.root_dir
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return vim.tbl_filter(function(path)
|
return vim.tbl_filter(function(path)
|
||||||
path = Util.norm(path)
|
path = Util.norm(path)
|
||||||
|
Reference in New Issue
Block a user