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