From d24b3f1612e53f9d54d866b16bedab51813f2bf1 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 24 May 2025 18:29:51 +0200 Subject: feat(health): add healthcheck (#564) --- lua/mason-lspconfig/health.lua | 13 +++++++++++++ lua/mason-lspconfig/init.lua | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 lua/mason-lspconfig/health.lua diff --git a/lua/mason-lspconfig/health.lua b/lua/mason-lspconfig/health.lua new file mode 100644 index 0000000..c36f8eb --- /dev/null +++ b/lua/mason-lspconfig/health.lua @@ -0,0 +1,13 @@ +local M = {} + +function M.check() + vim.health.start "mason-lspconfig.nvim" + + if vim.fn.has "nvim-0.11" ~= 1 then + vim.health.error "Neovim v0.11 or higher is required." + else + vim.health.ok "Neovim v0.11" + end +end + +return M diff --git a/lua/mason-lspconfig/init.lua b/lua/mason-lspconfig/init.lua index c886285..c734213 100644 --- a/lua/mason-lspconfig/init.lua +++ b/lua/mason-lspconfig/init.lua @@ -7,10 +7,12 @@ local M = {} local function check_and_notify_bad_setup_order() local mason_ok, mason = pcall(require, "mason") local is_bad_order = not mason_ok or mason.has_setup == false - local impacts_functionality = not mason_ok or #settings.current.ensure_installed > 0 + local impacts_functionality = not mason_ok + or #settings.current.ensure_installed > 0 + or settings.current.automatic_enable ~= false if is_bad_order and impacts_functionality then require "mason-lspconfig.notify"( - "mason.nvim has not been set up. Make sure to set up 'mason' before 'mason-lspconfig'. :h mason-lspconfig-quickstart", + "mason.nvim has not been set up. Make sure to set up mason.nvim before mason-lspconfig.nvim. See :h mason-lspconfig-quickstart", vim.log.levels.WARN ) end -- cgit v1.2.3-70-g09d2