diff options
author | kylo252 <[email protected]> | 2021-08-03 18:10:54 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-03 12:10:54 -0400 |
commit | 4c3c3f388557a182794bffdbf923129c66af885a (patch) | |
tree | 4138b428ccfbee42ffecdbc88bc7d2d42fa67195 /lua/utils/init.lua | |
parent | b608b08ff3a5f28e7c57bc7bd7a30cfe2ab5c111 (diff) |
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"
Diffstat (limited to 'lua/utils/init.lua')
-rw-r--r-- | lua/utils/init.lua | 10 |
1 files changed, 10 insertions, 0 deletions
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! |