aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/manager.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2024-09-23 14:28:32 +0800
committerGitHub <noreply@github.com>2024-09-23 14:28:32 +0800
commit5f9e043922969aa93f555a68ce10868ef7222867 (patch)
treea2243de0f29229107c64725e5df8a170b733433e /lua/lspconfig/manager.lua
parentfix(c3): fix typo of pattern (#3311) (diff)
downloadnvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.tar
nvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.tar.gz
nvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.tar.bz2
nvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.tar.lz
nvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.tar.xz
nvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.tar.zst
nvim-lspconfig-5f9e043922969aa93f555a68ce10868ef7222867.zip
fix: root_dir support string value directly (#3313)
root_dir in `vim.lsp.ClientConfig` can be a string type and in our annoation also mentioned `string|function` type. but actually root_dir does not support string type. add a type check of root_dir and then we can use `vim.fs.root` directly.
Diffstat (limited to 'lua/lspconfig/manager.lua')
-rw-r--r--lua/lspconfig/manager.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/lua/lspconfig/manager.lua b/lua/lspconfig/manager.lua
index 9b2c7d02..26fdc7de 100644
--- a/lua/lspconfig/manager.lua
+++ b/lua/lspconfig/manager.lua
@@ -270,12 +270,14 @@ function M:try_add(bufnr, project_root)
async.run(function()
local root_dir
- if get_root_dir then
+ if type(get_root_dir) == 'function' then
root_dir = get_root_dir(buf_path, bufnr)
async.reenter()
if not api.nvim_buf_is_valid(bufnr) then
return
end
+ elseif type(get_root_dir) == 'string' then
+ root_dir = get_root_dir
end
if root_dir then