mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Add indentation rules for Visual Basic
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user