Ask Your Question

Toggle Block Comment flattens if statemets

asked 2022-05-04 09:41:05 -0500

KhazAkar's avatar

Hi, RIght now, when you enforce formatting with PEP8, after saving such formatted block after commenting it, it changes this:

##if data:
##    print('aaa')
##    print("bbb")

To that:

# if data:
# print('aaa')
# else:
# print("bbb")

Is there a way to modify/fix it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-05-04 09:52:26 -0500

This happens if you enable the Editor > Auto-Formating > PEP8: Spaces after # preference. Autopep8, which is what is being used to do the reformatting, tries to see if the content of a comment is code and if so it doesn't reformat it, but that determination seems to be skipped when that option is enabled.

It looks like our default for this preference is currently to enable it, but given this quirk I'm thinking the default should instead be to disable it. We'll look into making that change in the future.

edit flag offensive delete link more


Thanks a lot, disabling this option helped :)

KhazAkar's avatar KhazAkar  ( 2022-05-04 10:28:05 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-05-04 09:41:05 -0500

Seen: 113 times

Last updated: May 05 '22