aboutsummaryrefslogtreecommitdiffstats
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-07-22 15:29:32 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5 (patch)
tree2b2856c96ba738d90229a3d6eae44a7f66d7e5e2 /CONTRIBUTING.md
parentrevert "fix(config)!: always install parsers bundled with nvim" (diff)
downloadnvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.tar
nvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.tar.gz
nvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.tar.bz2
nvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.tar.lz
nvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.tar.xz
nvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.tar.zst
nvim-treesitter-5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5.zip
feat(locals)!: switch to upstream captures
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md44
1 files changed, 22 insertions, 22 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 43beeb04e..209886d54 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -253,29 +253,29 @@ highlighting (such as diagnostics or LSP semantic tokens).
### Locals
-Note: pay specific attention to the captures here as they are a bit different to
-those listed in the upstream [Local Variables
-docs](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
-Some of these docs didn't exist when `nvim-treesitter` was created and the
-upstream captures are more limiting than what we have here.
+Locals are used to keep track of definitions and references in local or global
+scopes, see [upstream
+documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
+Note that nvim-treesitter uses more specific subcaptures for definitions and
+**does not use locals for highlighting**.
```scheme
-@definition ; various definitions
-@definition.constant ; constants
-@definition.function ; functions
-@definition.method ; methods
-@definition.var ; variables
-@definition.parameter ; parameters
-@definition.macro ; preprocessor macros
-@definition.type ; types or classes
-@definition.field ; fields or properties
-@definition.enum ; enumerations
-@definition.namespace ; modules or namespaces
-@definition.import ; imported names
-@definition.associated ; the associated type of a variable
+@local.definition ; various definitions
+@local.definition.constant ; constants
+@local.definition.function ; functions
+@local.definition.method ; methods
+@local.definition.var ; variables
+@local.definition.parameter ; parameters
+@local.definition.macro ; preprocessor macros
+@local.definition.type ; types or classes
+@local.definition.field ; fields or properties
+@local.definition.enum ; enumerations
+@local.definition.namespace ; modules or namespaces
+@local.definition.import ; imported names
+@local.definition.associated ; the associated type of a variable
-@scope ; scope block
-@reference ; identifier reference
+@local.scope ; scope block
+@local.reference ; identifier reference
```
#### Definition Scope
@@ -294,7 +294,7 @@ doSomething(); // Should point to the declaration as the definition
```query
(function_declaration
- ((identifier) @definition.var)
+ ((identifier) @local.definition.var)
(#set! "definition.var.scope" "parent"))
```
@@ -312,7 +312,7 @@ You can define folds for a given language by adding a `folds.scm` query :
@fold ; fold this node
```
-If the `folds.scm` query is not present, this will fall back to the `@scope` captures in the `locals`
+If the `folds.scm` query is not present, this will fall back to the `@local.scope` captures in the `locals`
query.
### Injections