Skip to content

Commit 14a35ee

Browse files
authored
Update tree-sitter queries to latest
1 parent b4ef204 commit 14a35ee

File tree

10 files changed

+232
-170
lines changed

10 files changed

+232
-170
lines changed

queries/apex/textobjects.scm

+9-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@
9999
] @comment.outer
100100

101101
; assignment
102-
(variable_declarator
103-
name: (identifier) @assignment.lhs
104-
value: (_) @assignment.rhs) @assignment.inner @assignment.outer
102+
(field_declaration
103+
(variable_declarator
104+
name: (identifier) @assignment.lhs
105+
value: (_) @assignment.rhs) @assignment.inner) @assignment.outer
106+
107+
(local_variable_declaration
108+
(variable_declarator
109+
name: (identifier) @assignment.lhs
110+
value: (_) @assignment.rhs) @assignment.inner) @assignment.outer
105111

queries/c/textobjects.scm

+12
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@
5252

5353
(if_statement) @conditional.outer
5454

55+
(if_statement
56+
condition: (_) @conditional.inner
57+
(#offset! @conditional.inner 0 1 0 -1))
58+
59+
(while_statement
60+
condition: (_) @conditional.inner
61+
(#offset! @conditional.inner 0 1 0 -1))
62+
63+
(do_statement
64+
condition: (_) @conditional.inner
65+
(#offset! @conditional.inner 0 1 0 -1))
66+
5567
(for_statement
5668
condition: (_) @conditional.inner)
5769

queries/ecma/textobjects.scm

+4-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@
239239
; number
240240
(number) @number.inner
241241

242-
(variable_declarator
243-
name: (_) @assignment.lhs
244-
value: (_) @assignment.inner @assignment.rhs) @assignment.outer
242+
(lexical_declaration
243+
(variable_declarator
244+
name: (_) @assignment.lhs
245+
value: (_) @assignment.inner @assignment.rhs)) @assignment.outer
245246

246247
(variable_declarator
247248
name: (_) @assignment.inner)

queries/fish/textobjects.scm

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
(function_definition) @function.outer
1+
; assignment
2+
(command
3+
name: (word) @_command
4+
argument: (word) @_varname @assignment.lhs @assignment.inner
5+
argument: (_)* @assignment.rhs
6+
(#not-lua-match? @_varname "[-].*")
7+
(#eq? @_command "set")) @assignment.outer
28

39
(command
410
name: (word) @_name

queries/go/textobjects.scm

+19-15
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,23 @@
157157
left: (_) @assignment.lhs
158158
right: (_) @assignment.rhs @assignment.inner) @assignment.outer
159159

160-
(var_spec
161-
name: (_) @assignment.lhs
162-
value: (_) @assignment.rhs @assignment.inner) @assignment.outer
163-
164-
(var_spec
165-
name: (_) @assignment.inner
166-
type: (_)) @assignment.outer
167-
168-
(const_spec
169-
name: (_) @assignment.lhs
170-
value: (_) @assignment.rhs @assignment.inner) @assignment.outer
171-
172-
(const_spec
173-
name: (_) @assignment.inner
174-
type: (_)) @assignment.outer
160+
(var_declaration
161+
(var_spec
162+
name: (_) @assignment.lhs
163+
value: (_) @assignment.rhs @assignment.inner)) @assignment.outer
164+
165+
(var_declaration
166+
(var_spec
167+
name: (_) @assignment.inner
168+
type: (_))) @assignment.outer
169+
170+
(const_declaration
171+
(const_spec
172+
name: (_) @assignment.lhs
173+
value: (_) @assignment.rhs @assignment.inner)) @assignment.outer
174+
175+
(const_declaration
176+
(const_spec
177+
name: (_) @assignment.inner
178+
type: (_))) @assignment.outer
175179

queries/haskell/textobjects.scm

+53-31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
((exp_apply
1+
((apply
22
.
3-
(exp_name)
3+
function: (_)
44
.
55
(_) @call.inner._start
66
.
@@ -9,50 +9,71 @@
99
(_)? @call.inner._end .)
1010
) @call.outer
1111

12-
(exp_infix
12+
(infix
1313
(_)
14-
(variable)
14+
[
15+
(infix_id
16+
(variable)) ; x `plus` y
17+
(operator) ; x + y
18+
]
1519
(_)) @call.outer
1620

17-
(function
18-
rhs: (_) @function.inner) @function.outer
21+
(decl/function) @function.outer
22+
23+
(decl/function
24+
patterns: (_)
25+
.
26+
match: (_) @function.inner._start
27+
match: (_)? @function.inner._end
28+
.
29+
)
1930

2031
; also treat function signature as @function.outer
2132
(signature) @function.outer
2233

34+
; treat signature with function as @function.outer
35+
(((decl/signature
36+
name: (_) @_sig_name) @function.outer._start
37+
.
38+
(decl/function
39+
name: (_) @_func_name) @function.outer._end)
40+
(#eq? @_sig_name @_func_name)
41+
)
42+
2343
(class) @class.outer
2444

2545
(class
26-
(class_body
27-
(where)
28-
_ @class.inner))
46+
"where"
47+
_ @class.inner)
2948

3049
(instance
31-
(where)?
50+
"where"?
3251
.
3352
_ @class.inner) @class.outer
3453

3554
(comment) @comment.outer
3655

37-
(exp_cond) @conditional.outer
56+
(haddock) @comment.outer
3857

39-
(exp_cond
58+
(expression/conditional) @conditional.outer
59+
60+
(expression/conditional
4061
(_) @conditional.inner)
4162

4263
; e.g. forM [1..10] $ \i -> do...
43-
(exp_infix
44-
(exp_apply
45-
(exp_name) @_name
64+
(infix
65+
(apply
66+
(name) @_name
4667
(#any-of? @_name "for" "for_" "forM" "forM_"))
4768
(operator) @_op
4869
(#eq? @_op "$")
49-
(exp_lambda
70+
(lambda
5071
(_)
5172
(_) @loop.inner)) @loop.outer
5273

5374
; e.g. forM [1..10] print
54-
(exp_apply
55-
(exp_name) @_name
75+
(apply
76+
(name) @_name
5677
(#any-of? @_name "for" "for_" "forM" "forM_")
5778
(_)
5879
(_) @loop.inner) @loop.outer
@@ -65,35 +86,36 @@
6586
; e.g. func mb@(Just x)
6687
(function
6788
(patterns
68-
(pat_parens
89+
(parens
6990
(_) @parameter.inner)))
7091

7192
(function
7293
(patterns
73-
(pat_as
74-
(pat_parens
94+
(as
95+
(parens
7596
(_) @parameter.inner))))
7697

7798
(signature
7899
(context
79-
(fun
80-
(type_apply) @parameter.inner)))
100+
(function
101+
(type/apply) @parameter.inner)))
81102

82103
(signature
83104
(context
84-
(fun
85-
(type_name) @parameter.inner)))
105+
(function
106+
(type/name) @parameter.inner)))
86107

87108
(signature
88-
(fun
89-
(type_apply) @parameter.inner))
109+
(function
110+
(type/apply) @parameter.inner))
90111

91112
(signature
92-
(fun
93-
(type_name) @parameter.inner))
113+
(function
114+
(type/name) @parameter.inner))
94115

95116
(signature
96-
(type_apply) @parameter.inner)
117+
(type/apply) @parameter.inner)
97118

98119
(signature
99-
(type_name) @parameter.inner)
120+
(type/name) @parameter.inner)
121+

queries/julia/textobjects.scm

+17-4
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,23 @@
217217
)
218218

219219
; Assignment
220-
(assignment
221-
.
222-
(_) @assignment.lhs
223-
(_) @assignment.inner @assignment.rhs .) @assignment.outer
220+
(local_statement
221+
(assignment
222+
.
223+
(_) @assignment.lhs
224+
(_) @assignment.inner @assignment.rhs .)) @assignment.outer
225+
226+
(const_statement
227+
(assignment
228+
.
229+
(_) @assignment.lhs
230+
(_) @assignment.inner @assignment.rhs .)) @assignment.outer
231+
232+
(global_statement
233+
(assignment
234+
.
235+
(_) @assignment.lhs
236+
(_) @assignment.inner @assignment.rhs .)) @assignment.outer
224237

225238
(assignment
226239
.

queries/php/textobjects.scm

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
(function_definition) @function.outer
1414

15-
(anonymous_function_creation_expression
15+
(anonymous_function
1616
body: (compound_statement
1717
.
1818
"{"
@@ -23,7 +23,7 @@
2323
"}"
2424
))
2525

26-
(anonymous_function_creation_expression) @function.outer
26+
(anonymous_function) @function.outer
2727

2828
; methods
2929
(method_declaration
@@ -313,3 +313,4 @@
313313
(global_declaration)
314314
(function_static_declaration)
315315
] @statement.outer
316+

0 commit comments

Comments
 (0)