-
Notifications
You must be signed in to change notification settings - Fork 930
/
Copy pathindents.scm
117 lines (96 loc) · 1.76 KB
/
indents.scm
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
[
(mod_item)
(struct_item)
(enum_item)
(impl_item)
(struct_expression)
(struct_pattern)
(tuple_struct_pattern)
(tuple_expression)
(tuple_type)
(tuple_pattern)
(match_block)
(call_expression)
(assignment_expression)
(arguments)
(block)
(where_clause)
(use_list)
(array_expression)
(ordered_field_declaration_list)
(field_declaration_list)
(enum_variant_list)
(parameters)
(token_tree)
(token_repetition)
(macro_definition)
] @indent.begin
; Typing in "(" inside macro definitions breaks the tree entirely
; Making macro_definition becoming errors
; Offset this by adding back one indent for start of macro rules
(ERROR
.
"macro_rules!"
[
"("
"{"
"["
] @indent.begin
(#set! indent.immediate)
(#set! indent.start_at_same_line))
(macro_definition
[
")"
"}"
"]"
] @indent.end)
(trait_item
body: (_) @indent.begin)
(string_literal
(escape_sequence)) @indent.begin
(block
"}" @indent.end)
(enum_item
body: (enum_variant_list
"}" @indent.end))
(impl_item
body: (declaration_list
"}" @indent.end))
(match_expression
body: (match_block
"}" @indent.end))
(mod_item
body: (declaration_list
"}" @indent.end))
(struct_item
body: (field_declaration_list
"}" @indent.end))
(struct_expression
body: (field_initializer_list
"}" @indent.end))
(struct_pattern
"}" @indent.end)
(tuple_struct_pattern
")" @indent.end)
(tuple_type
")" @indent.end)
(tuple_pattern
")" @indent.end)
(trait_item
body: (declaration_list
"}" @indent.end))
(impl_item
(where_clause) @indent.dedent)
[
"where"
")"
"]"
"}"
] @indent.branch
(impl_item
(declaration_list) @indent.branch)
[
(line_comment)
(string_literal)
] @indent.ignore
(raw_string_literal) @indent.auto