Open
Description
Language extensions can provide rules for increasing/decreasing indentation when writing new lines and copy-pasting code. The VS Code documentation for this feature is here https://code.visualstudio.com/updates/v1_14#_auto-indent-on-type-move-lines-and-paste
Some scenarios where the current indentation behavior can be improved, the |
marker is the position of the cursor
-- obtained
++ expected
val x =
- |
+ |
val x = (n: Int) =>
- |
+ |
1 match {
case 1 =>
- |
+ |
To play around with this feature, the language-configuration.json
file needs to be updated with regex rules like this:
{
"indentationRules": {
"increaseIndentPattern": "^\\s*((begin|class|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while)|(.*\\sdo\\b))\\b[^\\{;]*$",
"decreaseIndentPattern": "^\\s*([}\\]]([,)]?\\s*(#_|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when)\\b)"
}
}