Fix de-indent of multi-line call continuation lines ending with a closing paren#147
Merged
Merged
Conversation
…sing paren
A continuation line such as the second line of
m.assertEqual(result, expected,
`msg`)
was being pulled back to the call's indent level. The current line was
dedented whenever no indentor preceded the closer on that line, which is also
true for a closer sitting at the *end* of a content/continuation line.
Dedent the current line only when the closer is the first non-whitespace token
on the line (a line that actually starts with a closer). This also covers the
earlier "align a leading `})` with its opener" behavior, so the now-redundant
foundIndentorThisLine / outdentedThisLine flags are removed.
TwitchBronBron
approved these changes
Jun 30, 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.
Follow-up to #145. Reported via downstream formatting on a real codebase: a multi-line call whose continuation line ends with the closing
)was being de-indented back to the call's level.Cause
The current line was dedented whenever no indentor preceded the closer on that line (
foundIndentorThisLine === false). That condition is also true for a closer at the end of a content/continuation line, so the line got pulled back. It only appeared to work for some lines: e.g. a template interpolation containing parens (${Type(result)}) flips the flag, so the next call's continuation — whose interpolations have no parens (${expected}) — broke instead. The underlying bug affects any multi-line call ending in), template or not.Fix
Dedent the current line only when the closer is the first non-whitespace token on the line (a line that actually starts with a closer). This also subsumes the earlier "align a leading
})with its opener" behavior, so the now-redundantfoundIndentorThisLine/outdentedThisLineflags are removed.Added regression tests (both fail on master, pass with the fix). Verified idempotent on playlet, jellyfin-roku, and jellyrock.