A not working feature, which would result in a bug...
I found this passage of the code very interesting:
decreaseIndentPattern: /^\s*(((return|break|continue|raise)\n)|((elif|else|except|finally)\b.*:))\s*$/
I assume the (return|break|continue|raise)\n should decrease the identation in the next line, when the user types return, break, continue or raise. But this doesn't work.
I got it to work by adding the following to the onEnterRules:
{
beforeText: /^\s*((return|break|continue|raise))\s*$/,
action: { indentAction: vscode.IndentAction.Outdent }
},
But this results in the following bug:
proc f() =
if true:
|
(| is where the cursor is)
When return is typed, the next line gets outdented once after typing enter. Then when else: is typed, the else outdents once again. Now the else is too far outdented.
And that's why I'm asking if this is intended, or not?
It is because onEnterRules conflicts with decreaseIndentPattern in this case.
I guess onEnterRules breaks inner indent counters state of VSCode, It is possible use this workaround:
beforeText: /^\s*((return|break|continue|raise))\s*$/,
action: { indentAction: vscode.IndentAction.None, removeText: 2 }
but it will work only for fixed tab size
Yes it does works. Hm I'm wondering if there's a real fix to this problem(beside just leaving it as is it/removing the ((return|break|continue|raise)\n) from the regex)...