aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-01-17 16:55:52 +0100
committerChristian Clason <c.clason@uni-graz.at>2024-01-21 10:41:18 +0100
commitf5dc45310941dff6efc02d955fc0c110190e9b85 (patch)
treeee4f96087a641dbd0df21cc9db46061c5864dae2 /src
parentfa9a85ae468b9df30ae9e5c05a08c0f124e267df (diff)
downloadrneovim-f5dc45310941dff6efc02d955fc0c110190e9b85.tar.gz
rneovim-f5dc45310941dff6efc02d955fc0c110190e9b85.tar.bz2
rneovim-f5dc45310941dff6efc02d955fc0c110190e9b85.zip
feat(treesitter)!: new standard capture names
Problem: Sharing queries with upstream and Helix is difficult due to different capture names. Solution: Define and document a new set of standard captures that matches tree-sitter "standard captures" (where defined) and is closer to Helix' Atom-style nested groups. This is a breaking change for colorschemes that defined highlights based on the old captures. On the other hand, the default colorscheme now defines links for all standard captures (not just those used in bundled queries), improving the out-of-the-box experience.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/highlight_group.c140
1 files changed, 89 insertions, 51 deletions
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index 9c12a5bda1..e9fd1c3f44 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -230,60 +230,98 @@ static const char *highlight_init_both[] = {
"default link DiagnosticSignOk DiagnosticOk",
"default link DiagnosticUnnecessary Comment",
- // Text
- "default link @text.literal Comment",
- "default link @text.reference Identifier",
- "default link @text.title Title",
- "default link @text.uri Underlined",
- "default link @text.underline Underlined",
- "default link @text.todo Todo",
-
- // Miscs
- "default link @comment Comment",
- "default link @punctuation Delimiter",
-
- // Constants
+ // Treesitter standard groups
+ "default link @variable NONE", // don't highlight to reduce visual overload
+ "default link @variable.builtin Special",
+ "default link @variable.parameter Identifier",
+ "default link @variable.member Identifier",
+
"default link @constant Constant",
"default link @constant.builtin Special",
"default link @constant.macro Define",
- "default link @define Define",
- "default link @macro Macro",
- "default link @string String",
- "default link @string.escape SpecialChar",
- "default link @string.special SpecialChar",
- "default link @character Character",
- "default link @character.special SpecialChar",
- "default link @number Number",
- "default link @boolean Boolean",
- "default link @float Float",
-
- // Functions
- "default link @function Function",
- "default link @function.builtin Special",
- "default link @function.macro Macro",
- "default link @parameter Identifier",
- "default link @method Function",
- "default link @field Identifier",
- "default link @property Identifier",
- "default link @constructor Special",
-
- // Keywords
- "default link @conditional Conditional",
- "default link @repeat Repeat",
- "default link @label Label",
- "default link @operator Operator",
- "default link @keyword Keyword",
- "default link @exception Exception",
-
- "default link @variable NONE", // don't highlight to reduce visual overload
- "default link @type Type",
- "default link @type.definition Typedef",
- "default link @storageclass StorageClass",
- "default link @namespace Identifier",
- "default link @include Include",
- "default link @preproc PreProc",
- "default link @debug Debug",
- "default link @tag Tag",
+
+ "default link @module Structure",
+ "default link @label Label",
+
+ "default link @string String",
+ "default link @string.regexp SpecialChar",
+ "default link @string.escape SpecialChar",
+ "default link @string.special SpecialChar",
+ "default link @string.special.symbol Constant",
+ "default link @string.special.url Underlined",
+
+ "default link @character Character",
+ "default link @character.special SpecialChar",
+
+ "default link @boolean Boolean",
+ "default link @number Number",
+ "default link @number.float Float",
+
+ "default link @type Type",
+ "default link @type.builtin Special",
+ "default link @type.definition Typedef",
+ "default link @type.qualifier StorageClass",
+
+ "default link @attribute Macro",
+ "default link @property Identifier",
+
+ "default link @function Function",
+ "default link @function.builtin Special",
+ "default link @function.macro Macro",
+
+ "default link @constructor Special",
+ "default link @operator Operator",
+
+ "default link @keyword Keyword",
+ "default link @keyword.function Statement",
+ "default link @keyword.operator Operator",
+ "default link @keyword.import Include",
+ "default link @keyword.storage StorageClass",
+ "default link @keyword.repeat Repeat",
+ "default link @keyword.debug Debug",
+ "default link @keyword.exception Exception",
+
+ "default link @keyword.conditional Conditional",
+
+ "default link @keyword.directive Preproc",
+ "default link @keyword.directive.define Define",
+
+ "default link @punctuation.delimiter Delimiter",
+ "default link @punctuation.bracket Delimiter",
+ "default link @punctuation.special Special",
+
+ "default link @comment Comment",
+
+ "default link @comment.error DiagnosticError",
+ "default link @comment.warning DiagnosticWarn",
+ "default link @comment.note DiagnosticInfo",
+ "default link @comment.todo Todo",
+
+ "@markup.strong gui=bold cterm=bold",
+ "@markup.italic gui=italic cterm=italic",
+ "@markup.strikethrough gui=strikethrough, cterm=strikethrough",
+ "@markup.underline gui=underline, cterm=underline",
+
+ "default link @markup.heading Title",
+
+ "default link @markup.raw Comment",
+ "default link @markup.quote Comment",
+ "default link @markup.math Comment",
+ "default link @markup.environment Comment",
+
+ "default link @markup.link Underlined",
+ "default link @markup.link.label Identifier",
+
+ "default link @markup.list Special",
+ "default link @markup.list.checked DiagnosticOk",
+ "default link @markup.list.unchecked DiagnosticWarn",
+
+ "default link @diff.plus Added",
+ "default link @diff.minus Removed",
+ "default link @diff.delta Changed",
+
+ "default link @tag Tag",
+ "default link @tag.delimiter Delimiter",
// LSP semantic tokens
"default link @lsp.type.class Structure",