aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2020-03-10 02:03:30 +0900
committerGitHub <noreply@github.com>2020-03-10 02:03:30 +0900
commit001b501817b3420227fa5ceacbe4b476576d0974 (patch)
tree5c238ae252d7e6cf5cd48cae4ef8f8cb496bc5d2 /lua
parentMerge pull request #162 from kazukazuinaina/add_check_Duplicate (diff)
parenthealthcheck: use pcall (diff)
downloadnvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.tar
nvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.tar.gz
nvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.tar.bz2
nvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.tar.lz
nvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.tar.xz
nvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.tar.zst
nvim-lspconfig-001b501817b3420227fa5ceacbe4b476576d0974.zip
Merge pull request #141 from h-michael/healthcheck
healthcheck: use pcall for config.cmd error
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim_lsp/health.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/lua/nvim_lsp/health.lua b/lua/nvim_lsp/health.lua
index 584b1cfc..f319a265 100644
--- a/lua/nvim_lsp/health.lua
+++ b/lua/nvim_lsp/health.lua
@@ -4,17 +4,23 @@ function M.check_health()
for _, top_level_config in pairs(configs) do
-- the folder needs to exist
- local new_config = top_level_config.make_config(".")
+ local config = top_level_config.make_config(".")
- local cmd, _ = vim.lsp._cmd_parts(new_config.cmd)
- if not (vim.fn.executable(cmd) == 1) then
+ local status, cmd = pcall(vim.lsp._cmd_parts, config.cmd)
+ if not status then
vim.fn['health#report_error'](
- string.format("%s: The given command %q is not executable.", new_config.name, cmd)
+ string.format("%s: config.cmd error, %s", config.name, cmd)
)
else
- vim.fn['health#report_info'](
- string.format("%s: configuration checked.", new_config.name)
- )
+ if not (vim.fn.executable(cmd) == 1) then
+ vim.fn['health#report_error'](
+ string.format("%s: The given command %q is not executable.", config.name, cmd)
+ )
+ else
+ vim.fn['health#report_info'](
+ string.format("%s: configuration checked.", config.name)
+ )
+ end
end
end
end