From e8a60040a9c32297398c556521a1829947adc3ef Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Sat, 4 Sep 2021 16:00:43 -0500 Subject: [PATCH] feat #29: style for native lsp underlines and virtual text --- lua/catppuccino/config.lua | 8 +++++++- .../core/integrations/native_lsp.lua | 20 +++++++++++-------- lua/catppuccino/core/mapper.lua | 3 +++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lua/catppuccino/config.lua b/lua/catppuccino/config.lua index 3a80811..3282adc 100644 --- a/lua/catppuccino/config.lua +++ b/lua/catppuccino/config.lua @@ -16,12 +16,18 @@ config.options = { treesitter = true, native_lsp = { enabled = true, - styles = { + virtual_text = { errors = "italic", hints = "italic", warnings = "italic", information = "italic", }, + underlines = { + errors = "underline", + hints = "underline", + warnings = "underline", + information = "underline", + } }, lsp_trouble = false, lsp_saga = false, diff --git a/lua/catppuccino/core/integrations/native_lsp.lua b/lua/catppuccino/core/integrations/native_lsp.lua index a042fd0..7ad0808 100644 --- a/lua/catppuccino/core/integrations/native_lsp.lua +++ b/lua/catppuccino/core/integrations/native_lsp.lua @@ -1,6 +1,10 @@ local M = {} function M.get(cpt) + + local virtual_text = cpc.integrations.native_lsp.virtual_text + local underlines = cpc.integrations.native_lsp.underlines + return { -- 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 @@ -23,14 +27,14 @@ function M.get(cpt) LspDiagnosticsWarning = { fg = cpt.warning }, LspDiagnosticsInformation = { fg = cpt.info }, LspDiagnosticsHint = { fg = cpt.hint }, - LspDiagnosticsVirtualTextError = { fg = cpt.error, style = cpc.integrations.native_lsp.styles.errors }, -- Used for "Error" diagnostic virtual text - LspDiagnosticsVirtualTextWarning = { fg = cpt.warning, style = cpc.integrations.native_lsp.styles.warnings }, -- Used for "Warning" diagnostic virtual text - LspDiagnosticsVirtualTextInformation = { fg = cpt.info, style = cpc.integrations.native_lsp.styles.information }, -- Used for "Information" diagnostic virtual text - LspDiagnosticsVirtualTextHint = { fg = cpt.hint, style = cpc.integrations.native_lsp.styles.hints }, -- Used for "Hint" diagnostic virtual text - LspDiagnosticsUnderlineError = { style = "underline", sp = cpt.error }, -- Used to underline "Error" diagnostics - LspDiagnosticsUnderlineWarning = { style = "underline", sp = cpt.warning }, -- Used to underline "Warning" diagnostics - LspDiagnosticsUnderlineInformation = { style = "underline", sp = cpt.info }, -- Used to underline "Information" diagnostics - LspDiagnosticsUnderlineHint = { style = "underline", sp = cpt.hint }, -- Used to underline "Hint" diagnostics + LspDiagnosticsVirtualTextError = { fg = cpt.error, style = virtual_text.errors }, -- Used for "Error" diagnostic virtual text + LspDiagnosticsVirtualTextWarning = { fg = cpt.warning, style = virtual_text.warnings }, -- Used for "Warning" diagnostic virtual text + LspDiagnosticsVirtualTextInformation = { fg = cpt.info, style = virtual_text.warnings }, -- Used for "Information" diagnostic virtual text + LspDiagnosticsVirtualTextHint = { fg = cpt.hint, style = virtual_text.hints }, -- Used for "Hint" diagnostic virtual text + LspDiagnosticsUnderlineError = { style = underlines.errors, sp = cpt.error }, -- Used to underline "Error" diagnostics + LspDiagnosticsUnderlineWarning = { style = underlines.warnings, sp = cpt.warning }, -- Used to underline "Warning" diagnostics + LspDiagnosticsUnderlineInformation = { style = underlines.information, sp = cpt.info }, -- Used to underline "Information" diagnostics + LspDiagnosticsUnderlineHint = { style = underlines.hints, sp = cpt.hint }, -- Used to underline "Hint" diagnostics LspCodeLens = { fg = cpt.comment }, -- virtual text of the codelens } end diff --git a/lua/catppuccino/core/mapper.lua b/lua/catppuccino/core/mapper.lua index e5c7fe7..6df783e 100644 --- a/lua/catppuccino/core/mapper.lua +++ b/lua/catppuccino/core/mapper.lua @@ -212,6 +212,9 @@ function M.apply(cs) cs = cs or cpc.colorscheme 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 vim.api.nvim_err_writeln(err.msg) end