aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim_lsp/health.lua
blob: f319a265667cd2acd6ade90986c87966100d6d52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local M = {}
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(".")

    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)
        )
      else
        vim.fn['health#report_info'](
          string.format("%s: configuration checked.", config.name)
        )
      end
    end
  end
end

return M