Repository navigation
[release/v7.6.7] Allow user to force the default implicit formatting to use AutoSize - #28096
Merged
Dongbo Wang (daxian-dbw) merged 1 commit intoSep 24, 2026
Conversation
…PowerShell#28018) When `$PSStyle.AutoSizeDefaultFormatting = $true`, the default implicit formatting applied by PowerShell (via `Out-Default`) will enforce `AutoSize` when the chosen formatting view is `table` or `wide`, similar to running `Format-Table -AutoSize` and `Format-Wide -AutoSize` explicitly. The `List` and `Complex` views formatting won't be buffered though -- they will continue to be streamed. This allows PowerShell to generate less verbose output when used by an agent. It also makes PowerShell works better with small-window terminal.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The fallback path drops formatting parameters, preventing AutoSize for objects without registered format views.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Backports opt-in $PSStyle.AutoSizeDefaultFormatting support for implicit table and wide formatting while preserving streaming for list and complex views.
Changes:
- Adds the new PSStyle setting and default display property.
- Applies
AutoSizeduring default formatting. - Adds formatting and streaming tests.
| File | Summary |
|---|---|
test/powershell/engine/Formatting/PSStyle.Tests.ps1 |
Tests the new setting and formatting behavior. |
src/System.Management.Automation/FormatAndOutput/format-default/format-default.cs |
Applies the AutoSize override; the fallback path requires correction. |
src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs |
Displays the new PSStyle property. |
src/System.Management.Automation/FormatAndOutput/common/PSStyle.cs |
Defines the new setting. |
src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator.cs |
Restricts AutoSize to table and wide views. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Aditya Patwardhan (adityapatwardhan)
approved these changes
Sep 24, 2026
Dongbo Wang (daxian-dbw)
merged commit Sep 24, 2026
4bb1dc6
into
PowerShell:release/v7.6.7
36 checks passed
Dongbo Wang (daxian-dbw)
deleted the
backport/release/v7.6.7/28018-2179219c8
branch
September 24, 2026 22:04
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.

Backport of #28018 to release/v7.6.7
Triggered by Dongbo Wang (@daxian-dbw) on behalf of Dongbo Wang (@daxian-dbw)
Original CL Label: CL-General
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Customer Impact
Adds a new
$PSStyle.AutoSizeDefaultFormattingsetting. When set to$true, PowerShell's default implicit formatting (viaOut-Default) will enforceAutoSizefor table/wide views, matchingFormat-Table -AutoSize/Format-Wide -AutoSizebehavior. This lets users get less verbose, better-fitting output in small terminal windows or when consumed by an agent, without needing to explicitly pipe to Format-Table/Format-Wide.Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Original PR added a test verifying that List and Complex view formatting remain streamed (not buffered) even with AutoSizeDefaultFormatting enabled. Backport verified by confirming the cherry-pick applied cleanly with no conflicts on release/v7.6.7.
Risk
REQUIRED: Check exactly one box.
Medium risk: adds new opt-in formatting behavior gated behind a new $PSStyle property that defaults to off, so existing behavior is unchanged unless a user explicitly opts in. List and Complex views remain streamed (unbuffered), limiting the scope of the change.