aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2024-03-16 14:39:24 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-03-16 20:51:16 +0800
commit8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13 (patch)
tree2b0888456bd2649ae51531b5d6ccccc42b309111
parentfeat(highlights)!: remove non-keyword `@type.qualifier` (diff)
downloadnvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.tar
nvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.tar.gz
nvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.tar.bz2
nvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.tar.lz
nvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.tar.xz
nvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.tar.zst
nvim-treesitter-8f5513a1f2ec6ee5b378c2e32e53fc3c2a8f1e13.zip
feat(rust,lalrpop): `@attribute` for lifetimes
`@keyword` is only for language-defined keywords.
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--queries/lalrpop/highlights.scm9
-rw-r--r--queries/rust/highlights.scm12
3 files changed, 17 insertions, 6 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b024961a9..8e3081e82 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -140,7 +140,7 @@ As languages differ quite a lot, here is a set of captures available to you when
@type.builtin ; built-in types
@type.definition ; identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
-@attribute ; attribute annotations (e.g. Python decorators)
+@attribute ; attribute annotations (e.g. Python decorators, Rust lifetimes)
@attribute.builtin ; builtin annotations (e.g. `@property` in Python)
@property ; the key in key/value pairs
```
diff --git a/queries/lalrpop/highlights.scm b/queries/lalrpop/highlights.scm
index a3cf8d897..951192ea8 100644
--- a/queries/lalrpop/highlights.scm
+++ b/queries/lalrpop/highlights.scm
@@ -72,7 +72,14 @@
] @punctuation.delimiter
(lifetime
- (identifier) @keyword.modifier)
+ "'" @keyword.modifier)
+
+(lifetime
+ (identifier) @attribute)
+
+(lifetime
+ (identifier) @attribute.builtin
+ (#any-of? @attribute.builtin "static" "_"))
(string_literal) @string
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm
index 7b229984f..64976b663 100644
--- a/queries/rust/highlights.scm
+++ b/queries/rust/highlights.scm
@@ -285,10 +285,14 @@
] @keyword.modifier
(lifetime
- [
- "'"
- (identifier)
- ] @keyword.modifier)
+ "'" @keyword.modifier)
+
+(lifetime
+ (identifier) @attribute)
+
+(lifetime
+ (identifier) @attribute.builtin
+ (#any-of? @attribute.builtin "static" "_"))
"fn" @keyword.function