Unnecessary restriction
SnakeYAML 1.23.
When using DumperOptions IndicatorIndent and Indent and setting both values to the same one, a YAMLException (Indicator indent must be smaller then indent) is thrown. There is no reason for such a restriction. Please, remove it.
Comments (8)
-
-
- changed status to invalid
We cannot fix it if you do not want to help.
-
@Andrey Somov I’ve my IntelliJ IDEA configured like this:
- indent = 2
- indent sequence value = true
Here’s the screenshot:
How can I configure snakeyaml not to reformat my yml files?
I tried to configure
indent=2
andindicatorIndent=2
, but the validation fails with messageIndicator indent must be smaller then indent.
If I configure
indent=6
andindicatorIndent=4
like it’s in https://bitbucket.org/asomov/snakeyaml/src/f437efd6719eaa93d616c7aca164a3d2d07f0031/src/test/java/org/yaml/snakeyaml/issues/issue358/UnexpectedIndentTest.java?at=default&fileviewer=file-view-default that will reformat simple maps
type: Example config components: - name: First component description: Some short description of the first component - name: Second component description: Some short description of the second component simpleMap: key1: value1 key2: value2
-
Your picture above is identical to the file below. What is the problem ?
-
Thanks for the quick reply.
The problem is I can’t make
snakeyaml
keep the IntelliJ IDEA format that is in screenshot (or code block, its' the same)If I configure
indent=4
andindicatorIndent=2
then the result look this waytype: Example config components: - name: First component description: Some short description of the first component - name: Second component description: Some short description of the second component simpleMap: key1: value1 key2: value2
But I want to have indent=2 for simpleMap
But I can’t have
indicatorIndent
greater or equal toindent
-
Since indicator is before the key, the
indicatorIndent
is always smaller than indent.Unfortunately, it is very difficult to design the API in such a way that it fits all the use cases. The current settings do not allow it.
Feel free to make a proposal to improve the code !
-
Ok, so could you please reopen this issue so that I can try to make a PR?
-
This issue is dead. Create another one with a proposal when you have it.
Or you can try to implement it in SnakeYAML Engine which is even better. You do not have backwards-compatibility problem.
- Log in to comment
this is implemented to fix
#358