GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — Allow user to force the default implicit formatting to use `AutoSize` by daxian-dbw · Pull Request #28018 · PowerShell/PowerShell Conversation
|
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Critical formatting defects and missing regression coverage must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Adds $PSStyle.AutoSizeDefaultFormatting to enable AutoSize for implicit table and wide formatting.
Changes:
$PSStyle setting.| File | Review findings |
|---|---|
test/powershell/engine/Formatting/PSStyle.Tests.ps1 |
Moderate (3 votes): Add coverage for implicit wide views and untyped objects. Moderate (1 vote): Restore the original process-wide setting in cleanup rather than hard-coding $false. |
src/System.Management.Automation/FormatAndOutput/format-default/format-default.cs |
Critical (3 votes): Preserve null parameters during shape inference for objects without default views. Critical (3 votes): Apply the override only to selected Table or Wide views to avoid buffering List and Complex output. |
src/System.Management.Automation/FormatAndOutput/common/PSStyle.cs |
Nit (1 vote): Include AutoSizeDefaultFormatting in the default $PSStyle formatter view. |
src/System.Management.Automation/FormatAndOutput/common/PSStyle.cs:647
PSStyle view is an explicit ListControl that enumerates the top-level settings (PowerShellCore_format_ps1xml.cs:2139-2212), but it has no entry for AutoSizeDefaultFormatting. As a result, $PSStyle and $PSStyle | Format-List hide this new user-facing setting; add it to the generated default formatter view. public bool AutoSizeDefaultFormatting { get; set; }
test/powershell/engine/Formatting/PSStyle.Tests.ps1:624
$false instead of restoring the value present when the test started. Because PSStyle.Instance is process-wide and the surrounding tests save and restore settings (for example, lines 143-153), this can leak state to later tests and makes the test depend on an initially disabled feature. Save the original value, establish a false baseline before capturing $defaultOutput, and restore the original in finally. $PSStyle.AutoSizeDefaultFormatting = $false
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fix autosizing for inferred views and update the user-facing documentation/checklist.
src/System.Management.Automation/FormatAndOutput/common/PSStyle.cs:647
$PSStyle setting that users must discover and configure, while the PR checklist marks “User-facing changes” as Not Applicable. Please update the user-facing PSStyle documentation (or file the required documentation issue) and correct the checklist before merging. public bool AutoSizeDefaultFormatting { get; set; }
src/System.Management.Automation/FormatAndOutput/format-default/format-default.cs:33
FormatViewManager.Initialize() still calls SelectViewGeneratorFromProperties(..., null), so this parameters object is discarded for inferred views. As a result, $PSStyle.AutoSizeDefaultFormatting = $true has no effect for an untyped object that is inferred as a table (for example, a [pscustomobject] with four or fewer properties), even though the feature promises to autosize the chosen table/wide view. Preserve null for shape inference, then apply the autosize flag to the resulting Table/Wide generator, and add a regression case for this path. var parameters = new FormattingCommandLineParameters { autosize = true };
((InnerFormatShapeCommand)this.implementation).SetCommandLineParameters(parameters);
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Mark this PR 7.6-consider because this could be potentially required by agent to reduce the output verbosity from shell invocation. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2179219
into
PowerShell:master
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.