aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-01-14 20:57:02 -0800
committerGitHub <noreply@github.com>2021-01-14 20:57:02 -0800
commita82f57a34c58429fcea9e1154ee37cd70e6f6cc0 (patch)
tree228f3f649bf7e9204e58ded1720ea1fd3ff9cb72 /lua
parentMerge pull request #665 from mjlbach/fix_lsp_info_root_detect (diff)
parentLspInfo: fix when filetypes not defined (diff)
downloadnvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.tar
nvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.tar.gz
nvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.tar.bz2
nvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.tar.lz
nvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.tar.xz
nvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.tar.zst
nvim-lspconfig-a82f57a34c58429fcea9e1154ee37cd70e6f6cc0.zip
Merge pull request #669 from mjlbach/fix_filetypes
Fix LspInfo when filetypes not defined
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig.lua29
1 files changed, 20 insertions, 9 deletions
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua
index 2db8d67d..d84b8a01 100644
--- a/lua/lspconfig.lua
+++ b/lua/lspconfig.lua
@@ -87,25 +87,36 @@ function M._root._setup()
cmd = "cmd not defined"
cmd_is_executable = cmd
end
-
- for _, filetype_match in ipairs(config.filetypes) do
- if buffer_filetype == filetype_match then
+ if config.filetypes then
+ 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.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
+ end
+ else
local matching_config_info = {
"",
"Config: "..config.name,
- "\tcmd: "..cmd,
- "\tcmd is executable: ".. cmd_is_executable,
- "\tidentified root: "..(config.get_root_dir(buffer_dir) or "None"),
- "\tcustom handlers: "..table.concat(vim.tbl_keys(config.handlers), ", "),
+ "\tfiletype: ".."No filetypes defined, please define filetypes in setup().",
}
vim.list_extend(buf_lines, matching_config_info)
- end
end
end
buf_lines = vim.lsp.util._trim_and_pad(buf_lines, { pad_left = 2, pad_top = 1})
vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, buf_lines )
vim.fn.matchadd("Title", table.concat(vim.tbl_keys(configs), '\\|'))
- vim.fn.matchadd("Error", "cmd not defined\\|"..cmd_not_found_msg)
+ vim.fn.matchadd("Error",
+ "No filetypes defined, please define filetypes in setup().\\|"..
+ "cmd not defined\\|" ..
+ cmd_not_found_msg)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<esc>', '<cmd>bd<CR>', { noremap = true})
vim.lsp.util.close_preview_autocmd({"BufHidden", "BufLeave"}, win_id)
end;