diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-01-14 11:36:22 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-14 11:36:22 -0800 |
| commit | 7bd948b76aaf0804fd7a813bc7067720fd504163 (patch) | |
| tree | 94b70c825590474cbc9d7b1cb430c5ede49791c3 /lua | |
| parent | Merge pull request #659 from mjlbach/disable_transparency_lspinfo (diff) | |
| parent | [docgen] Update README.md (diff) | |
| download | nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.tar nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.tar.gz nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.tar.bz2 nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.tar.lz nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.tar.xz nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.tar.zst nvim-lspconfig-7bd948b76aaf0804fd7a813bc7067720fd504163.zip | |
Merge pull request #665 from mjlbach/fix_lsp_info_root_detect
Fix lsp info root detect
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig.lua | 16 | ||||
| -rw-r--r-- | lua/lspconfig/configs.lua | 6 |
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 |
