health check

This commit is contained in:
TJ DeVries 2024-02-26 08:55:52 -05:00
parent 5775433158
commit 30a1ccc89b
2 changed files with 51 additions and 3 deletions

View File

@ -542,12 +542,12 @@ require('lazy').setup({
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- If you use something like typescript, where the tooling is as bad as the language,
-- then you might need to install and configure something like this:
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- If you only have simple needs for typescript, then you can probably just use tsserver
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
--
lua_ls = {
-- cmd = {...},

48
lua/kickstart/health.lua Normal file
View File

@ -0,0 +1,48 @@
--[[
--
-- This file is not required for your own configuration,
-- but helps people determine if their system is setup correctly.
--
--]]
local check_version = function()
if not vim.version.cmp then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
return
end
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version())))
else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
end
end
local check_external_reqs = function()
-- Basic utils: `git`, `make`, `unzip`
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe))
else
vim.health.warn(string.format("Could not find executable: '%s'", exe))
end
end
return true
end
return {
check = function()
vim.health.start 'kickstart.nvim'
vim.health.info [[You don't have to fix every 'WARNING' you see in checkheath."
Just fix the ones for the plugins and languages you intend to use.'
For example, in Mason, you may see warnings about several language runtimes'
but if you are not planning on developing in those languages, you do not have'
to fix those at this time']]
check_version()
check_external_reqs()
end,
}