aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRobert Muir <rmuir@apache.org>2025-07-17 22:12:23 -0400
committerChristian Clason <ch.clason+github@icloud.com>2025-07-19 18:25:47 +0200
commit20d77c2e5ba71315dee7dcf47456557413b1481e (patch)
tree55ff0ac403ae62fae13f0d28471727974ca9fa47 /runtime
parentfeat(wit)!: update parser and queries (diff)
downloadnvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.tar
nvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.tar.gz
nvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.tar.bz2
nvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.tar.lz
nvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.tar.xz
nvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.tar.zst
nvim-treesitter-20d77c2e5ba71315dee7dcf47456557413b1481e.zip
fix(jinja): assign highlights to all variables and functions
The majority of jinja variables aren't assigned any highlights at all. Assign @variable to all identifiers. Jinja filters without parameters are not highlighted as functions: add a query for these. Refine the existing @variable.member to only capture identifiers instead of broader nodes.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/jinja_inline/highlights.scm30
1 files changed, 24 insertions, 6 deletions
diff --git a/runtime/queries/jinja_inline/highlights.scm b/runtime/queries/jinja_inline/highlights.scm
index 69dba77b3..3a9660471 100644
--- a/runtime/queries/jinja_inline/highlights.scm
+++ b/runtime/queries/jinja_inline/highlights.scm
@@ -71,11 +71,7 @@
"as"
] @keyword.import
-(import_statement
- (identifier) @variable)
-
-(import_as
- (identifier) @variable)
+(identifier) @variable
[
"if"
@@ -109,12 +105,34 @@
(expression
"."
- (expression)+ @variable.member)
+ (expression
+ (binary_expression
+ .
+ (unary_expression
+ (primary_expression
+ (identifier) @variable.member)))))
+
+(expression
+ "."
+ (expression
+ (binary_expression
+ (binary_expression
+ (unary_expression
+ (primary_expression
+ (identifier) @variable.member))))))
(assignment_expression
"."
(identifier)+ @variable.member)
+; jinja filters
+(binary_expression
+ (binary_operator
+ "|")
+ (unary_expression
+ (primary_expression
+ (identifier) @function.call)))
+
(inline_trans
"_" @function.builtin)