Add diagnostic severity highlighting for quickfix lists

Enhance visibility of diagnostic messages in quickfix and location
lists by adding custom syntax groups for error, warning, info,
hint, and note.
This commit is contained in:
Ray Elliott 2025-12-11 23:56:10 +00:00
parent f2a94d10ac
commit bd89c05068
2 changed files with 31 additions and 1 deletions

View File

@ -76,5 +76,27 @@ vim.api.nvim_create_autocmd("FileType", {
end,
})
-- Phase 11.8: Colorize diagnostic severity in quickfix/location list
vim.api.nvim_create_autocmd("FileType", {
group = aug,
pattern = "qf", -- Applies to both quickfix and location list
callback = function()
-- Use matchadd() for higher priority highlighting
-- This will override the default qf syntax
vim.fn.matchadd('qfError', '\\<error\\>', 10)
vim.fn.matchadd('qfWarning', '\\<warning\\>', 10)
vim.fn.matchadd('qfInfo', '\\<info\\>', 10)
vim.fn.matchadd('qfHint', '\\<hint\\>', 10)
vim.fn.matchadd('qfNote', '\\<note\\>', 10)
-- Also match uppercase variants
vim.fn.matchadd('qfError', '\\<Error\\>', 10)
vim.fn.matchadd('qfWarning', '\\<Warning\\>', 10)
vim.fn.matchadd('qfInfo', '\\<Info\\>', 10)
vim.fn.matchadd('qfHint', '\\<Hint\\>', 10)
vim.fn.matchadd('qfNote', '\\<Note\\>', 10)
end,
})
return {}

View File

@ -118,11 +118,19 @@ return {
Conceal = 'Noise',
-- ============================================================================
-- QuickFix
-- QuickFix & Location List
-- ============================================================================
QuickFixLine = { bg = c.bg_hl_special_weak, bold = true },
-- Diagnostic severity highlighting in quickfix/location list
-- These are custom syntax groups defined in autocmds.lua
qfError = { fg = c.diag_error, bold = true }, -- "error:" or "[E]"
qfWarning = { fg = c.diag_warn, bold = true }, -- "warning:" or "[W]"
qfInfo = { fg = c.diag_info, bold = true }, -- "info:" or "[I]"
qfHint = { fg = c.diag_hint, bold = true }, -- "hint:" or "[H]"
qfNote = { fg = c.diag_hint, bold = true }, -- "note:" (same as hint)
-- ============================================================================
-- Debug
-- ============================================================================