diff options
| author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-05-24 10:22:58 +0900 |
|---|---|---|
| committer | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-05-24 10:22:58 +0900 |
| commit | 2db8a342dab5f135e8f9d80d520ce56bf83da667 (patch) | |
| tree | f6b310220e1e6368529643cd0e0756a5730fde55 /lua/nvim_lsp | |
| parent | Merge pull request #244 from h-michael/test (diff) | |
| download | nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.tar nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.tar.gz nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.tar.bz2 nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.tar.lz nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.tar.xz nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.tar.zst nvim-lspconfig-2db8a342dab5f135e8f9d80d520ce56bf83da667.zip | |
healthcheck: skip healthcheck if make_config function is nil
resolve https://github.com/neovim/nvim-lsp/issues/248
Diffstat (limited to 'lua/nvim_lsp')
| -rw-r--r-- | lua/nvim_lsp/health.lua | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/lua/nvim_lsp/health.lua b/lua/nvim_lsp/health.lua index f319a265..d0e5820e 100644 --- a/lua/nvim_lsp/health.lua +++ b/lua/nvim_lsp/health.lua @@ -3,23 +3,21 @@ function M.check_health() local configs = require 'nvim_lsp/configs' for _, top_level_config in pairs(configs) do - -- the folder needs to exist - local config = top_level_config.make_config(".") + -- If users execute `:LspInstall` or `:LspInstallInfo`, + -- a config is required but is not added make_config function. + if not (top_level_config.make_config == nil) then + -- the folder needs to exist + local config = top_level_config.make_config(".") - local status, cmd = pcall(vim.lsp._cmd_parts, config.cmd) - if not status then - vim.fn['health#report_error']( - string.format("%s: config.cmd error, %s", config.name, cmd) - ) - else - 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) - ) + local status, cmd = pcall(vim.lsp._cmd_parts, config.cmd) + if not status then + vim.fn['health#report_error'](string.format("%s: config.cmd error, %s", config.name, cmd)) else - vim.fn['health#report_info']( - string.format("%s: configuration checked.", 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 |
