From 6f88b8b36f8d4fd0e958e59b4e37e1a9ed2acb78 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 15 Oct 2023 22:38:15 +0200 Subject: [PATCH] fix(root): dont use single-file lsps for root detection. use workspaces only --- lua/lazyvim/util/root.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index 80aece22..519546e1 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -32,13 +32,12 @@ function M.detectors.lsp(buf) end local roots = {} ---@type string[] 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 for _, ws in pairs(workspace or {}) do roots[#roots + 1] = vim.uri_to_fname(ws.uri) end - if client.config.root_dir then - roots[#roots + 1] = client.config.root_dir - end end return vim.tbl_filter(function(path) path = Util.norm(path)