How do I prevent pycharm from adding "pass" automatically?

If I have this code:

if whatever:
do_something()

And the text cursor is on the do_something() line, and I move the line above the if (Ctrl+Shift+Up), PyCharm adds "pass" automatically but I don't want it and I can't find a way of disabling it:

do_something()
if whatever:
pass <-- I don't want this auto added

I looked through the settings but I couldn't find anything to disable this

0
9 comments

I also noticed that moving lines like that sometimes causes PyCharm to change the indentation on unrelated lines, I'd like to disable that as well

0

PyCharm adds "pass" automatically

This doesn't seem to happen for me. I'm also not aware of the setting that would do that.

Could you please check if the same behavior is reproduced withe the default settings and with all custom plugins disabled?

To restore default settings, you can use **File | Manage IDE settings | Restore Default Settings...**. Your current settings will be backed up, so you can revert to them later if needed (to do this, just import settings from the backed up folder). 

0

Yeah it still does that

0

Could you please share Logs from **Help | Collect Logs and Diagnostic Data**, so I could take a look at your version/settings/plugins?

You can use uploading service at https://uploads.jetbrains.com/ , and provide upload ID in your reply.

0

Upload id: 2022_07_08_FzifghYN665bQR2NF6LXNX 

0

Hmm, could you please upload a screencast showing this behavior as well? This would give a better idea how to reproduce the issue.

0

Upload id: 2022_07_09_JgP4uVQ9sCxEvsX3JEPQRV (file: out.mp4)

0

Which shortcut are you using to move the line? Is it "Move Line Up"? 

0

Looks like Ctrl+Shift+Up is "Move statement up". Rebinding it to "Move line up" seems to fix the issue

0

Please sign in to leave a comment.