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

Fixes #65

edgarsi avatar Nov 23 '24 23:11 edgarsi

@abrookins

edgarsi avatar Aug 22 '25 21:08 edgarsi

Hi @abrookins, thanks for maintaining this project!

I’ve been running into issues using WrapToColumn with PyCharm, and it looks like this PR resolves them. Would you be open to merging it and cutting a new release? It would make a big difference for my workflow (honestly close to a make-or-break feature for me).

If there’s anything blocking review, I’d be happy to help.

Thanks again for your work on this project!

camUrban avatar Sep 30 '25 21:09 camUrban

Thanks @edgarsi! 🎉 Great fix with solid refactoring of the regex logic. The separation of inline comments from docstrings makes the code much cleaner. Merged!

abrookins avatar Jan 07 '26 01:01 abrookins