aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
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 /runtime/doc
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 'runtime/doc')
-rw-r--r--runtime/doc/news.txt5
-rw-r--r--runtime/doc/treesitter.txt161
2 files changed, 114 insertions, 52 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 05cfad5af1..29b0ec1ec6 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -112,6 +112,11 @@ The following changes may require adaptations in user config or plugins.
• 'termguicolors' is enabled by default when Nvim is able to determine that
the host terminal emulator supports 24-bit color.
+• Treesitter highlight groups have been renamed to be more in line with
+ upstream tree-sitter and Helix to make it easier to share queries. The full
+ list is documented in |treesitter-highlight-groups|.
+
+
==============================================================================
BREAKING CHANGES IN HEAD *news-breaking-dev*
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 14dedbcbd9..d082aa8cc4 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -400,58 +400,115 @@ instance, to highlight comments differently per language: >vim
hi @comment.lua guifg=DarkBlue
hi link @comment.doc.java String
<
-The following captures are linked by default to standard |group-name|s:
-
-@text.literal Comment
-@text.reference Identifier
-@text.title Title
-@text.uri Underlined
-@text.underline Underlined
-@text.todo Todo
-
-@comment Comment
-@punctuation Delimiter
-
-@constant Constant
-@constant.builtin Special
-@constant.macro Define
-@define Define
-@macro Macro
-@string String
-@string.escape SpecialChar
-@string.special SpecialChar
-@character Character
-@character.special SpecialChar
-@number Number
-@boolean Boolean
-@float Float
-
-@function Function
-@function.builtin Special
-@function.macro Macro
-@parameter Identifier
-@method Function
-@field Identifier
-@property Identifier
-@constructor Special
-
-@conditional Conditional
-@repeat Repeat
-@label Label
-@operator Operator
-@keyword Keyword
-@exception Exception
-
-@variable Identifier
-@type Type
-@type.definition Typedef
-@storageclass StorageClass
-@structure Structure
-@namespace Identifier
-@include Include
-@preproc PreProc
-@debug Debug
-@tag Tag
+The following captures are linked by default to standard |group-name|s (use
+|:Inspect| on a group to see the current link):
+
+@variable various variable names
+@variable.builtin built-in variable names (e.g. `this`)
+@variable.parameter parameters of a function
+@variable.member object and struct fields
+
+@constant constant identifiers
+@constant.builtin built-in constant values
+@constant.macro constants defined by the preprocessor
+
+@module modules or namespaces
+@module.builtin built-in modules or namespaces
+@label GOTO and other labels (e.g. `label:` in C), including heredoc labels
+
+@string string literals
+@string.documentation string documenting code (e.g. Python docstrings)
+@string.regexp regular expressions
+@string.escape escape sequences
+@string.special other special strings (e.g. dates)
+@string.special.symbol symbols or atoms
+@string.special.path filenames
+@string.special.url URIs (e.g. hyperlinks)
+
+@character character literals
+@character.special special characters (e.g. wildcards)
+
+@boolean boolean literals
+@number numeric literals
+@number.float floating-point number literals
+
+@type type or class definitions and annotations
+@type.builtin built-in types
+@type.definition identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
+@type.qualifier type qualifiers (e.g. `const`)
+
+@attribute attribute annotations (e.g. Python decorators)
+@property the key in key/value pairs
+
+@function function definitions
+@function.builtin built-in functions
+@function.call function calls
+@function.macro preprocessor macros
+
+@function.method method definitions
+@function.method.call method calls
+
+@constructor constructor calls and definitions
+@operator symbolic operators (e.g. `+` / `*`)
+
+@keyword keywords not fitting into specific categories
+@keyword.coroutine keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
+@keyword.function keywords that define a function (e.g. `func` in Go, `def` in Python)
+@keyword.operator operators that are English words (e.g. `and` / `or`)
+@keyword.import keywords for including modules (e.g. `import` / `from` in Python)
+@keyword.storage modifiers that affect storage in memory or life-time
+@keyword.repeat keywords related to loops (e.g. `for` / `while`)
+@keyword.return keywords like `return` and `yield`
+@keyword.debug keywords related to debugging
+@keyword.exception keywords related to exceptions (e.g. `throw` / `catch`)
+
+@keyword.conditional keywords related to conditionals (e.g. `if` / `else`)
+@keyword.conditional.ternary ternary operator (e.g. `?` / `:`)
+
+@keyword.directive various preprocessor directives and shebangs
+@keyword.directive.define preprocessor definition directives
+
+@punctuation.delimiter delimiters (e.g. `;` / `.` / `,`)
+@punctuation.bracket brackets (e.g. `()` / `{}` / `[]`)
+@punctuation.special special symbols (e.g. `{}` in string interpolation)
+
+@comment line and block comments
+@comment.documentation comments documenting code
+
+@comment.error error-type comments (e.g. `ERROR`, `FIXME`, `DEPRECATED:`)
+@comment.warning warning-type comments (e.g. `WARNING:`, `FIX:`, `HACK:`)
+@comment.todo todo-type comments (e.g. `TODO:`, `WIP:`, `FIXME:`)
+@comment.note note-type comments (e.g. `NOTE:`, `INFO:`, `XXX`)
+
+@markup.strong bold text
+@markup.italic italic text
+@markup.strikethrough struck-through text
+@markup.underline underlined text (only for literal underline markup!)
+
+@markup.heading headings, titles (including markers)
+
+@markup.quote block quotes
+@markup.math math environments (e.g. `$ ... $` in LaTeX)
+@markup.environment environments (e.g. in LaTeX)
+
+@markup.link text references, footnotes, citations, etc.
+@markup.link.label link, reference descriptions
+@markup.link.url URL-style links
+
+@markup.raw literal or verbatim text (e.g. inline code)
+@markup.raw.block literal or verbatim text as a stand-alone block
+
+@markup.list list markers
+@markup.list.checked checked todo-style list markers
+@markup.list.unchecked unchecked todo-style list markers
+
+@diff.plus added text (for diff files)
+@diff.minus deleted text (for diff files)
+@diff.delta changed text (for diff files)
+
+@tag XML-style tag names (e.g. in XML, HTML, etc.)
+@tag.attribute XML-style tag attributes
+@tag.delimiter XML-style tag delimiters
*treesitter-highlight-spell*
The special `@spell` capture can be used to indicate that a node should be