Skip to content

Don't warn about the list view window size from Get-PSReadLineOption - #5206

Open
秀吉 (thc1006) wants to merge 2 commits into
PowerShell:masterfrom
thc1006:fix/get-psreadlineoption-window-warning
Open

Don't warn about the list view window size from Get-PSReadLineOption#5206
秀吉 (thc1006) wants to merge 2 commits into
PowerShell:masterfrom
thc1006:fix/get-psreadlineoption-window-warning

Conversation

@thc1006

@thc1006 秀吉 (thc1006) commented Aug 31, 2026

Copy link
Copy Markdown

PR Summary

Fixes #5205.

Get-PSReadLineOption writes the "prediction 'ListView' is temporarily disabled" warning on every call, as long as ListView is the active view style and the window is under 50x5. Two things follow from that:

  • Any caller triggers it, not only the person who chose ListView. In practice that caller is a prompt module - oh-my-posh reads the options once when its module loads - so the warning turns up on shell start in an editor terminal that is still below the threshold at that moment, and the user who configured ListView has no way to suppress a warning raised from someone else's code.
  • The same information is already delivered where it is actionable. Set-PSReadLineOption -PredictionViewStyle ListView warns at the point the user opts in, and the view itself renders ! terminal size too small to show the list view inline while typing.

The call has been in GetPSReadLineOption.EndProcessing since ListView was added in #1909, so this changes long-standing behaviour on purpose. Set-PSReadLineOption is untouched, and the new test pins both halves so neither can drift.

#5205 offered warning once per session as an alternative - happy to switch to that instead. The PredictionSource = None case noted there is unchanged and can be a separate follow-up.

The second commit is a drive-by in the same area: #3583 lowered PredictionListView.MinWindowHeight from 15 to 5 and updated the mirrored MinWindowWidth in the tests, but left MinWindowHeight at 15, despite the comment above it asking for the two to stay in sync. Happy to drop that commit to keep this PR to one thing.

Verification

./build.ps1 -Configuration Release then ./build.ps1 -Test -Configuration Release, both with 0 errors and 0 warnings:

test pass total passed failed skipped
en-US 293 291 0 2
screen-reader 293 10 0 283

Restoring the removed line makes the new test fail with Assert.Empty() Failure: Collection was not empty.

The built module loaded into a 49x20 console:

conhost.exe Windows Terminal
Set-PSReadLineOption -PredictionViewStyle ListView 1 warning 1 warning
Get-PSReadLineOption none none

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
      • The warning is not documented: neither Get-PSReadLineOption, the -PredictionViewStyle description on Set-PSReadLineOption, nor about_PSReadLine mentions it or the minimum window size.
Microsoft Reviewers: Open in CodeFlow

`Set-PSReadLineOption -PredictionViewStyle ListView` already warns when the user
opts into a view the window cannot show, which is where the advice is actionable.
Repeating it on every read means any caller triggers it, including prompt modules
that read the options once at load time, and the person who configured ListView
cannot suppress a warning raised from someone else's code.
PowerShell#3583 lowered `PredictionListView.MinWindowHeight` from 15 to 5 and updated the
mirrored `MinWindowWidth` in the tests, but left `MinWindowHeight` at 15.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-PSReadLineOption emits the ListView window-size warning, so prompt modules trigger it on every shell start

1 participant