Skip to content

Commit

Permalink
fix: fix lsp detector
Browse files Browse the repository at this point in the history
  • Loading branch information
RayGuo-ergou committed Nov 25, 2024
1 parent c13da99 commit 690e0cf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nvim/lua/ergou/util/root.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ function M.detectors.lsp(buf)
return {}
end
local roots = {} ---@type string[]
for _, client in pairs(ergou.lsp.get_clients({ bufnr = buf })) do
local clients = ergou.lsp.get_clients({ bufnr = buf })
clients = vim.tbl_filter(function(client)
return not vim.tbl_contains(vim.g.root_lsp_ignore or {}, client.name)
end, clients)
for _, client in pairs(clients) do
-- only check workspace folders, since we're not interested in clients
-- running in single file mode
local workspace = client.config.workspace_folders
for _, ws in pairs(workspace or {}) do
roots[#roots + 1] = vim.uri_to_fname(ws.uri)
end
if client.root_dir then
roots[#roots + 1] = client.root_dir
end
end
return vim.tbl_filter(function(path)
path = ergou.norm(path)
Expand Down

0 comments on commit 690e0cf

Please sign in to comment.