feat(health): improvements to :checkhealth #40935

Changes:
- Removed the blank line before the first healthcheck header.
- Fixed a bug where the entire "Terminal" section of `vim.health` would
  not appear if the `infocmp` executable was not found.
- Fixed a typo in `vim.lsp` when displaying the LSP log level.
This commit is contained in:
Olivia Kinnear
2026-07-24 10:54:12 -05:00
committed by GitHub
parent 20f44076dc
commit bb104ba4db
4 changed files with 27 additions and 30 deletions

View File

@@ -459,7 +459,6 @@ function M._check(eap)
for _, name in ipairs(names) do
local value = healthchecks[name]
progress_msg('running', check_idx, 'checking %s', name)
check_idx = check_idx + 1
local func = value[1]
local type = value[2]
s_output = {}
@@ -508,7 +507,9 @@ function M._check(eap)
end
s_output[#s_output + 1] = ''
s_output = vim.list_extend(header, s_output)
vim.fn.append(vim.fn.line('$'), s_output)
vim.api.nvim_buf_set_lines(0, check_idx == 1 and 0 or -1, -1, true, s_output)
check_idx = check_idx + 1
end
progress_msg('success', nil, 'checks done')

View File

@@ -486,15 +486,12 @@ local function check_graphics()
end
end
local function check_terminal()
-- Note: this is part of check_terminal().
local function check_infocmp()
if vim.fn.executable('infocmp') == 0 then
return
end
health.start('Terminal')
check_graphics()
local cmd = { 'infocmp', '-L' }
local ok, out = system(cmd)
local kbs_entry = vim.fn.matchstr(out, 'key_backspace=[^,[:space:]]*')
@@ -527,6 +524,14 @@ local function check_terminal()
)
)
end
end
local function check_terminal()
health.start('Terminal')
check_graphics()
check_infocmp()
for _, env_var in ipairs({
'XTERM_VERSION',

View File

@@ -24,7 +24,7 @@ local function check_log()
local log = vim.lsp.log
local current_log_level = log.get_level()
local log_level_string = log.levels[current_log_level] ---@type string
report_info(string.format('LSP log level : %s', log_level_string))
report_info(string.format('LSP log level: %s', log_level_string))
if current_log_level < log.levels.WARN then
report_warn(