feat #29: style for native lsp underlines and virtual text

dev-doc
Pocco81 3 years ago
parent aa71e420ea
commit c0540a013b

@ -16,12 +16,18 @@ config.options = {
treesitter = true, treesitter = true,
native_lsp = { native_lsp = {
enabled = true, enabled = true,
styles = { virtual_text = {
errors = "italic", errors = "italic",
hints = "italic", hints = "italic",
warnings = "italic", warnings = "italic",
information = "italic", information = "italic",
}, },
underlines = {
errors = "underline",
hints = "underline",
warnings = "underline",
information = "underline",
}
}, },
lsp_trouble = false, lsp_trouble = false,
lsp_saga = false, lsp_saga = false,

@ -1,6 +1,10 @@
local M = {} local M = {}
function M.get(cpt) function M.get(cpt)
local virtual_text = cpc.integrations.native_lsp.virtual_text
local underlines = cpc.integrations.native_lsp.underlines
return { return {
-- These groups are for the native LSP cliencpt. Some other LSP clients may -- These groups are for the native LSP cliencpt. Some other LSP clients may
-- use these groups, or use their own. Consult your LSP client's -- use these groups, or use their own. Consult your LSP client's
@ -23,14 +27,14 @@ function M.get(cpt)
LspDiagnosticsWarning = { fg = cpt.warning }, LspDiagnosticsWarning = { fg = cpt.warning },
LspDiagnosticsInformation = { fg = cpt.info }, LspDiagnosticsInformation = { fg = cpt.info },
LspDiagnosticsHint = { fg = cpt.hint }, LspDiagnosticsHint = { fg = cpt.hint },
LspDiagnosticsVirtualTextError = { fg = cpt.error, style = cpc.integrations.native_lsp.styles.errors }, -- Used for "Error" diagnostic virtual text LspDiagnosticsVirtualTextError = { fg = cpt.error, style = virtual_text.errors }, -- Used for "Error" diagnostic virtual text
LspDiagnosticsVirtualTextWarning = { fg = cpt.warning, style = cpc.integrations.native_lsp.styles.warnings }, -- Used for "Warning" diagnostic virtual text LspDiagnosticsVirtualTextWarning = { fg = cpt.warning, style = virtual_text.warnings }, -- Used for "Warning" diagnostic virtual text
LspDiagnosticsVirtualTextInformation = { fg = cpt.info, style = cpc.integrations.native_lsp.styles.information }, -- Used for "Information" diagnostic virtual text LspDiagnosticsVirtualTextInformation = { fg = cpt.info, style = virtual_text.warnings }, -- Used for "Information" diagnostic virtual text
LspDiagnosticsVirtualTextHint = { fg = cpt.hint, style = cpc.integrations.native_lsp.styles.hints }, -- Used for "Hint" diagnostic virtual text LspDiagnosticsVirtualTextHint = { fg = cpt.hint, style = virtual_text.hints }, -- Used for "Hint" diagnostic virtual text
LspDiagnosticsUnderlineError = { style = "underline", sp = cpt.error }, -- Used to underline "Error" diagnostics LspDiagnosticsUnderlineError = { style = underlines.errors, sp = cpt.error }, -- Used to underline "Error" diagnostics
LspDiagnosticsUnderlineWarning = { style = "underline", sp = cpt.warning }, -- Used to underline "Warning" diagnostics LspDiagnosticsUnderlineWarning = { style = underlines.warnings, sp = cpt.warning }, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation = { style = "underline", sp = cpt.info }, -- Used to underline "Information" diagnostics LspDiagnosticsUnderlineInformation = { style = underlines.information, sp = cpt.info }, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint = { style = "underline", sp = cpt.hint }, -- Used to underline "Hint" diagnostics LspDiagnosticsUnderlineHint = { style = underlines.hints, sp = cpt.hint }, -- Used to underline "Hint" diagnostics
LspCodeLens = { fg = cpt.comment }, -- virtual text of the codelens LspCodeLens = { fg = cpt.comment }, -- virtual text of the codelens
} }
end end

@ -212,6 +212,9 @@ function M.apply(cs)
cs = cs or cpc.colorscheme cs = cs or cpc.colorscheme
local err, color_scheme = require("catppuccino.core.cs").get_color_scheme(cs) local err, color_scheme = require("catppuccino.core.cs").get_color_scheme(cs)
-- cpc (global): config; exists while settings are applied
-- cs (local): colorscheme; usually passed to integrations
if not err.status then if not err.status then
vim.api.nvim_err_writeln(err.msg) vim.api.nvim_err_writeln(err.msg)
end end

Loading…
Cancel
Save