From 4c3c3f388557a182794bffdbf923129c66af885a Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:10:54 +0200 Subject: feat: add lvim.lsp.smart_cwd (#1218) - Enable querying the language-server for the `root_dir` - Use `root_dir` to set the current working-directory (CWD) - Make vim-rooter configurable and add an option to disable it Inspired by "ahmedkhalf/lsp-rooter.nvim" --- lua/utils/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lua/utils') diff --git a/lua/utils/init.lua b/lua/utils/init.lua index 9c9b8523..c043550f 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -112,6 +112,16 @@ function utils.check_lsp_client_active(name) return false end +function utils.get_active_client_by_ft(filetype) + local clients = vim.lsp.get_active_clients() + for _, client in pairs(clients) do + if client.name == lvim.lang[filetype].lsp.provider then + return client + end + end + return nil +end + --- Extends a list-like table with the unique values of another list-like table. --- --- NOTE: This mutates dst! -- cgit v1.2.3