Skip to content

Commit

Permalink
feat(native_lsp): support new "Ok" diagnostics
Browse files Browse the repository at this point in the history
Defaults to using the green color.

This was not added to the "LspDiagnostic*" highlights since I could not
find any documentation on whether the "Ok" diagnostic is implemented for
those. Indeed, I could not find any documentation whatsoever on the
LspDiagnostic* highlights (grepping the Neovim source turned up no
mentions of them either).
  • Loading branch information
MithicSpirit committed May 20, 2024
1 parent d97387a commit 42f1a36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/catppuccin/groups/integrations/native_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function M.get()
local warning = C.yellow
local info = C.sky
local hint = C.teal
local ok = C.green
local darkening_percentage = 0.095

return {
Expand Down Expand Up @@ -40,27 +41,35 @@ function M.get()
fg = hint,
style = virtual_text.hints,
}, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextOk = {
bg = O.transparent_background and C.none or U.darken(hint, darkening_percentage, C.base),
fg = ok,
style = virtual_text.ok,
}, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default

DiagnosticError = { bg = C.none, fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticWarn = { bg = C.none, fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticInfo = { bg = C.none, fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticHint = { bg = C.none, fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticOk = { bg = C.none, fg = ok, style = virtual_text.ok }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default

-- for nvim nightly
DiagnosticUnderlineError = { style = underlines.errors, sp = error }, -- Used to underline "Error" diagnostics
DiagnosticUnderlineWarn = { style = underlines.warnings, sp = warning }, -- Used to underline "Warn" diagnostics
DiagnosticUnderlineInfo = { style = underlines.information, sp = info }, -- Used to underline "Info" diagnostics
DiagnosticUnderlineHint = { style = underlines.hints, sp = hint }, -- Used to underline "Hint" diagnostics
DiagnosticUnderlineOk = { style = underlines.ok, sp = ok }, -- Used to underline "Ok" diagnostics

DiagnosticFloatingError = { fg = error }, -- Used to color "Error" diagnostic messages in diagnostics float
DiagnosticFloatingWarn = { fg = warning }, -- Used to color "Warn" diagnostic messages in diagnostics float
DiagnosticFloatingInfo = { fg = info }, -- Used to color "Info" diagnostic messages in diagnostics float
DiagnosticFloatingHint = { fg = hint }, -- Used to color "Hint" diagnostic messages in diagnostics float
DiagnosticFloatingOk = { fg = ok }, -- Used to color "Ok" diagnostic messages in diagnostics float

DiagnosticSignError = { fg = error }, -- Used for "Error" signs in sign column
DiagnosticSignWarn = { fg = warning }, -- Used for "Warn" signs in sign column
DiagnosticSignInfo = { fg = info }, -- Used for "Info" signs in sign column
DiagnosticSignHint = { fg = hint }, -- Used for "Hint" signs in sign column
DiagnosticSignOk = { fg = ok }, -- Used for "Ok" signs in sign column

LspDiagnosticsDefaultError = { fg = error }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultWarning = { fg = warning }, -- Used as the mantle highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
Expand Down
2 changes: 2 additions & 0 deletions lua/catppuccin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ local M = {
hints = { "italic" },
warnings = { "italic" },
information = { "italic" },
ok = { "italic" },
},
underlines = {
errors = { "underline" },
hints = { "underline" },
warnings = { "underline" },
information = { "underline" },
ok = { "underline" },
},
inlay_hints = {
background = true,
Expand Down

0 comments on commit 42f1a36

Please sign in to comment.