diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 81b5f081..3ad70c16 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -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 diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index fc81e92f..b723b227 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -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)