Debian Codegraph @

runtime/queries/go/indents.scm

raw symbols SCIP
1 [
2 (import_declaration)
3 (const_declaration)
4 (type_declaration)
5 (type_spec)
6 (func_literal)
7 (literal_value)
8 (literal_element)
9 (keyed_element)
10 (expression_case)
11 (default_case)
12 (type_case)
13 (communication_case)
14 (argument_list)
15 (parameter_list)
16 (field_declaration_list)
17 (block)
18 (var_declaration)
19 (selector_expression)
20 (binary_expression)
21 ] @indent
22
23 [
24 "]"
25 ")"
26 ] @outdent
27
28 ; Switches and selects aren't indented, only their case bodies are.
29 ; Outdent all closing braces except those closing switches or selects.
30 (
31 (_ "}" @outdent) @outer
32 (#not-kind-eq? @outer "select_statement")
33 (#not-kind-eq? @outer "type_switch_statement")
34 (#not-kind-eq? @outer "expression_switch_statement")
35 )
36
37 ; Handle ERROR nodes for when auto-pairs is disabled.
38 ; Typing an opening delimiter without a closing one produces an ERROR node.
39 (ERROR "{") @indent @extend
40 (ERROR "(") @indent
41 (ERROR "[") @indent
42
43 ; Labels (`Loop:`, `done:`) are de-indented one level by gofmt.
44 ; Capturing the label_name (a child, not an ancestor of the labeled body)
45 ; outdents only the label line.
46 (labeled_statement
47 (label_name) @outdent)
48
49 ; Raw string literals (backticks) span lines and are literal content.
50 (raw_string_literal) @opaque