Stabilize Telescope and trim Mason health checks
This commit is contained in:
47
nvim/lua/mason/health.lua
Normal file
47
nvim/lua/mason/health.lua
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
local health = vim.health or require("health")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local report_start = health.start or health.report_start
|
||||||
|
local report_ok = health.ok or health.report_ok
|
||||||
|
local report_warn = health.warn or health.report_warn
|
||||||
|
|
||||||
|
local function check_executable(name, command, advice)
|
||||||
|
if vim.fn.executable(command) == 1 then
|
||||||
|
report_ok(("%s: available"):format(name))
|
||||||
|
else
|
||||||
|
report_warn(("%s: not available"):format(name), advice and { advice } or {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function check_php()
|
||||||
|
local php_version = vim.fn.system({ "php", "-r", "echo PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;" })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
report_warn("PHP: not available", {
|
||||||
|
"Required for your configured Intelephense language server.",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
php_version = vim.trim(php_version)
|
||||||
|
if php_version:match("^8%.") then
|
||||||
|
report_ok(("PHP: `%s`"):format(php_version))
|
||||||
|
else
|
||||||
|
report_warn(("PHP: `%s`"):format(php_version), {
|
||||||
|
"PHP 8.x is recommended for your configured Intelephense language server.",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.check()
|
||||||
|
report_start("mason.nvim")
|
||||||
|
report_ok("Using local health override to skip unused language runtimes.")
|
||||||
|
report_ok("Skipped checks for Go, Rust/Cargo, LuaRocks, and Java.")
|
||||||
|
|
||||||
|
report_start("mason.nvim [Required runtimes]")
|
||||||
|
check_executable("node", "node", "Required for your configured TypeScript, ESLint, HTML, CSS, Emmet, and Intelephense language servers.")
|
||||||
|
check_executable("npm", "npm", "Required to install and manage the Mason packages used by your configured language servers.")
|
||||||
|
check_php()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -191,6 +191,7 @@ require("packer").startup(function(use)
|
|||||||
-- Fuzzy finder
|
-- Fuzzy finder
|
||||||
use({
|
use({
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
|
tag = "0.2.2",
|
||||||
requires = {
|
requires = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
|||||||
Reference in New Issue
Block a user