-
Notifications
You must be signed in to change notification settings - Fork 37.5k
Description
- VS Code Version: 1.51.1
- OS Version: Windows_NT x64 10.0.17763
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
- Open a Visual Basic file (.vb)
- Type:
if True then
' Some code
end if
Expected: When you type "End If", the indentation will go back to the same level as the opening block ("if"), as can be seen above.
Actual: The "end if" stays in the wrong indentation level:
if True then
' Some code
end if
Possible cause and solution:
I found out that this can happen in all programming languages where a closing tag includes the opening tag as a separate word (For example: If ... End If, or While ... End While).
Solution: This is related to the order of the pieces as defined in these lines of code in the richEditBrackets.ts file
- If you change the order so that first the closing brackets would be pushed and only then the opening brackets, then it will work.
- Alternatively, you can modify the createBracketOrRegExp function and just add a reverse() function there.
I'm not sure if it will mess things up or not (though my initial tests look promising) and I'm not too familiar with the code to change it myself and issue a PR, so please take a look and let me know what you think.
Thank you!