WrapToColumn
WrapToColumn copied to clipboard
Regression: Python docstrings fail wrapping
The new version wrapping Python docstrings adds * prefix to lines, if the comment starts on the docstring line.
Input:
def a():
""" a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a """
Output:
def a():
""" a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
* a a a a """
Looks like it is added by this ancient hack makes sense for C-style comments but not for Python i.e. not if firstLineIsDocstring.
if (i > 0 && firstLineIsCommentOpener) {
// This is a hack. We don't know how much whitespace to use!
lineIndent = "$whitespaceBeforeOpener * "
}
Fix:
if (i > 0 && firstLineIsCommentOpener && !firstLineIsDocstring) {
// This is a hack. We don't know how much whitespace to use!
lineIndent = "$whitespaceBeforeOpener * "
}
Wrapping (at least Wrap Line to Column) was not adding these asterix in earlier versions, though you'll have a better understanding of why it was so. I'm not making a pull request because of this unclarity.