Repository navigation
fix(lsp): preserve grouped semicolon body alignment - #1811
Merged
Lorenzobattistela merged 2 commits intoOct 21, 2026
Merged
Lorenzobattistela merged 2 commits into
Lorenzobattistela merged 2 commits into
Conversation
Lorenzobattistela
approved these changes
Oct 21, 2026
Merged
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.
Problem and fix
A valid parenthesized array-update sequence prints
[9, 8], but formatting a continuation after;can move it away from its required column. The formatted program then fails to parse; the shared layout fingerprint accepts that output.Let semicolons start the existing scoped body pins, as nested lambdas already do. This removes the special semicolon branch while retaining delimiter, argument-comma, and type-argument boundaries. Rename the existing scope stack and update its comment to cover both openers.
Blast radius
Two files in
tools/bend-fmt-lsp: the inline-body scan insrc/formatter.tsand fixtures in its existing CLI-backed tests. The change affects alignment before the existing fingerprint check. No public API or language compatibility break; no parser, compiler, runtime, gate, or dependency changes.Regression evidence
Three added fixtures cover grouped array updates, generic commas, and a leading closer followed by another argument. Each original must print
[9, 8]; all three indentation styles must actively change the source, preserve that output, and be idempotent. They reuse the existing test harness.All nine added source/style combinations fail against main with
expected ')' / observed 'a'. Existing lambda, delimiter, literal/comment, match-anchor, and declaration-boundary checks also pass.Checks
npm test: build and all 33 tests pass, zero skips, including the LSP stdio session.npm pack --dry-run: build passes; 14-file package inventory.bun gates/repo.tswith CI-pinnedttok0.3: 54/54.git diff --check: passes.Validation limits
Local checks use macOS arm64, Node 26.8.2 and Bun 1.3.11. No Linux run, interactive editor-client test, or cluster/CPU/GPU matrix. The three new CLI regressions use the source interpreter.
Some unusually far-indented argument layouts still return their original source through the existing fingerprint safeguard. A separate parenthesized update sequence without a semicolon remains outside this fix.