feat: add lsp hl groups from upstream, tidy up tree-sitter hls (#330)
* chore: remove commented deprecated groups
* feat: add rule-based sem token highlighting (tracking 1cc23e1109)
* feat: add ts-rainbow2 highlights
* feat: add special string documentation highlight, remove unused group, and reorganize hl groups based on nvim-treesitter
* fix: linked to treesitter groups and added some additional missing hl groups
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
@@ -162,11 +162,6 @@ function M.setup()
|
|||||||
markdownH2 = { fg = c.blue, bold = true },
|
markdownH2 = { fg = c.blue, bold = true },
|
||||||
markdownLinkText = { fg = c.blue, underline = true },
|
markdownLinkText = { fg = c.blue, underline = true },
|
||||||
|
|
||||||
["@punctuation.special.markdown"] = { fg = c.orange, bold = true },
|
|
||||||
["@text.todo.unchecked"] = { fg = c.blue }, -- For brackets and parens.
|
|
||||||
["@text.todo.checked"] = { fg = c.green1 }, -- For brackets and parens.
|
|
||||||
["@text.literal.markdown_inline"] = { bg = c.terminal_black, fg = c.blue },
|
|
||||||
["@text.literal.markdown"] = { link = "Normal" },
|
|
||||||
["helpCommand"] = { bg = c.terminal_black, fg = c.blue },
|
["helpCommand"] = { bg = c.terminal_black, fg = c.blue },
|
||||||
|
|
||||||
debugPC = { bg = c.bg_sidebar }, -- used for highlighting the current line in terminal-debug
|
debugPC = { bg = c.bg_sidebar }, -- used for highlighting the current line in terminal-debug
|
||||||
@@ -202,72 +197,72 @@ function M.setup()
|
|||||||
ALEErrorSign = { fg = c.error },
|
ALEErrorSign = { fg = c.error },
|
||||||
ALEWarningSign = { fg = c.warning },
|
ALEWarningSign = { fg = c.warning },
|
||||||
|
|
||||||
-- 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.
|
||||||
-- By default, most of these groups link to an appropriate Vim group,
|
|
||||||
-- TSError -> Error for example, so you do not have to define these unless
|
|
||||||
-- you explicitly want to support Treesitter's improved syntax awareness.
|
|
||||||
|
|
||||||
-- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
|
--- Misc
|
||||||
-- TSAttribute = { }; -- (unstable) TODO: docs
|
-- TODO:
|
||||||
-- TSBoolean = { }; -- For booleans.
|
-- ["@comment.documentation"] = { },
|
||||||
-- TSCharacter = { }; -- For characters.
|
|
||||||
-- TSComment = { }; -- For comment blocks.
|
|
||||||
TSNote = { fg = c.bg, bg = c.info },
|
|
||||||
["@text.warning"] = { fg = c.bg, bg = c.warning },
|
|
||||||
["@text.danger"] = { fg = c.bg, bg = c.error },
|
|
||||||
["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
|
|
||||||
-- TSConditional = { }; -- For keywords related to conditionnals.
|
|
||||||
-- TSConstant = { }; -- For constants
|
|
||||||
-- TSConstBuiltin = { }; -- For constant that are built in the language: `nil` in Lua.
|
|
||||||
-- TSConstMacro = { }; -- For constants that are defined by macros: `NULL` in C.
|
|
||||||
-- TSError = { }; -- For syntax/parser errors.
|
|
||||||
-- TSException = { }; -- For exception related keywords.
|
|
||||||
["@field"] = { fg = c.green1 }, -- For fields.
|
|
||||||
-- TSFloat = { }; -- For floats.
|
|
||||||
-- TSFunction = { }; -- For function (calls and definitions).
|
|
||||||
-- TSFuncBuiltin = { }; -- For builtin functions: `table.insert` in Lua.
|
|
||||||
-- TSFuncMacro = { }; -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
|
|
||||||
-- TSInclude = { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
|
|
||||||
["@keyword"] = { fg = c.purple, style = options.styles.keywords }, -- For keywords that don't fall in previous categories.
|
|
||||||
["@keyword.function"] = { fg = c.magenta, style = options.styles.functions }, -- For keywords used to define a fuction.
|
|
||||||
["@label"] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua.
|
|
||||||
-- TSMethod = { }; -- For method calls and definitions.
|
|
||||||
-- TSNamespace = { }; -- For identifiers referring to modules and namespaces.
|
|
||||||
-- TSNone = { }; -- TODO: docs
|
|
||||||
-- TSNumber = { }; -- For all numbers
|
|
||||||
["@operator"] = { fg = c.blue5 }, -- For any operator: `+`, but also `->` and `*` in C.
|
["@operator"] = { fg = c.blue5 }, -- For any operator: `+`, but also `->` and `*` in C.
|
||||||
["@parameter"] = { fg = c.yellow }, -- For parameters of a function.
|
|
||||||
-- TSParameterReference= { }; -- For references to parameters of a function.
|
--- Punctuation
|
||||||
["@property"] = { fg = c.green1 }, -- Same as `TSField`.
|
|
||||||
["@punctuation.delimiter"] = { fg = c.blue5 }, -- For delimiters ie: `.`
|
["@punctuation.delimiter"] = { fg = c.blue5 }, -- For delimiters ie: `.`
|
||||||
["@punctuation.bracket"] = { fg = c.fg_dark }, -- For brackets and parens.
|
["@punctuation.bracket"] = { fg = c.fg_dark }, -- For brackets and parens.
|
||||||
["@punctuation.special"] = { fg = c.blue5 }, -- For special punctutation that does not fall in the catagories before.
|
["@punctuation.special"] = { fg = c.blue5 }, -- For special punctutation that does not fall in the catagories before.
|
||||||
-- TSRepeat = { }; -- For keywords related to loops.
|
["@punctuation.special.markdown"] = { fg = c.orange, bold = true },
|
||||||
-- TSString = { }; -- For strings.
|
|
||||||
|
--- Literals
|
||||||
|
["@string.documentation"] = { fg = c.yellow },
|
||||||
["@string.regex"] = { fg = c.blue6 }, -- For regexes.
|
["@string.regex"] = { fg = c.blue6 }, -- For regexes.
|
||||||
["@string.escape"] = { fg = c.magenta }, -- For escape characters within a string.
|
["@string.escape"] = { fg = c.magenta }, -- For escape characters within a string.
|
||||||
-- TSSymbol = { }; -- For identifiers referring to symbols or atoms.
|
|
||||||
-- TSType = { }; -- For types.
|
--- Functions
|
||||||
-- TSTypeBuiltin = { }; -- For builtin types.
|
["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
|
||||||
|
["@parameter"] = { fg = c.yellow }, -- For parameters of a function.
|
||||||
|
-- TODO:
|
||||||
|
-- ["@parameter.builtin"] = {}, -- For builtin parameters of a function, e.g. "..." or Smali's p[1-99]
|
||||||
|
|
||||||
|
--- Keywords
|
||||||
|
["@keyword"] = { fg = c.purple, style = options.styles.keywords }, -- For keywords that don't fall in previous categories.
|
||||||
|
-- TODO:
|
||||||
|
-- ["@keyword.coroutine"] = { }, -- For keywords related to coroutines.
|
||||||
|
["@keyword.function"] = { fg = c.magenta, style = options.styles.functions }, -- For keywords used to define a fuction.
|
||||||
|
|
||||||
|
["@label"] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua.
|
||||||
|
|
||||||
|
--- Types
|
||||||
|
["@field"] = { fg = c.green1 }, -- For fields.
|
||||||
|
["@property"] = { fg = c.green1 },
|
||||||
|
|
||||||
|
--- Identifiers
|
||||||
["@variable"] = { style = options.styles.variables }, -- Any variable name that does not have another highlight.
|
["@variable"] = { style = options.styles.variables }, -- Any variable name that does not have another highlight.
|
||||||
["@variable.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`.
|
["@variable.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`.
|
||||||
|
|
||||||
-- TSTag = { }; -- Tags like html tag names.
|
--- Text
|
||||||
-- TSTagDelimiter = { }; -- Tag delimiter like `<` `>` `/`
|
["@text.literal.markdown"] = { link = "Normal" },
|
||||||
-- TSText = { }; -- For strings considered text in a markup language.
|
["@text.literal.markdown_inline"] = { bg = c.terminal_black, fg = c.blue },
|
||||||
["@text.reference"] = { fg = c.teal },
|
["@text.reference"] = { fg = c.teal },
|
||||||
-- TSEmphasis = { }; -- For text to be represented with emphasis.
|
|
||||||
-- TSUnderline = { }; -- For text to be represented with an underline.
|
["@text.todo.unchecked"] = { fg = c.blue }, -- For brackets and parens.
|
||||||
-- TSStrike = { }; -- For strikethrough text.
|
["@text.todo.checked"] = { fg = c.green1 }, -- For brackets and parens.
|
||||||
-- TSTitle = { }; -- Text that is part of a title.
|
["@text.warning"] = { fg = c.bg, bg = c.warning },
|
||||||
-- TSLiteral = { }; -- Literal text.
|
["@text.danger"] = { fg = c.bg, bg = c.error },
|
||||||
-- TSURI = { }; -- Any URI like a link or email.
|
|
||||||
["@text.diff.add"] = { link = "DiffAdd" },
|
["@text.diff.add"] = { link = "DiffAdd" },
|
||||||
["@text.diff.delete"] = { link = "DiffDelete" },
|
["@text.diff.delete"] = { link = "DiffDelete" },
|
||||||
|
|
||||||
-- Lua
|
["@namespace"] = { link = "Include" },
|
||||||
-- luaTSProperty = { fg = c.red }, -- Same as `TSField`.
|
|
||||||
|
-- LSP Semantic Token Groups
|
||||||
|
["@lsp.type.enum"] = { link = "@type" },
|
||||||
|
["@lsp.type.keyword"] = { link = "@keyword" },
|
||||||
|
["@lsp.type.interface"] = { link = "Identifier" },
|
||||||
|
["@lsp.type.namespace"] = { link = "@namespace" },
|
||||||
|
["@lsp.type.parameter"] = { link = "@parameter" },
|
||||||
|
["@lsp.type.property"] = { link = "@property" },
|
||||||
|
["@lsp.type.variable"] = { link = "@variable" },
|
||||||
|
-- NOTE: maybe add these with distinct highlights?
|
||||||
|
-- ["@lsp.typemod.variable.globalScope"] (global variables)
|
||||||
|
|
||||||
-- ts-rainbow
|
-- ts-rainbow
|
||||||
rainbowcol1 = { fg = c.red },
|
rainbowcol1 = { fg = c.red },
|
||||||
@@ -278,6 +273,15 @@ function M.setup()
|
|||||||
rainbowcol6 = { fg = c.magenta },
|
rainbowcol6 = { fg = c.magenta },
|
||||||
rainbowcol7 = { fg = c.purple },
|
rainbowcol7 = { fg = c.purple },
|
||||||
|
|
||||||
|
-- ts-rainbow2 (maintained fork)
|
||||||
|
TSRainbowRed = { fg = c.red },
|
||||||
|
TSRainbowOrange = { fg = c.orange },
|
||||||
|
TSRainbowYellow = { fg = c.yellow },
|
||||||
|
TSRainbowGreen = { fg = c.green },
|
||||||
|
TSRainbowBlue = { fg = c.blue },
|
||||||
|
TSRainbowViolet = { fg = c.purple },
|
||||||
|
TSRainbowCyan = { fg = c.cyan },
|
||||||
|
|
||||||
-- LspTrouble
|
-- LspTrouble
|
||||||
TroubleText = { fg = c.fg_dark },
|
TroubleText = { fg = c.fg_dark },
|
||||||
TroubleCount = { fg = c.magenta, bg = c.fg_gutter },
|
TroubleCount = { fg = c.magenta, bg = c.fg_gutter },
|
||||||
@@ -739,6 +743,7 @@ function M.setup()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@type table<string, table>
|
||||||
theme.defer = {}
|
theme.defer = {}
|
||||||
|
|
||||||
if options.hide_inactive_statusline then
|
if options.hide_inactive_statusline then
|
||||||
|
|||||||
@@ -186,6 +186,10 @@ M.defaults = {
|
|||||||
default = true,
|
default = true,
|
||||||
link = "Keyword",
|
link = "Keyword",
|
||||||
},
|
},
|
||||||
|
["@keyword.coroutine"] = {
|
||||||
|
default = true,
|
||||||
|
link = "@keyword",
|
||||||
|
},
|
||||||
["@keyword.function"] = {
|
["@keyword.function"] = {
|
||||||
default = true,
|
default = true,
|
||||||
link = "Keyword",
|
link = "Keyword",
|
||||||
@@ -229,10 +233,6 @@ M.defaults = {
|
|||||||
default = true,
|
default = true,
|
||||||
link = "Identifier",
|
link = "Identifier",
|
||||||
},
|
},
|
||||||
["@parameter.reference"] = {
|
|
||||||
default = true,
|
|
||||||
link = "@parameter",
|
|
||||||
},
|
|
||||||
["@preproc"] = {
|
["@preproc"] = {
|
||||||
default = true,
|
default = true,
|
||||||
link = "PreProc",
|
link = "PreProc",
|
||||||
@@ -369,7 +369,7 @@ M.defaults = {
|
|||||||
},
|
},
|
||||||
["@type.qualifier"] = {
|
["@type.qualifier"] = {
|
||||||
default = true,
|
default = true,
|
||||||
link = "Type",
|
link = "@keyword",
|
||||||
},
|
},
|
||||||
["@variable.builtin"] = {
|
["@variable.builtin"] = {
|
||||||
default = true,
|
default = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user