Where in intellij code is PyCharm auto dedent of 'else:' implemented?

已回答

One thing that I have noticed that PyCharm does that I think is nifty is, when typing an 'if ... else' block, if you type the else at the indent level of the 'if' contents, PyCharm will automatically dedent it back to the 'if' level.

E.g. if I type: 'if 1:<ENTER>print('hi')<ENTER>else', it will look like:

If I then type a colon: ':', it becomes

I'm wondering where in the code this feature is implemented, because I find it nifty, and I would like to apply it to my own plugins.

 

0

com.jetbrains.python.codeInsight.PyUnindentingInsertHandler

0

请先登录再写评论。