feat!: nvim-treesitter changes
This commit is contained in:
@@ -23,20 +23,11 @@ local function generate(p, opt)
|
||||
---@diagnostic disable: undefined-global
|
||||
-- selene: allow(undefined_variable)
|
||||
-- stylua: ignore start
|
||||
local base = lush(function()
|
||||
local base = lush(function(injected_functions)
|
||||
-- functions are injected via a table for future expansion
|
||||
-- you probably want to alias it locally
|
||||
local sym = injected_functions.sym
|
||||
return {
|
||||
-- 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
|
||||
-- probably style all of these at a bare minimum.
|
||||
--
|
||||
-- Referenced/linked groups must come before being referenced/lined,
|
||||
-- so the order shown ((mostly) alphabetical) is likely
|
||||
-- not the order you will end up with.
|
||||
--
|
||||
-- You can uncomment these and leave them empty to disable any
|
||||
-- styling for that group (meaning they mostly get styled as Normal)
|
||||
-- or leave them commented to apply vims default colouring or linking.
|
||||
|
||||
Normal { bg = not opt.transparent_background and p1.bg or "NONE", fg = p.fg }, -- normal text
|
||||
|
||||
Underlined { gui = "underline" }, -- (preferred) text that stands out, HTML links
|
||||
@@ -193,77 +184,86 @@ local function generate(p, opt)
|
||||
DiagnosticUnderlineInfo { fg = opt.colorize_diagnostic_underline_text and DiagnosticInfo.fg or "NONE", gui = "undercurl", sp = DiagnosticInfo.fg },
|
||||
DiagnosticUnderlineHint { fg = opt.colorize_diagnostic_underline_text and DiagnosticHint.fg or "NONE", gui = "undercurl", sp = DiagnosticHint.fg },
|
||||
|
||||
-- These groups are for the neovim tree-sitter highlights.
|
||||
-- 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.
|
||||
-- Tree-sitter
|
||||
sym "@annotation" { PreProc },
|
||||
sym "@attribute" { PreProc },
|
||||
sym "@boolean" { Number },
|
||||
sym "@character" { Constant },
|
||||
sym "@character.special" { Special },
|
||||
sym "@comment" { Comment },
|
||||
sym "@conditional" { Statement },
|
||||
sym "@constant" { Identifier, gui = "bold" },
|
||||
sym "@constant.builtin" { Number },
|
||||
sym "@constant.macro" { Number },
|
||||
sym "@constructor" { Special },
|
||||
sym "@debug" { Special },
|
||||
sym "@define" { PreProc },
|
||||
sym "@exception" { Statement },
|
||||
sym "@field" { Identifier },
|
||||
sym "@float" { Number },
|
||||
sym "@function" { Function },
|
||||
sym "@function.builtin" { Special },
|
||||
sym "@function.call" { Function },
|
||||
sym "@function.macro" { PreProc },
|
||||
sym "@include" { PreProc },
|
||||
sym "@keyword" { Statement },
|
||||
sym "@keyword.function" { Statement },
|
||||
sym "@keyword.operator" { Statement },
|
||||
sym "@keyword.return" { Statement },
|
||||
sym "@label" { Statement },
|
||||
sym "@method" { Function },
|
||||
sym "@method.call" { Function },
|
||||
sym "@namespace" { Special },
|
||||
sym "@none" { },
|
||||
sym "@number" { Number },
|
||||
sym "@operator" { Statement },
|
||||
sym "@parameter" { Identifier },
|
||||
sym "@parameter.reference" { sym "@parameter" },
|
||||
sym "@preproc" { PreProc },
|
||||
sym "@property" { Identifier },
|
||||
sym "@punctuation.bracket" { Delimiter },
|
||||
sym "@punctuation.delimiter" { Delimiter },
|
||||
sym "@punctuation.special" { Delimiter },
|
||||
sym "@repeat" { Statement },
|
||||
sym "@storageclass" { Type },
|
||||
sym "@string" { Constant },
|
||||
sym "@string.escape" { Special },
|
||||
sym "@string.regex" { Constant },
|
||||
sym "@string.special" { Special },
|
||||
sym "@symbol" { Identifier },
|
||||
sym "@tag" { Special },
|
||||
sym "@tag.attribute" { sym "@property" },
|
||||
sym "@tag.delimiter" { Delimiter },
|
||||
sym "@text" { sym "@none" },
|
||||
sym "@text.danger" { Error },
|
||||
sym "@text.emphasis" { Italic },
|
||||
sym "@text.environment" { PreProc },
|
||||
sym "@text.environment.name" { Type },
|
||||
sym "@text.literal" { Constant },
|
||||
sym "@text.math" { Special },
|
||||
sym "@text.note" { DiagnosticInfo },
|
||||
sym "@text.reference" { Constant },
|
||||
sym "@text.strike" { gui = "strikethrough" },
|
||||
sym "@text.strong" { Bold },
|
||||
sym "@text.title" { Title },
|
||||
sym "@text.underline" { Underlined },
|
||||
sym "@text.uri" { Underlined },
|
||||
sym "@text.warning" { WarningMsg },
|
||||
sym "@todo" { Todo },
|
||||
sym "@type" { Type },
|
||||
sym "@type.builtin" { Type },
|
||||
sym "@type.definition" { Type },
|
||||
sym "@type.qualifier" { Type },
|
||||
sym "@variable" { Identifier },
|
||||
sym "@variable.builtin" { Number },
|
||||
|
||||
-- TSAnnotation { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
|
||||
-- TSAttribute { }; -- (unstable) TODO: docs
|
||||
-- TSBoolean { }; -- For booleans.
|
||||
-- TSCharacter { }; -- For characters.
|
||||
-- TSComment { }; -- For comment blocks.
|
||||
-- TSConstructor { }; -- For constructor calls and definitions: ` { }` in Lua, and Java constructors.
|
||||
-- TSConditional { }; -- For keywords related to conditionnals.
|
||||
TSConstant { Identifier, gui = "bold" }; -- For constants
|
||||
TSConstBuiltin { Number }; -- For constant that are built in the language: `nil` in Lua.
|
||||
TSConstMacro { Number }; -- For constants that are defined by macros: `NULL` in C.
|
||||
-- TSError { }; -- For syntax/parser errors.
|
||||
-- TSException { }; -- For exception related keywords.
|
||||
-- TSField { }; -- For fields.
|
||||
-- TSFloat { }; -- For floats.
|
||||
-- TSFunction { }; -- For function (calls and definitions).
|
||||
-- TSFuncBuiltin { }; -- For builtin functions: `print` 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.
|
||||
-- TSKeyword { }; -- For keywords that don't fall in previous categories.
|
||||
-- TSKeywordFunction { }; -- For keywords used to define a fuction.
|
||||
-- TSLabel { }; -- For labels: `label:` in C and `:label:` in Lua.
|
||||
-- TSMethod { }; -- For method calls and definitions.
|
||||
TSNamespace { Special }; -- For identifiers referring to modules and namespaces.
|
||||
-- TSNone { }; -- TODO: docs
|
||||
-- TSNumber { }; -- For all numbers
|
||||
-- TSOperator { }; -- For any operator: `+`, but also `->` and `*` in C.
|
||||
-- TSParameter { }; -- For parameters of a function.
|
||||
-- TSParameterReference { }; -- For references to parameters of a function.
|
||||
-- TSProperty { }; -- Same as `TSField`.
|
||||
-- TSPunctDelimiter { }; -- For delimiters ie: `.`
|
||||
-- TSPunctBracket { }; -- For brackets and parens.
|
||||
-- TSPunctSpecial { }; -- For special punctutation that does not fall in the catagories before.
|
||||
-- TSRepeat { }; -- For keywords related to loops.
|
||||
-- TSString { }; -- For strings.
|
||||
-- TSStringRegex { }; -- For regexes.
|
||||
-- TSStringEscape { }; -- For escape characters within a string.
|
||||
-- TSSymbol { }; -- For identifiers referring to symbols or atoms.
|
||||
-- TSType { }; -- For types.
|
||||
-- TSTypeBuiltin { }; -- For builtin types.
|
||||
TSVariable { Identifier }, -- Any variable name that does not have another highlight.
|
||||
TSVariableBuiltin { Number }; -- Variable names that are defined by the languages, like `this` or `self`.
|
||||
|
||||
TSTag { Special }, -- Tags like html tag names.
|
||||
-- TSTagDelimiter { }; -- Tag delimiter like `<` `>` `/`
|
||||
-- TSText { }; -- For strings considered text in a markup language.
|
||||
TSEmphasis { Italic }, -- For text to be represented with emphasis.
|
||||
TSUnderline { Underlined }, -- For text to be represented with an underline.
|
||||
TSStrong { Bold }, -- Text to be represented in bold.
|
||||
-- TSStrike { }; -- For strikethrough text.
|
||||
-- TSTitle { }; -- Text that is part of a title.
|
||||
-- TSLiteral { }; -- Literal text.
|
||||
-- TSURI { }; -- Any URI like a link or email.
|
||||
|
||||
TSNote { DiagnosticInfo },
|
||||
TSWarning { WarningMsg },
|
||||
TSDanger { Error },
|
||||
|
||||
-- TS: Markdown
|
||||
markdownTSPunctSpecial { Special },
|
||||
markdownTSStringEscape { SpecialKey },
|
||||
markdownTSTextReference { Identifier, gui = "underline" },
|
||||
markdownTSEmphasis { Italic },
|
||||
markdownTSTitle { Statement },
|
||||
markdownTSLiteral { Type },
|
||||
markdownTSURI { SpecialComment },
|
||||
sym "@punctuation.special.markdown" { Special },
|
||||
sym "@string.escape.markdown" { SpecialKey },
|
||||
sym "@text.reference.markdown" { Identifier, gui = "underline" },
|
||||
sym "@text.emphasis.markdown" { Italic },
|
||||
sym "@text.title.markdown" { Statement },
|
||||
sym "@text.literal.markdown" { Type },
|
||||
sym "@text.uri.markdown" { SpecialComment },
|
||||
|
||||
-- Syntax
|
||||
diffAdded { fg = p.leaf },
|
||||
@@ -277,9 +277,9 @@ local function generate(p, opt)
|
||||
|
||||
gitcommitOverflow { WarningMsg },
|
||||
|
||||
markdownUrl { markdownTSURI },
|
||||
markdownCode { markdownTSLiteral },
|
||||
markdownLinkText { markdownTSTextReference },
|
||||
markdownUrl { SpecialComment },
|
||||
markdownCode { Type },
|
||||
markdownLinkText { Identifier, gui = "underline" },
|
||||
markdownLinkTextDelimiter { Delimiter },
|
||||
|
||||
helpHyperTextEntry { Special },
|
||||
|
||||
Reference in New Issue
Block a user