aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-01-14 02:39:12 -0800
committerMichael Lingelbach <m.j.lbach@gmail.com>2021-01-14 11:34:56 -0800
commitacc93eb3febaaf3950f65b70fa33f21edfb963f0 (patch)
tree3046863b1057721fa3660cde04c69aab3ed08deb /lua
parentMerge pull request #659 from mjlbach/disable_transparency_lspinfo (diff)
downloadnvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.tar
nvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.tar.gz
nvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.tar.bz2
nvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.tar.lz
nvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.tar.xz
nvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.tar.zst
nvim-lspconfig-acc93eb3febaaf3950f65b70fa33f21edfb963f0.zip
Fix root detection for LspInfo, cache setup
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig.lua16
-rw-r--r--lua/lspconfig/configs.lua6
2 files changed, 12 insertions, 10 deletions
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua
index d8444160..2db8d67d 100644
--- a/lua/lspconfig.lua
+++ b/lua/lspconfig.lua
@@ -75,14 +75,10 @@ function M._root._setup()
local cmd_not_found_msg = "False. Please check your path and ensure the server is installed"
vim.list_extend(buf_lines, matching_config_header)
for _, config in pairs(configs) do
- --TODO(mjlbach): This is why the command is slow.
- -- We should change config initialization so this is cached (generally)
- local config_table = config.make_config(buffer_dir)
-
local cmd_is_executable, cmd
- if config_table.cmd then
- cmd = table.concat(config_table.cmd, " ")
- if vim.fn.executable(config_table.cmd[1]) == 1 then
+ if config.cmd then
+ cmd = table.concat(config.cmd, " ")
+ if vim.fn.executable(config.cmd[1]) == 1 then
cmd_is_executable = "True"
else
cmd_is_executable = cmd_not_found_msg
@@ -92,15 +88,15 @@ function M._root._setup()
cmd_is_executable = cmd
end
- for _, filetype_match in ipairs(config_table.filetypes) do
+ for _, filetype_match in ipairs(config.filetypes) do
if buffer_filetype == filetype_match then
local matching_config_info = {
"",
"Config: "..config.name,
"\tcmd: "..cmd,
"\tcmd is executable: ".. cmd_is_executable,
- "\tidentified root: "..(config_table.root_dir or "None"),
- "\tcustom handlers: "..table.concat(vim.tbl_keys(config_table.handlers), ", "),
+ "\tidentified root: "..(config.get_root_dir(buffer_dir) or "None"),
+ "\tcustom handlers: "..table.concat(vim.tbl_keys(config.handlers), ", "),
}
vim.list_extend(buf_lines, matching_config_info)
end
diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua
index d1b0090d..7da5c6ef 100644
--- a/lua/lspconfig/configs.lua
+++ b/lua/lspconfig/configs.lua
@@ -118,6 +118,12 @@ function configs.__newindex(t, config_name, config_def)
local get_root_dir = config.root_dir
+ -- Used by :LspInfo
+ M.get_root_dir = config.root_dir
+ M.filetypes = config.filetypes
+ M.handlers = config.handlers
+ M.cmd = config.cmd
+
-- In the case of a reload, close existing things.
if M.manager then
for _, client in ipairs(M.manager.clients()) do