stkb / Rewrap

Rewrap extension for VSCode and Visual Studio
https://marketplace.visualstudio.com/items/stkb.rewrap
Other
499 stars 58 forks source link

Hyphen- and indentation-aware wrapping in YAML #368

Open rben01 opened 1 year ago

rben01 commented 1 year ago

In YAML, indentation is critical. When wrapping a long line that occurs after a hyphen, e.g.,:

- my very very very very very very very very very very very very very very very very very very very very very long item

The output is

- my very very very very very very very very very very very very very very very very
very very very very very long item

However, this is no longer valid syntax, as wrapped lines must be indented an additional two spaces from the hyphen (so that they line up with the start of the text on the line with the hyphen). The correct indentation would be:

- my very very very very very very very very very very very very very very very very
  very very very very very long item

Would it be possible for rewrap to insert the additional two spaces (or whatever the file’s indentation is) when wrapping in a YAML file?