-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrust.scm
More file actions
28 lines (28 loc) · 1.11 KB
/
Copy pathrust.scm
File metadata and controls
28 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; inherits: builtin:shared/queries/rust.scm
; The scopes whose first and last line stay visible above and below a change
; inside them. A scope is the whole construct, not its body: its first line is
; the line its signature starts on, however many lines that signature runs to,
; and its last is the line that closes it. The body fold the shared query
; gives the construct covers only the body, so it nests inside the scope and
; starts a line later.
((function_item) @fold
(#set! tag "context:scope"))
((impl_item) @fold
(#set! tag "context:scope"))
((mod_item) @fold
(#set! tag "context:scope"))
((struct_item) @fold
(#set! tag "context:scope"))
((for_expression) @fold
(#set! tag "context:scope"))
((loop_expression) @fold
(#set! tag "context:scope"))
((match_expression) @fold
(#set! tag "context:scope"))
((return_expression) @fold
(#set! tag "context:scope"))
; A function's tail expression. Blocks, arrays and strings are left out: the
; shared query folds them with a range of its own.
((function_item body: (block (_expression) @fold .))
(#not-match? @fold "^(\\{|\\[|b?r?#*\")")
(#set! tag "context:scope"))