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
51
52
53
54
(block_scalar) @indent @extend

; indent sequence items only if they span more than one line, e.g.
;
; - foo:
;     bar: baz
; - quux:
;     bar: baz
;
; but not
;
; - foo
; - bar
; - baz
((block_sequence_item) @item @indent.always @extend
  (#not-one-line? @item))

; map pair where without a key
;
; foo:
((block_mapping_pair
    key: (_) @key
    !value
  ) @indent.always @extend
)

; map pair where the key and value are on different lines
;
; foo:
;   bar: baz
((block_mapping_pair
    key: (_) @key
    value: (_) @val
    (#not-same-line? @key @val)
  ) @indent.always @extend
)

; map pair whose value carries an anchor or tag on the key's line, with the
; mapping/sequence body beneath, e.g.
;
; foo: &anchor
;   bar: baz
;
; the value node starts at the anchor/tag on the key's line, so the
; `#not-same-line?` rule above compares against that and never fires; key off the
; body node instead.
((block_mapping_pair
    key: (_) @key
    value: (block_node
             [(anchor) (tag)]
             [(block_mapping) (block_sequence)] @val)
  ) @indent.always @extend
  (#not-same-line? @key @val)
)