Add indentation rules for Visual Basic

This commit is contained in:
Dmitriy Vasyura
2025-12-21 17:22:34 -08:00
parent a4451f532b
commit 7a6a7929e3
3 changed files with 45 additions and 7 deletions

View File

@@ -25,5 +25,34 @@
"start": "^\\s*#Region\\b",
"end": "^\\s*#End Region\\b"
}
}
},
"indentationRules": {
"decreaseIndentPattern": "^\\s*((End\\s+(If|Sub|Function|Class|Module|Enum|Structure|Interface|Namespace|With|Select|Try|While|For|Property|Get|Set|SyncLock|Using|AddHandler|RaiseEvent|RemoveHandler|Event|Operator))|Else|ElseIf|Case|Catch|Finally|Loop|Next|Wend|Until)\\b",
"increaseIndentPattern": "^\\s*((If|ElseIf).*Then(?!\\s+(End\\s+If))\\s*(('|REM).*)?$)|\\b(Else|While|For|Do|Select\\s+Case|Case|Sub|Function|Class|Module|Enum|Structure|Interface|Namespace|With|Try|Catch|Finally|SyncLock|Using|Property|Get|Set|AddHandler|RaiseEvent|RemoveHandler|Event|Operator)\\b(?!.*\\bEnd\\s+(If|Sub|Function|Class|Module|Enum|Structure|Interface|Namespace|With|Select|Try|While|For|Property|Get|Set|SyncLock|Using|AddHandler|RaiseEvent|RemoveHandler|Event|Operator)\\b).*(('|REM).*)?$"
},
"onEnterRules": [
// Prevent indent after End statements, block terminators (Else, ElseIf, Loop, Next, etc.)
{
"beforeText": "^\\s*((End\\s+(If|Sub|Function|Class|Module|Enum|Structure|Interface|Namespace|With|Select|Try|While|For|Property|Get|Set|SyncLock|Using|AddHandler|RaiseEvent|RemoveHandler|Event|Operator))|Else|ElseIf|Loop|Next|Wend|Until)\\b.*$",
"action": {
"indent": "none"
}
},
// Prevent indent when pressing Enter on a blank line after End statements or block terminators
{
"beforeText": "^\\s*$",
"previousLineText": "^\\s*((End\\s+(If|Sub|Function|Class|Module|Enum|Structure|Interface|Namespace|With|Select|Try|While|For|Property|Get|Set|SyncLock|Using|AddHandler|RaiseEvent|RemoveHandler|Event|Operator))|Else|ElseIf|Loop|Next|Wend|Until)\\b.*$",
"action": {
"indent": "none"
}
},
// Prevent indent after lines ending with closing parenthesis (e.g., function calls, method invocations)
{
"beforeText": "^[^'\"]*\\)\\s*('.*)?$",
"afterText": "^(?!\\s*\\))",
"action": {
"indent": "none"
}
}
]
}