rewrite
rewrite copied to clipboard
fix: `MergeYaml` block indentation not as expected
I think I have identified a bug in the yaml parser + writer. when we parse the following yaml:
some:
object:
script: |
#!/bin/bash
echo "hello
the value of the script mapping is:
#!/bin/bash
echo "hello
when writing this yaml it correctly writes back as the original because of this. However, when we want to insert this yaml somewhere into another document the prefix is not taken into account. So if I were to insert
script: |
#!/bin/bash
echo "hello
into the same spot I end up with:
some:
object:
script: |
#!/bin/bash
echo "hello
I think we should remove the whitespace from the block values and use the prefix of the parent (in case of a LITERAL or FOLDER style scalar) to indent when printing
It might be better to add the current indentation to the printer context.