Skip to content

Commit

Permalink
fix(health): do not error if lspconfig is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
lopi-py committed Aug 30, 2024
1 parent fc832e6 commit 5503c0a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lua/luau-lsp/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ local function check_executable(opts)
local stdout = result.stdout or ""
if opts.version and vim.version.lt(stdout, opts.version) then
vim.health.error(
string.format("%s: required version is `%s`, found `%s`", opts.name, opts.version, stdout)
string.format(
"%s: required version is `%s`, found `%s`",
opts.name,
opts.version,
vim.trim(stdout)
)
)
return
end

vim.health.ok(string.format("%s: `%s`", opts.name, stdout))
vim.health.ok(string.format("%s: `%s`", opts.name, vim.trim(stdout)))
end

function M.check()
Expand All @@ -32,15 +37,15 @@ function M.check()
version = "1.32.0",
}

local autocmds = vim.api.nvim_get_autocmds {
local ok, autocmds = pcall(vim.api.nvim_get_autocmds, {
group = "lspconfig",
event = "FileType",
pattern = "luau",
}
if #autocmds == 0 then
vim.health.ok "No conflicts with `nvim-lspconfig`"
else
})
if ok and #autocmds > 0 then
vim.health.error "`lspconfig.luau_lsp.setup` was called, it may cause conflicts"
else
vim.health.ok "No conflicts with `nvim-lspconfig`"
end

vim.health.start "Rojo (required for automatic sourcemap generation)"
Expand Down

0 comments on commit 5503c0a

Please sign in to comment.