nvim-config

Log | Files | Refs | Submodules | README

commit 1da5a76159f982f7c29f7089b97ae21b85115079
parent cd070614ce2c018cdae8bdd9a56b1824fc1a7cb9
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date:   Thu, 14 Apr 2022 07:20:53 +0200

fix(lsp): correctly filter root_dir

Diffstat:
Mlua/lsp_config.lua | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua @@ -35,7 +35,13 @@ local function on_attach(client, bufnr) buf_set_keymap('<Leader>s', 'require"telescope.builtin".lsp_dynamic_workspace_symbols()') -- I always have telecope on, but we never know - local f = vim.lsp.buf.list_workspace_folders()[1] + local f = nil + for _,path in pairs(vim.lsp.buf.list_workspace_folders()) do + if #path > 0 and path ~= vim.fn.expand("$HOME") then + f = path + break + end + end if pcall(require, 'telescope') and f then buf_set_keymap('<Leader>e', string.format('require"telescope.builtin".fd{ cwd = "%s" }', f)) end