Skip to content

Conversation

@dmitrivMS
Copy link
Contributor

Fixes #118932

Added more tests as well to cover onEnter scenarios.

@dmitrivMS dmitrivMS requested review from aiday-mar and Copilot January 7, 2026 11:22
@dmitrivMS dmitrivMS added the editor-autoindent Editor auto indentation issues label Jan 7, 2026
@dmitrivMS dmitrivMS self-assigned this Jan 7, 2026
@dmitrivMS dmitrivMS enabled auto-merge (squash) January 7, 2026 11:22
@vs-code-engineering vs-code-engineering bot added this to the December 2025 milestone Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 increaseIndentPattern regex to properly handle If/ElseIf...Then statements and ensure both alternatives are correctly anchored
  • Added vbOnEnterRules to 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

@dmitrivMS dmitrivMS modified the milestones: December 2025, January 2026 Jan 7, 2026
@dmitrivMS dmitrivMS disabled auto-merge January 7, 2026 16:11
@dmitrivMS dmitrivMS enabled auto-merge January 8, 2026 07:37
@dmitrivMS dmitrivMS disabled auto-merge January 9, 2026 09:02
@dmitrivMS dmitrivMS enabled auto-merge (squash) January 9, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor-autoindent Editor auto indentation issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add language configuration file for visual basic

2 participants