Unnamed repository; edit this file 'description' to name the repository.
add more list of maps to tests
Skyler Hawthorne 2023-04-18
parent ff3b452 · commit 15714ac
-rw-r--r--helix-term/tests/test/languages/yaml.rs64
-rw-r--r--runtime/queries/yaml/indents.scm9
2 files changed, 67 insertions, 6 deletions
diff --git a/helix-term/tests/test/languages/yaml.rs b/helix-term/tests/test/languages/yaml.rs
index 02e3a0ea..19e88f58 100644
--- a/helix-term/tests/test/languages/yaml.rs
+++ b/helix-term/tests/test/languages/yaml.rs
@@ -295,6 +295,38 @@ async fn auto_indent() -> anyhow::Result<()> {
),
(
helpers::platform_line(indoc! {"\
+ - top:#[\n|]#
+ baz: foo
+ bax: foox
+ fook:
+ "}),
+ "o",
+ helpers::platform_line(indoc! {"\
+ - top:
+ #[\n|]#
+ baz: foo
+ bax: foox
+ fook:
+ "}),
+ ),
+ (
+ helpers::platform_line(indoc! {"\
+ - top:
+ baz: foo#[\n|]#
+ bax: foox
+ fook:
+ "}),
+ "o",
+ helpers::platform_line(indoc! {"\
+ - top:
+ baz: foo
+ #[\n|]#
+ bax: foox
+ fook:
+ "}),
+ ),
+ (
+ helpers::platform_line(indoc! {"\
- top:
baz: foo
bax: foox#[\n|]#
@@ -604,6 +636,38 @@ async fn auto_indent() -> anyhow::Result<()> {
fook:
"}),
),
+ (
+ helpers::platform_line(indoc! {"\
+ - top:
+ baz: foo#[\n|]#
+ bax: foox
+ fook:
+ "}),
+ "O",
+ helpers::platform_line(indoc! {"\
+ - top:
+ #[\n|]#
+ baz: foo
+ bax: foox
+ fook:
+ "}),
+ ),
+ (
+ helpers::platform_line(indoc! {"\
+ - top:
+ baz: foo
+ bax: foox
+ fook:#[\n|]#
+ "}),
+ "O",
+ helpers::platform_line(indoc! {"\
+ - top:
+ baz: foo
+ bax: foox
+ #[\n|]#
+ fook:
+ "}),
+ ),
];
for test in above_tests {
diff --git a/runtime/queries/yaml/indents.scm b/runtime/queries/yaml/indents.scm
index 1ca487bf..a318edd7 100644
--- a/runtime/queries/yaml/indents.scm
+++ b/runtime/queries/yaml/indents.scm
@@ -1,8 +1,5 @@
(block_scalar) @indent @extend
-((block_mapping_pair
- key: (_) @key
- value: (_)? @val
- (#not-same-line? @key @val)
- ) @indent @extend
-)
+(block_mapping_pair) @indent
+
+(block_sequence_item) @indent