mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-24 10:26:18 +04:00
7078e84007
YAML indents queries are tweaked to fix auto indent behavior. A new capture type `indent.always` is introduced to address use cases where combining indent captures on a single line is desired. Fixes #6661
36 lines
586 B
Scheme
36 lines
586 B
Scheme
(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
|
|
) |