vsc-python-indent icon indicating copy to clipboard operation
vsc-python-indent copied to clipboard

Enter when in a if-line

Open PsywolfTheEnder opened this issue 4 years ago • 1 comments

Let's us enter in a code line like Pycharm IDE It's should be looks like the right side of the image

Capture

PsywolfTheEnder avatar May 19 '21 05:05 PsywolfTheEnder

Hello @PsywolfTheEnder, thank you for opening the issue. I think this is also related to https://github.com/kbrose/vsc-python-indent/issues/65.

I'd probably accept an MR that accomplishes this, but I'm sorry to say I likely won't be putting in the effort to accomplish this. Here's my understanding of what would have to change, for what it's worth:

  1. The handling of backslash continuations (which is missing from the left-hand image by the way) currently blindly indents the next line. See backlash detection and handling of partial indentations. This would have to be updated to know that it's the continuation of a specific kind of line (an if, def, else, etc. line) -- some sort of double-indent line?
  2. The handling of if/def/else/etc. keywords also relies on the detection of a colon, and then indents the next line accordingly with special handling to know that if a colon occurs after a closing bracket, then the indentation level should be relative to wherever the bracket was opened.

kbrose avatar May 19 '21 23:05 kbrose