Debian Codegraph @

runtime/queries/swift/indents.scm

raw symbols SCIP
1 [
2 (protocol_body)
3 (class_body)
4 (enum_class_body)
5 (function_declaration)
6 (init_declaration)
7 (deinit_declaration)
8 (computed_property)
9 (subscript_declaration)
10 (computed_getter)
11 (computed_setter)
12 (for_statement)
13 (while_statement)
14 (repeat_while_statement)
15 (do_statement)
16 (if_statement)
17 (switch_statement)
18 (guard_statement)
19 (type_parameters)
20 (tuple_type)
21 (array_type)
22 (dictionary_type)
23 (call_expression)
24 (tuple_expression)
25 (array_literal)
26 (dictionary_literal)
27 (lambda_literal)
28 (willset_didset_block)
29 (willset_clause)
30 (didset_clause)
31 (value_arguments)
32 ] @indent
33
34 [
35 "}"
36 "]"
37 ")"
38 ">"
39 ] @outdent
40
41 (assignment
42 .
43 (_) @expr-start
44 (_) @indent
45 (#not-same-line? @indent @expr-start)
46
47 )
48
49 (control_transfer_statement
50 .
51 (_) @expr-start
52 (_) @indent
53 (#not-same-line? @indent @expr-start)
54
55 )
56
57 (if_statement
58 (if_statement) @outdent
59 )
60
61 ; switch_entry wraps both the case/default label and the body statements. The
62 ; default tail scope indents the lines after the label (the body) without
63 ; indenting the label itself, and because switch_entry is an ancestor of the
64 ; cursor whether reindenting a body line or typing a newline after the label,
65 ; it resolves correctly in both indent directions (capturing the inner
66 ; (statements) node only works when reindenting; capturing the label only works
67 ; when typing — the wrapper handles both).
68 (switch_entry) @indent
69
70 (init_declaration
71 (parameter) @indent
72 )
73
74 (modifiers
75 (attribute) @indent
76 )
77
78 (type_parameters
79 ">" @outdent
80 )
81
82 (tuple_expression
83 ")" @outdent
84 )
85
86 (tuple_type
87 ")" @outdent
88 )
89
90 (modifiers
91 (attribute
92 ")" @outdent
93 )
94 )
95
96 (ERROR
97 [
98 "<"
99 "{"
100 "("
101 "["
102 ]
103 ) @indent
104
105 [
106 (multi_line_string_literal)
107 (raw_string_literal)
108 ] @opaque