feat(root): provide vim.g.root_lsp_ignore
to ignore LSP servers (#4332)
## Description This provides `vim.g.root_lsp_ignore` for users to customize which LSP servers should be taken into account when evaluating the LSP `root_dir`. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Related Issue(s) Closes #4330 <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. --> ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:

committed by
GitHub

parent
3b8f6554f4
commit
90a92312ae
@ -40,6 +40,10 @@ vim.g.lazyvim_statuscolumn = {
|
||||
-- * powershell
|
||||
-- LazyVim.terminal.setup("pwsh")
|
||||
|
||||
-- Set LSP servers to be ignored when used with `util.root.detectors.lsp`
|
||||
-- for detecting the LSP root
|
||||
vim.g.root_lsp_ignore = { "copilot" }
|
||||
|
||||
-- Hide deprecation warnings
|
||||
vim.g.deprecation_warnings = false
|
||||
|
||||
|
@ -29,7 +29,11 @@ function M.detectors.lsp(buf)
|
||||
return {}
|
||||
end
|
||||
local roots = {} ---@type string[]
|
||||
for _, client in pairs(LazyVim.lsp.get_clients({ bufnr = buf })) do
|
||||
local clients = LazyVim.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
|
||||
local workspace = client.config.workspace_folders
|
||||
for _, ws in pairs(workspace or {}) do
|
||||
roots[#roots + 1] = vim.uri_to_fname(ws.uri)
|
||||
|
Reference in New Issue
Block a user