Unnamed repository; edit this file 'description' to name the repository.
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
[
  (import_declaration)
  (const_declaration)
  (type_declaration)
  (type_spec)
  (func_literal)
  (literal_value)
  (literal_element)
  (keyed_element)
  (expression_case)
  (default_case)
  (type_case)
  (communication_case)
  (argument_list)
  (parameter_list)
  (field_declaration_list)
  (block)
  (var_declaration)
  (selector_expression)
  (binary_expression)
] @indent

[
  "]"
  ")"
] @outdent

; Switches and selects aren't indented, only their case bodies are.
; Outdent all closing braces except those closing switches or selects.
(
    (_ "}" @outdent) @outer
    (#not-kind-eq? @outer "select_statement")
    (#not-kind-eq? @outer "type_switch_statement")
    (#not-kind-eq? @outer "expression_switch_statement")
)

; Handle ERROR nodes for when auto-pairs is disabled.
; Typing an opening delimiter without a closing one produces an ERROR node.
(ERROR "{") @indent @extend
(ERROR "(") @indent
(ERROR "[") @indent

; Labels (`Loop:`, `done:`) are de-indented one level by gofmt.
; Capturing the label_name (a child, not an ancestor of the labeled body)
; outdents only the label line.
(labeled_statement
  (label_name) @outdent)

; Raw string literals (backticks) span lines and are literal content.
(raw_string_literal) @opaque