Repository navigation
fix(lsp): preserve body alignment after opening parentheses - #1816
Merged
Lorenzobattistela merged 2 commits intoOct 21, 2026
Merged
Conversation
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 body beginning on the same line as
(can lose its statement column during formatting. A grouped array-update sequence then fails to parse, even though the existing fingerprint accepts the output.Start the existing bounded body scope at the first token after
(. Its continuation lines move with that token, using the existing delimiter, type-angle and argument-comma expiry. Update the comment to name this opener; no new helper or state.Blast radius
Two files in
tools/bend-fmt-lsp: the formatter's alignment scan before the existing fingerprint check, and fixtures in its current CLI-backed tests. The scanner also handles call/parameter parentheses. No parser, compiler, runtime, public API, dependency or gate changes.Regression evidence
Two added fixtures cover grouped updates and a leading closer with an observable following argument. All three indentation styles actively change the source, preserve its CLI output and remain idempotent. Five of the six baseline variants fail parsing; the plain group's tab variant already works. The updated permanent test fails with main's formatter at
expected ')' / observed 'a'.Checks
npm test: build and 33/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 ran on macOS arm64. No interactive editor-client test, Linux run, cluster or GPU/backend matrix. A body starting directly after a tuple comma remains a known pre-existing failure; this change adds only the
(origin. Some far-indented layouts still retain their input through the existing fingerprint safeguard.