Keep is/extends inline for multi-argument template heritage#11011
Merged
timotheeguerin merged 5 commits intoJun 22, 2026
Conversation
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
0922558 to
ce6a4b5
Compare
A model/scalar heritage clause (`is X` / `extends X`) wrapped the keyword and
the template reference in one `group(indent(...))`. Prettier measures that
group against the full flat width of the template argument list, so it broke
and pushed the keyword onto its own indented line even when the declaration
line was short:
model Picked
is PickProperties<
Sample,
...
>;
`printHeritageClause` now keeps the keyword inline when the base is a template
reference with multiple (breakable) arguments, letting the argument list
control the line break:
model Picked is PickProperties<
Sample,
...
>;
Single-argument and non-template bases keep breaking the keyword when the
declaration is too long.
Fixes the `is`-breaking part of microsoft#11009.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ce6a4b5 to
e3b7b82
Compare
Apply the new `is`/`extends` inline formatting (microsoft#11009) to committed artifacts that the formatter now reformats: the http-client-java test spec arm-customization.tsp and the 1.11 release-notes embedded example. Whitespace only, no semantic change. Also update the regenerated `crossLanguageVersion` hash in azure-resourcemanager-armcustomization-generated_metadata.json, which is whitespace-sensitive to the reformatted spec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e3b7b82 to
95e7383
Compare
Keep azure-resourcemanager-armcustomization-generated_metadata.json out of this formatter PR as requested. The arm-customization.tsp reformat stays (required by format:check); leaving the regenerated crossLanguageVersion hash reverted lets CI surface the RegenCheck behavior for the java team. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
weidongxu-microsoft
approved these changes
Jun 22, 2026
This reverts commit 051c04c, restoring the regenerated crossLanguageVersion hash change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…eritage-keyword-break
timotheeguerin
approved these changes
Jun 22, 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 the
is-breaking part of #11009 (the blank-line/over-indent part is addressed separately in #11010).Problem
When a model/scalar heritage clause (
is X/extends X) references a template with multiple arguments, the formatter wrapped the keyword and the template reference in a singlegroup(indent(...)). Prettier measures that group against the full flat width of the template argument list, so the group broke and pushed the keyword onto its own indented line — even when the declaration line itself was short:Fix
printHeritageClausenow keeps the keyword on the declaration line when the base is a template reference with multiple (breakable) arguments, and lets the template argument list control the line break:Single-argument (hugged) and non-template bases keep the previous behavior of breaking the keyword onto its own line when the declaration is too long.
Tests
model is,model extends, andscalar extendsinformatter.test.ts.http-client-javatest spec (arm-customization.tsp) that contained the old output (whitespace only, no semantic change).prettier --check "**/*.tsp"all pass locally.🤖 Generated with Claude Code