Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Visual Basic indentation issues by refining the indent/dedent patterns and adding explicit onEnter rules. The changes ensure proper automatic indentation when typing block keywords (like Sub, Module, If...Then) and dedenting when typing block terminators (like End Sub, End If, Loop).
Key changes:
- Updated
increaseIndentPatternregex to properly handle If/ElseIf...Then statements and ensure both alternatives are correctly anchored - Added
vbOnEnterRulesto prevent unintended indentation after End statements and block terminators - Removed overly broad onEnterRule that was incorrectly preventing indentation after lines ending with parentheses
- Added comprehensive test coverage for Module, Sub, Function, Class, If/ElseIf/Else, While, For, Do/Loop, Select/Case, and Try/Catch/Finally blocks
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/vs/editor/test/common/modes/supports/onEnterRules.ts |
Exports new vbOnEnterRules array with pattern to prevent indentation after block terminators |
src/vs/editor/test/common/modes/supports/indentationRules.ts |
Refactors increaseIndentPattern for VB to properly group alternatives and fix negative lookahead for single-line constructs |
src/vs/editor/contrib/indentation/test/browser/indentation.test.ts |
Imports vbOnEnterRules, registers it for VB language, and adds 18 new test cases covering various indentation scenarios |
extensions/vb/language-configuration.json |
Updates indentation patterns to match test configuration and removes problematic onEnterRule for closing parentheses |
aiday-mar
approved these changes
Jan 13, 2026
eli-w-king
pushed a commit
that referenced
this pull request
Jan 14, 2026
Fix indentation rules for VB
Contributor
This was referenced Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #118932
Added more tests as well to cover onEnter scenarios.