Test correct indentation when strings, comments, regex tokens contain brackets of language configuration #213561
Closed
2 tasks done
Labels
Milestone
Refs: #209519, #209862
Complexity: 3
Create Issue
Indentation in the editor is determined by the indentation patterns of the language configuration file. There are 4 regex patterns called the
increaseIndentPattern
,decreaseIndentPattern
,unIndentedLinePattern
,indentNextLinePattern
. If for example a line satisfies theincreaseIndentPattern
, then the line after will be indented (a similar logic applies for the other patterns).It has been noticed that these patterns do not cover correctly all indentation logic. In particular for the following code:
Previously if one would click on
Enter
after that line, the next line would be indented. This is because the line above satisfies theincreaseIndentPattern
pattern. To mitigate this (at least partially), this iteration we have worked on stripping the tokens of the current line of the brackets of the language configuration file before evaluating the indentation patterns. For the above example for example, the line would be stripped and would become:The indentation patterns would be evaluated thereafter on that. Generally this is done for brackets appearing in string, comment or regex tokens.
To test the above, please follow the list below. VS Code has some inbuilt language configuration files, these are generally called
language-configuration.json
. The TypeScript language configuration file is at the following path:extensions/typescript-basics/language-configuration.json
. You can find there the regex indentation patterns for TypeScript underindentationRules
as well as the language brackets underbrackets
.Enter
after that line to trigger auto indentation and verify that the indentation level of the following lines is not affected by the brackets in the string (it could still be affected by the brackets outside of it). Generally verify that auto-indentation works correctly and no strange indentation happens.Thans for testing!
The text was updated successfully, but these errors were encountered: