WrapToColumn icon indicating copy to clipboard operation
WrapToColumn copied to clipboard

Fix inline docstring wrap

Open edgarsi opened this issue 1 year ago • 3 comments

Short docstrings are often put on the same line as their opening and ending sequences. There is no real restriction using this style on multi-line docstrings either, so this formatting style is maintained when a docstring is split into multiple lines - we're not oppressing users with opinionated decisions.

What I'm not fully sure about:

  • paragraphSeparatorPattern didn't match tab placeholders before, and it seems like it would prevent splitting text into paragraphs, if tabs were used instead of spaces. But this didn't really matter because there isn't an API for wrapping multiple paragraphs?
  • The purpose of the firstLineIsDocstring hack. If only such docstrings were considered, where the tripple quotes stand on separate lines, wrapParagraph would already preseve them as single lines and they'd not enter into breakToLinesOfChosenWidth. Maybe some idea for inline docstring handling, I don't understand.

edgarsi avatar Nov 23 '24 23:11 edgarsi