Reformat Code mishandles multiline strings

I've got a bit of code that has a multiline string surrounded by parenthesis:

msg = (
"Lots of text..."
"Even more text..."
"And more text..."
) # closing paren properly indented per PEP 8 recommendations

When I ask PyCharm to reformat my code (Ctrl + Alt + L), it moves the closing parenthesis to the left:

msg = (
"Lots of text..."
"Even more text..."
"And more text..."
) # closing paren un-indented after running "Reformat Code"

... to which I get the warning: "PEP 8: closing bracket is missing indentation"
I've enabled "Hang Closing Bracket" under "Settings > Editor > Code Style > Wrapping and Braces"  but that option does not seem to work for the string assignment shown above - it continues to un-indent the closing parenthesis.
Is there another setting that would configure PyCharm to correctly format the above string to follow PEP 8 recommendations?

0
Avatar
Permanently deleted user

Any thoughts from the peanut gallery?

0

请先登录再写评论。