Debian Codegraph @

runtime/queries/yaml/indents.scm

raw symbols SCIP
1 (block_scalar) @indent @extend
2
3 ; indent sequence items only if they span more than one line, e.g.
4 ;
5 ; - foo:
6 ; bar: baz
7 ; - quux:
8 ; bar: baz
9 ;
10 ; but not
11 ;
12 ; - foo
13 ; - bar
14 ; - baz
15 ((block_sequence_item) @item @indent.always @extend
16 (#not-one-line? @item))
17
18 ; map pair where without a key
19 ;
20 ; foo:
21 ((block_mapping_pair
22 key: (_) @key
23 !value
24 ) @indent.always @extend
25 )
26
27 ; map pair where the key and value are on different lines
28 ;
29 ; foo:
30 ; bar: baz
31 ((block_mapping_pair
32 key: (_) @key
33 value: (_) @val
34 (#not-same-line? @key @val)
35 ) @indent.always @extend
36 )
37
38 ; map pair whose value carries an anchor or tag on the key's line, with the
39 ; mapping/sequence body beneath, e.g.
40 ;
41 ; foo: &anchor
42 ; bar: baz
43 ;
44 ; the value node starts at the anchor/tag on the key's line, so the
45 ; `#not-same-line?` rule above compares against that and never fires; key off the
46 ; body node instead.
47 ((block_mapping_pair
48 key: (_) @key
49 value: (block_node
50 [(anchor) (tag)]
51 [(block_mapping) (block_sequence)] @val)
52 ) @indent.always @extend
53 (#not-same-line? @key @val)
54 )