vim-i18n icon indicating copy to clipboard operation
vim-i18n copied to clipboard

YAML file gets completely re-ordered and re-written

Open joallard opened this issue 9 years ago • 3 comments

I was just navigating with { } when I saw the empty lines were all gone. Not good.

joallard avatar Jan 07 '16 23:01 joallard

Holy shit no it actually raw re-orders and re-writes the whole damn file!

joallard avatar Jan 07 '16 23:01 joallard

It also nixes any aliases one could have in there.

As for the solution, just took a dive in Psych, it's not pretty. Realistically the thing we could do is parse the YAML, figure out a place to put the new key, open up the Psych AST, insert the key, wrap it up, dump YAML. With the possible option of putting a new line for every mapping that has more than 10 keys.

joallard avatar Jan 08 '16 00:01 joallard

If you do this, would be nice to have it as a separate gem, as it's a frequently requested feature in i18n-tasks.

glebm avatar Mar 05 '16 19:03 glebm