feat(highlight): add DiagnosticOk (and associated) highlight groups (#21286)

The existing groups, Error, Hint, Info, Warn cover many use cases, but
neglect the occasion where a diagnostic message should communicate a
non-informative (not a Hint or Info) event. DiagnosticOk covers this
with a generic green colorscheme.
This commit is contained in:
Oliver Marriott
2022-12-29 03:01:40 +11:00
committed by GitHub
parent ab11157808
commit e6cae44cbf
3 changed files with 31 additions and 0 deletions

View File

@@ -206,6 +206,11 @@ DiagnosticInfo
*hl-DiagnosticHint* *hl-DiagnosticHint*
DiagnosticHint DiagnosticHint
Used as the base highlight group.
Other Diagnostic highlights link to this by default (except Underline)
*hl-DiagnosticOk*
DiagnosticOk
Used as the base highlight group. Used as the base highlight group.
Other Diagnostic highlights link to this by default (except Underline) Other Diagnostic highlights link to this by default (except Underline)
@@ -225,6 +230,10 @@ DiagnosticVirtualTextInfo
DiagnosticVirtualTextHint DiagnosticVirtualTextHint
Used for "Hint" diagnostic virtual text. Used for "Hint" diagnostic virtual text.
*hl-DiagnosticVirtualTextOk*
DiagnosticVirtualTextOk
Used for "Ok" diagnostic virtual text.
*hl-DiagnosticUnderlineError* *hl-DiagnosticUnderlineError*
DiagnosticUnderlineError DiagnosticUnderlineError
Used to underline "Error" diagnostics. Used to underline "Error" diagnostics.
@@ -241,6 +250,10 @@ DiagnosticUnderlineInfo
DiagnosticUnderlineHint DiagnosticUnderlineHint
Used to underline "Hint" diagnostics. Used to underline "Hint" diagnostics.
*hl-DiagnosticUnderlineOk*
DiagnosticUnderlineOk
Used to underline "Ok" diagnostics.
*hl-DiagnosticFloatingError* *hl-DiagnosticFloatingError*
DiagnosticFloatingError DiagnosticFloatingError
Used to color "Error" diagnostic messages in diagnostics float. Used to color "Error" diagnostic messages in diagnostics float.
@@ -258,6 +271,10 @@ DiagnosticFloatingInfo
DiagnosticFloatingHint DiagnosticFloatingHint
Used to color "Hint" diagnostic messages in diagnostics float. Used to color "Hint" diagnostic messages in diagnostics float.
*hl-DiagnosticFloatingOk*
DiagnosticFloatingOk
Used to color "Ok" diagnostic messages in diagnostics float.
*hl-DiagnosticSignError* *hl-DiagnosticSignError*
DiagnosticSignError DiagnosticSignError
Used for "Error" signs in sign column. Used for "Error" signs in sign column.
@@ -274,6 +291,10 @@ DiagnosticSignInfo
DiagnosticSignHint DiagnosticSignHint
Used for "Hint" signs in sign column. Used for "Hint" signs in sign column.
*hl-DiagnosticSignOk*
DiagnosticSignOk
Used for "Ok" signs in sign column.
============================================================================== ==============================================================================
SIGNS *diagnostic-signs* SIGNS *diagnostic-signs*

View File

@@ -192,22 +192,27 @@ static const char *highlight_init_both[] = {
"default DiagnosticWarn ctermfg=3 guifg=Orange", "default DiagnosticWarn ctermfg=3 guifg=Orange",
"default DiagnosticInfo ctermfg=4 guifg=LightBlue", "default DiagnosticInfo ctermfg=4 guifg=LightBlue",
"default DiagnosticHint ctermfg=7 guifg=LightGrey", "default DiagnosticHint ctermfg=7 guifg=LightGrey",
"default DiagnosticOk ctermfg=10 guifg=LightGreen",
"default DiagnosticUnderlineError cterm=underline gui=underline guisp=Red", "default DiagnosticUnderlineError cterm=underline gui=underline guisp=Red",
"default DiagnosticUnderlineWarn cterm=underline gui=underline guisp=Orange", "default DiagnosticUnderlineWarn cterm=underline gui=underline guisp=Orange",
"default DiagnosticUnderlineInfo cterm=underline gui=underline guisp=LightBlue", "default DiagnosticUnderlineInfo cterm=underline gui=underline guisp=LightBlue",
"default DiagnosticUnderlineHint cterm=underline gui=underline guisp=LightGrey", "default DiagnosticUnderlineHint cterm=underline gui=underline guisp=LightGrey",
"default DiagnosticUnderlineOk cterm=underline gui=underline guisp=LightGreen",
"default link DiagnosticVirtualTextError DiagnosticError", "default link DiagnosticVirtualTextError DiagnosticError",
"default link DiagnosticVirtualTextWarn DiagnosticWarn", "default link DiagnosticVirtualTextWarn DiagnosticWarn",
"default link DiagnosticVirtualTextInfo DiagnosticInfo", "default link DiagnosticVirtualTextInfo DiagnosticInfo",
"default link DiagnosticVirtualTextHint DiagnosticHint", "default link DiagnosticVirtualTextHint DiagnosticHint",
"default link DiagnosticVirtualTextOk DiagnosticOk",
"default link DiagnosticFloatingError DiagnosticError", "default link DiagnosticFloatingError DiagnosticError",
"default link DiagnosticFloatingWarn DiagnosticWarn", "default link DiagnosticFloatingWarn DiagnosticWarn",
"default link DiagnosticFloatingInfo DiagnosticInfo", "default link DiagnosticFloatingInfo DiagnosticInfo",
"default link DiagnosticFloatingHint DiagnosticHint", "default link DiagnosticFloatingHint DiagnosticHint",
"default link DiagnosticFloatingOk DiagnosticOk",
"default link DiagnosticSignError DiagnosticError", "default link DiagnosticSignError DiagnosticError",
"default link DiagnosticSignWarn DiagnosticWarn", "default link DiagnosticSignWarn DiagnosticWarn",
"default link DiagnosticSignInfo DiagnosticInfo", "default link DiagnosticSignInfo DiagnosticInfo",
"default link DiagnosticSignHint DiagnosticHint", "default link DiagnosticSignHint DiagnosticHint",
"default link DiagnosticSignOk DiagnosticOk",
// Text // Text
"default link @text.literal Comment", "default link @text.literal Comment",

View File

@@ -90,20 +90,25 @@ describe('vim.diagnostic', function()
'DiagnosticFloatingError', 'DiagnosticFloatingError',
'DiagnosticFloatingHint', 'DiagnosticFloatingHint',
'DiagnosticFloatingInfo', 'DiagnosticFloatingInfo',
'DiagnosticFloatingOk',
'DiagnosticFloatingWarn', 'DiagnosticFloatingWarn',
'DiagnosticHint', 'DiagnosticHint',
'DiagnosticInfo', 'DiagnosticInfo',
'DiagnosticOk',
'DiagnosticSignError', 'DiagnosticSignError',
'DiagnosticSignHint', 'DiagnosticSignHint',
'DiagnosticSignInfo', 'DiagnosticSignInfo',
'DiagnosticSignOk',
'DiagnosticSignWarn', 'DiagnosticSignWarn',
'DiagnosticUnderlineError', 'DiagnosticUnderlineError',
'DiagnosticUnderlineHint', 'DiagnosticUnderlineHint',
'DiagnosticUnderlineInfo', 'DiagnosticUnderlineInfo',
'DiagnosticUnderlineOk',
'DiagnosticUnderlineWarn', 'DiagnosticUnderlineWarn',
'DiagnosticVirtualTextError', 'DiagnosticVirtualTextError',
'DiagnosticVirtualTextHint', 'DiagnosticVirtualTextHint',
'DiagnosticVirtualTextInfo', 'DiagnosticVirtualTextInfo',
'DiagnosticVirtualTextOk',
'DiagnosticVirtualTextWarn', 'DiagnosticVirtualTextWarn',
'DiagnosticWarn', 'DiagnosticWarn',
}, exec_lua([[return vim.fn.getcompletion('Diagnostic', 'highlight')]])) }, exec_lua([[return vim.fn.getcompletion('Diagnostic', 'highlight')]]))