only link LspDiagnostic* for < 0.6

This commit is contained in:
Michael Chris Lopez
2021-10-22 17:32:36 +08:00
parent 78e26354a3
commit 318d9f3a91
3 changed files with 136 additions and 116 deletions

View File

@@ -13,7 +13,7 @@ local function generate(p, opt)
end end
-- stylua: ignore start -- stylua: ignore start
local theme = lush(function() local base = lush(function()
return { return {
-- The following are all the Neovim default highlight groups from the docs -- The following are all the Neovim default highlight groups from the docs
-- as of 0.5.0-nightly-446, to aid your theme creation. Your themes should -- as of 0.5.0-nightly-446, to aid your theme creation. Your themes should
@@ -156,49 +156,23 @@ local function generate(p, opt)
-- use these groups, or use their own. Consult your LSP client's -- use these groups, or use their own. Consult your LSP client's
-- documentation. -- documentation.
LspReferenceText { ColorColumn }, -- used for highlighting "text" references LspReferenceText { ColorColumn }, -- used for highlighting "text" references
LspReferenceRead { ColorColumn }, -- used for highlighting "read" references LspReferenceRead { ColorColumn }, -- used for highlighting "read" references
LspReferenceWrite { ColorColumn }, -- used for highlighting "write" references LspReferenceWrite { ColorColumn }, -- used for highlighting "write" references
LspCodeLens { LineNr },
DiagnosticError { Error }, DiagnosticError { Error },
DiagnosticWarn { WarningMsg }, DiagnosticWarn { WarningMsg },
DiagnosticInfo { fg = p.water }, DiagnosticInfo { fg = p.water },
DiagnosticHint { fg = p.blossom }, DiagnosticHint { fg = p.blossom },
DiagnosticVirtualTextError { DiagnosticError, bg = p.rose.abs_de(48).da(68) }, DiagnosticVirtualTextError { DiagnosticError, bg = p.rose.abs_de(48).da(68) },
DiagnosticVirtualTextWarn { DiagnosticWarn, bg = p.wood.de(58).da(68) }, DiagnosticVirtualTextWarn { DiagnosticWarn, bg = p.wood.de(58).da(68) },
DiagnosticUnderlineError { DiagnosticError, gui = "undercurl" }, DiagnosticUnderlineError { DiagnosticError, gui = "undercurl" },
DiagnosticUnderlineWarn { DiagnosticWarn, gui = "undercurl" }, DiagnosticUnderlineWarn { DiagnosticWarn, gui = "undercurl" },
DiagnosticUnderlineInfo { DiagnosticInfo, gui = "undercurl" }, DiagnosticUnderlineInfo { DiagnosticInfo, gui = "undercurl" },
DiagnosticUnderlineHint { DiagnosticHint, gui = "undercurl" }, DiagnosticUnderlineHint { DiagnosticHint, gui = "undercurl" },
LspDiagnosticsDefaultError { DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultWarning { DiagnosticWarn }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultInformation { DiagnosticInfo }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultHint { DiagnosticHint }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsVirtualTextError { DiagnosticVirtualTextError }, -- Used for "Error" diagnostic virtual text
LspDiagnosticsVirtualTextWarning { DiagnosticVirtualTextWarn }, -- Used for "Warning" diagnostic virtual text
-- LspDiagnosticsVirtualTextInformation { }, -- Used for "Information" diagnostic virtual text
-- LspDiagnosticsVirtualTextHint { }, -- Used for "Hint" diagnostic virtual text
LspDiagnosticsUnderlineError { DiagnosticUnderlineError }, -- Used to underline "Error" diagnostics
LspDiagnosticsUnderlineWarning { DiagnosticUnderlineWarn }, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation { DiagnosticUnderlineInfo }, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint { DiagnosticUnderlineHint }, -- Used to underline "Hint" diagnostics
-- LspDiagnosticsFloatingError { }, -- Used to color "Error" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingWarning { }, -- Used to color "Warning" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingInformation { }, -- Used to color "Information" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingHint { }, -- Used to color "Hint" diagnostic messages in diagnostics float
-- LspDiagnosticsSignError { }, -- Used for "Error" signs in sign column
-- LspDiagnosticsSignWarning { }, -- Used for "Warning" signs in sign column
-- LspDiagnosticsSignInformation { }, -- Used for "Information" signs in sign column
-- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column
LspCodeLens { LineNr },
-- These groups are for the neovim tree-sitter highlights. -- These groups are for the neovim tree-sitter highlights.
-- As of writing, tree-sitter support is a WIP, group names may change. -- As of writing, tree-sitter support is a WIP, group names may change.
@@ -258,7 +232,7 @@ local function generate(p, opt)
-- TSLiteral { }; -- Literal text. -- TSLiteral { }; -- Literal text.
-- TSURI { }; -- Any URI like a link or email. -- TSURI { }; -- Any URI like a link or email.
TSNote { LspDiagnosticsDefaultInformation }, TSNote { DiagnosticInfo },
TSWarning { WarningMsg }, TSWarning { WarningMsg },
TSDanger { Error }, TSDanger { Error },
@@ -330,23 +304,23 @@ local function generate(p, opt)
BufferVisibleSign { fg = StatusLineNC.fg }, BufferVisibleSign { fg = StatusLineNC.fg },
BufferVisibleIndex { fg = StatusLineNC.fg }, BufferVisibleIndex { fg = StatusLineNC.fg },
CocErrorSign { LspDiagnosticsDefaultError }, CocErrorSign { DiagnosticError },
CocWarningSign { LspDiagnosticsDefaultWarning }, CocWarningSign { DiagnosticWarn },
CocInfoSign { LspDiagnosticsDefaultInformation }, CocInfoSign { DiagnosticInfo },
CocHintSign { LspDiagnosticsDefaultHint }, CocHintSign { DiagnosticHint },
CocErrorHighlight { LspDiagnosticsUnderlineError }, CocErrorHighlight { DiagnosticUnderlineError },
CocWarningHighlight { LspDiagnosticsUnderlineWarning }, CocWarningHighlight { DiagnosticUnderlineWarn },
CocInfoHighlight { LspDiagnosticsUnderlineInformation }, CocInfoHighlight { DiagnosticUnderlineInfo },
CocHintHighlight { LspDiagnosticsUnderlineHint }, CocHintHighlight { DiagnosticUnderlineHint },
CocErrorVirtualText { LspDiagnosticsVirtualTextError }, CocErrorVirtualText { DiagnosticVirtualTextError },
CocWarningVitualText { LspDiagnosticsVirtualTextWarning }, CocWarningVitualText { DiagnosticVirtualTextWarn },
CocSelectedText { SpellBad }, CocSelectedText { SpellBad },
CocCodeLens { LineNr }, CocCodeLens { LineNr },
CocMarkdownLink { fg = p.sky, gui = "underline" }, CocMarkdownLink { fg = p.sky, gui = "underline" },
NeogitNotificationError { LspDiagnosticsDefaultError }, NeogitNotificationError { DiagnosticError },
NeogitNotificationWarning { LspDiagnosticsDefaultWarning }, NeogitNotificationWarning { DiagnosticWarn },
NeogitNotificationInfo { LspDiagnosticsDefaultInformation }, NeogitNotificationInfo { DiagnosticInfo },
NeogitDiffContextHighlight { CursorLine }, NeogitDiffContextHighlight { CursorLine },
NeogitDiffDeleteHighlight { DiffDelete }, NeogitDiffDeleteHighlight { DiffDelete },
@@ -378,7 +352,7 @@ local function generate(p, opt)
-- stylua: ignore end -- stylua: ignore end
local specs = { local specs = {
theme, base,
} }
if opt.lighten_noncurrent_window then if opt.lighten_noncurrent_window then
@@ -386,12 +360,48 @@ local function generate(p, opt)
specs, specs,
lush(function() lush(function()
return { return {
NormalNC { theme.Normal, bg = theme.Normal.bg.abs_li(2) }, -- normal text in non-current windows NormalNC { base.Normal, bg = base.Normal.bg.abs_li(2) }, -- normal text in non-current windows
} }
end) end)
) )
end end
-- stylua: ignore start
if not vim.diagnostic then
table.insert(
specs,
lush(function()
return {
LspDiagnosticsDefaultError { base.DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultWarning { base.DiagnosticWarn }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultInformation { base.DiagnosticInfo }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultHint { base.DiagnosticHint }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsVirtualTextError { base.DiagnosticVirtualTextError }, -- Used for "Error" diagnostic virtual text
LspDiagnosticsVirtualTextWarning { base.DiagnosticVirtualTextWarn }, -- Used for "Warning" diagnostic virtual text
-- LspDiagnosticsVirtualTextInformation { }, -- Used for "Information" diagnostic virtual text
-- LspDiagnosticsVirtualTextHint { }, -- Used for "Hint" diagnostic virtual text
LspDiagnosticsUnderlineError { base.DiagnosticUnderlineError }, -- Used to underline "Error" diagnostics
LspDiagnosticsUnderlineWarning { base.DiagnosticUnderlineWarn }, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation { base.DiagnosticUnderlineInfo }, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint { base.DiagnosticUnderlineHint }, -- Used to underline "Hint" diagnostics
-- LspDiagnosticsFloatingError { }, -- Used to color "Error" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingWarning { }, -- Used to color "Warning" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingInformation { }, -- Used to color "Information" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingHint { }, -- Used to color "Hint" diagnostic messages in diagnostics float
-- LspDiagnosticsSignError { }, -- Used for "Error" signs in sign column
-- LspDiagnosticsSignWarning { }, -- Used for "Warning" signs in sign column
-- LspDiagnosticsSignInformation { }, -- Used for "Information" signs in sign column
-- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column
}
end)
)
end
-- stylua: ignore end
return lush.merge(specs) return lush.merge(specs)
end end

View File

@@ -13,7 +13,7 @@ local function generate(p, opt)
end end
-- stylua: ignore start -- stylua: ignore start
local base_specs = lush(function() local base = lush(function()
return { return {
-- The following are all the Neovim default highlight groups from the docs -- The following are all the Neovim default highlight groups from the docs
-- as of 0.5.0-nightly-446, to aid your theme creation. Your themes should -- as of 0.5.0-nightly-446, to aid your theme creation. Your themes should
@@ -156,49 +156,23 @@ local function generate(p, opt)
-- use these groups, or use their own. Consult your LSP client's -- use these groups, or use their own. Consult your LSP client's
-- documentation. -- documentation.
LspReferenceText { ColorColumn }, -- used for highlighting "text" references LspReferenceText { ColorColumn }, -- used for highlighting "text" references
LspReferenceRead { ColorColumn }, -- used for highlighting "read" references LspReferenceRead { ColorColumn }, -- used for highlighting "read" references
LspReferenceWrite { ColorColumn }, -- used for highlighting "write" references LspReferenceWrite { ColorColumn }, -- used for highlighting "write" references
LspCodeLens { LineNr },
DiagnosticError { Error }, DiagnosticError { Error },
DiagnosticWarn { WarningMsg }, DiagnosticWarn { WarningMsg },
DiagnosticInfo { fg = p.water }, DiagnosticInfo { fg = p.water },
DiagnosticHint { fg = p.blossom }, DiagnosticHint { fg = p.blossom },
DiagnosticVirtualTextError { DiagnosticError, bg = p.rose.abs_de(48).li(82) }, DiagnosticVirtualTextError { DiagnosticError, bg = p.rose.abs_de(48).li(82) },
DiagnosticVirtualTextWarn { DiagnosticWarn, bg = p.wood.de(58).li(86) }, DiagnosticVirtualTextWarn { DiagnosticWarn, bg = p.wood.de(58).li(86) },
DiagnosticUnderlineError { DiagnosticError, gui = "undercurl" }, DiagnosticUnderlineError { DiagnosticError, gui = "undercurl" },
DiagnosticUnderlineWarn { DiagnosticWarn, gui = "undercurl" }, DiagnosticUnderlineWarn { DiagnosticWarn, gui = "undercurl" },
DiagnosticUnderlineInfo { DiagnosticInfo, gui = "undercurl" }, DiagnosticUnderlineInfo { DiagnosticInfo, gui = "undercurl" },
DiagnosticUnderlineHint { DiagnosticHint, gui = "undercurl" }, DiagnosticUnderlineHint { DiagnosticHint, gui = "undercurl" },
LspDiagnosticsDefaultError { DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultWarning { DiagnosticWarn }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultInformation { DiagnosticInfo }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultHint { DiagnosticHint }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsVirtualTextError { DiagnosticVirtualTextError }, -- Used for "Error" diagnostic virtual text
LspDiagnosticsVirtualTextWarning { DiagnosticVirtualTextWarn }, -- Used for "Warning" diagnostic virtual text
-- LspDiagnosticsVirtualTextInformation { }, -- Used for "Information" diagnostic virtual text
-- LspDiagnosticsVirtualTextHint { }, -- Used for "Hint" diagnostic virtual text
LspDiagnosticsUnderlineError { DiagnosticUnderlineError }, -- Used to underline "Error" diagnostics
LspDiagnosticsUnderlineWarning { DiagnosticUnderlineWarn }, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation { DiagnosticUnderlineInfo }, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint { DiagnosticUnderlineHint }, -- Used to underline "Hint" diagnostics
-- LspDiagnosticsFloatingError { }, -- Used to color "Error" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingWarning { }, -- Used to color "Warning" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingInformation { }, -- Used to color "Information" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingHint { }, -- Used to color "Hint" diagnostic messages in diagnostics float
-- LspDiagnosticsSignError { }, -- Used for "Error" signs in sign column
-- LspDiagnosticsSignWarning { }, -- Used for "Warning" signs in sign column
-- LspDiagnosticsSignInformation { }, -- Used for "Information" signs in sign column
-- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column
LspCodeLens { LineNr },
-- These groups are for the neovim tree-sitter highlights. -- These groups are for the neovim tree-sitter highlights.
-- As of writing, tree-sitter support is a WIP, group names may change. -- As of writing, tree-sitter support is a WIP, group names may change.
@@ -258,7 +232,7 @@ local function generate(p, opt)
-- TSLiteral { }; -- Literal text. -- TSLiteral { }; -- Literal text.
-- TSURI { }; -- Any URI like a link or email. -- TSURI { }; -- Any URI like a link or email.
TSNote { LspDiagnosticsDefaultInformation }, TSNote { DiagnosticInfo },
TSWarning { WarningMsg }, TSWarning { WarningMsg },
TSDanger { Error }, TSDanger { Error },
@@ -330,23 +304,23 @@ local function generate(p, opt)
BufferVisibleSign { fg = StatusLineNC.fg }, BufferVisibleSign { fg = StatusLineNC.fg },
BufferVisibleIndex { fg = StatusLineNC.fg }, BufferVisibleIndex { fg = StatusLineNC.fg },
CocErrorSign { LspDiagnosticsDefaultError }, CocErrorSign { DiagnosticError },
CocWarningSign { LspDiagnosticsDefaultWarning }, CocWarningSign { DiagnosticWarn },
CocInfoSign { LspDiagnosticsDefaultInformation }, CocInfoSign { DiagnosticInfo },
CocHintSign { LspDiagnosticsDefaultHint }, CocHintSign { DiagnosticHint },
CocErrorHighlight { LspDiagnosticsUnderlineError }, CocErrorHighlight { DiagnosticUnderlineError },
CocWarningHighlight { LspDiagnosticsUnderlineWarning }, CocWarningHighlight { DiagnosticUnderlineWarn },
CocInfoHighlight { LspDiagnosticsUnderlineInformation }, CocInfoHighlight { DiagnosticUnderlineInfo },
CocHintHighlight { LspDiagnosticsUnderlineHint }, CocHintHighlight { DiagnosticUnderlineHint },
CocErrorVirtualText { LspDiagnosticsVirtualTextError }, CocErrorVirtualText { DiagnosticVirtualTextError },
CocWarningVitualText { LspDiagnosticsVirtualTextWarning }, CocWarningVitualText { DiagnosticVirtualTextWarn },
CocSelectedText { SpellBad }, CocSelectedText { SpellBad },
CocCodeLens { LineNr }, CocCodeLens { LineNr },
CocMarkdownLink { fg = p.sky, gui = "underline" }, CocMarkdownLink { fg = p.sky, gui = "underline" },
NeogitNotificationError { LspDiagnosticsDefaultError }, NeogitNotificationError { DiagnosticError },
NeogitNotificationWarning { LspDiagnosticsDefaultWarning }, NeogitNotificationWarning { DiagnosticWarn },
NeogitNotificationInfo { LspDiagnosticsDefaultInformation }, NeogitNotificationInfo { DiagnosticInfo },
NeogitDiffContextHighlight { CursorLine }, NeogitDiffContextHighlight { CursorLine },
NeogitDiffDeleteHighlight { DiffDelete }, NeogitDiffDeleteHighlight { DiffDelete },
@@ -378,7 +352,7 @@ local function generate(p, opt)
-- stylua: ignore end -- stylua: ignore end
local specs = { local specs = {
base_specs, base,
} }
if opt.darken_noncurrent_window then if opt.darken_noncurrent_window then
@@ -386,12 +360,48 @@ local function generate(p, opt)
specs, specs,
lush(function() lush(function()
return { return {
NormalNC { base_specs.Normal, bg = base_specs.Normal.bg.abs_da(2) }, -- normal text in non-current windows NormalNC { base.Normal, bg = base.Normal.bg.abs_da(2) }, -- normal text in non-current windows
} }
end) end)
) )
end end
-- stylua: ignore start
if not vim.diagnostic then
table.insert(
specs,
lush(function()
return {
LspDiagnosticsDefaultError { base.DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultWarning { base.DiagnosticWarn }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultInformation { base.DiagnosticInfo }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsDefaultHint { base.DiagnosticHint }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
LspDiagnosticsVirtualTextError { base.DiagnosticVirtualTextError }, -- Used for "Error" diagnostic virtual text
LspDiagnosticsVirtualTextWarning { base.DiagnosticVirtualTextWarn }, -- Used for "Warning" diagnostic virtual text
-- LspDiagnosticsVirtualTextInformation { }, -- Used for "Information" diagnostic virtual text
-- LspDiagnosticsVirtualTextHint { }, -- Used for "Hint" diagnostic virtual text
LspDiagnosticsUnderlineError { base.DiagnosticUnderlineError }, -- Used to underline "Error" diagnostics
LspDiagnosticsUnderlineWarning { base.DiagnosticUnderlineWarn }, -- Used to underline "Warning" diagnostics
LspDiagnosticsUnderlineInformation { base.DiagnosticUnderlineInfo }, -- Used to underline "Information" diagnostics
LspDiagnosticsUnderlineHint { base.DiagnosticUnderlineHint }, -- Used to underline "Hint" diagnostics
-- LspDiagnosticsFloatingError { }, -- Used to color "Error" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingWarning { }, -- Used to color "Warning" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingInformation { }, -- Used to color "Information" diagnostic messages in diagnostics float
-- LspDiagnosticsFloatingHint { }, -- Used to color "Hint" diagnostic messages in diagnostics float
-- LspDiagnosticsSignError { }, -- Used for "Error" signs in sign column
-- LspDiagnosticsSignWarning { }, -- Used for "Warning" signs in sign column
-- LspDiagnosticsSignInformation { }, -- Used for "Information" signs in sign column
-- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column
}
end)
)
end
-- stylua: ignore end
return lush.merge(specs) return lush.merge(specs)
end end

View File

@@ -46,8 +46,8 @@ return function(name, specs, p)
tabsel_fg = specs.Normal.fg.hex, tabsel_fg = specs.Normal.fg.hex,
warning_bg = specs.DiagnosticVirtualTextWarn.bg.hex, warning_bg = specs.DiagnosticVirtualTextWarn.bg.hex,
warning_fg = specs.DiagnosticVirtualTextWarn.fg.hex, warning_fg = specs.DiagnosticVirtualTextWarn.fg.hex,
error_bg = specs.LspDiagnosticsVirtualTextError.bg.hex, error_bg = specs.DiagnosticVirtualTextError.bg.hex,
error_fg = specs.LspDiagnosticsVirtualTextError.fg.hex, error_fg = specs.DiagnosticVirtualTextError.fg.hex,
}, },
} }
end end