Skip to content

Commit ee4052d

Browse files
author
fidgetingbits
committed
Make foo@{a,b} a single arg, and other tests for statements
1 parent 0cdc812 commit ee4052d

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

queries/nix.scm

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
(source_code) @comment.iteration
1111

1212
;; Any foo = <expression> anywhere is a statement
13-
(binding) @statement
13+
[
14+
(inherit)
15+
(binding)
16+
] @statement
1417
(binding_set) @map.iteration @list.iteration @ifStatement.iteration
1518

1619
;; This matches assert statements as stand-alone statements. This
@@ -27,6 +30,11 @@
2730
(#not-parent-type? @_.domain binding)
2831
)
2932

33+
(
34+
(with_expression) @statement
35+
(#not-parent-type? @statement binding)
36+
)
37+
3038
;;!! let
3139
;;!! a = 1;
3240
;;! <******
@@ -110,11 +118,19 @@
110118
;;! ^^^^^^^^^^^ Func2 due to currying
111119
(function_expression
112120
[
121+
(
122+
;; Match foo@{ a, b }: style
123+
(identifier) @argumentOrParameter.start
124+
"@"
125+
(formals) @argumentOrParameter.end
126+
)
113127
;; Match a: style arg
114-
(identifier)
128+
(identifier) @argumentOrParameter
129+
115130
;; Match { a, b }: style
116-
(formals)
117-
] @argumentOrParameter
131+
(formals) @argumentOrParameter
132+
]
133+
.
118134
body: (_) @anonymousFunction.interior
119135
) @_.domain @anonymousFunction @argumentOrParameter.iteration
120136

0 commit comments

Comments
 (0)