Don't warn about the list view window size from Get-PSReadLineOption - #5206
Open
秀吉 (thc1006) wants to merge 2 commits into
Open
Don't warn about the list view window size from Get-PSReadLineOption#5206秀吉 (thc1006) wants to merge 2 commits into
Get-PSReadLineOption#5206秀吉 (thc1006) wants to merge 2 commits into
Conversation
`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.
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.
PR Summary
Fixes #5205.
Get-PSReadLineOptionwrites the "prediction 'ListView' is temporarily disabled" warning on every call, as long asListViewis the active view style and the window is under 50x5. Two things follow from that: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 configuredListViewhas no way to suppress a warning raised from someone else's code.Set-PSReadLineOption -PredictionViewStyle ListViewwarns at the point the user opts in, and the view itself renders! terminal size too small to show the list viewinline while typing.The call has been in
GetPSReadLineOption.EndProcessingsinceListViewwas added in #1909, so this changes long-standing behaviour on purpose.Set-PSReadLineOptionis 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 = Nonecase 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.MinWindowHeightfrom 15 to 5 and updated the mirroredMinWindowWidthin the tests, but leftMinWindowHeightat 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 Releasethen./build.ps1 -Test -Configuration Release, both with 0 errors and 0 warnings: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:
Set-PSReadLineOption -PredictionViewStyle ListViewGet-PSReadLineOptionPR Checklist
Get-PSReadLineOption, the-PredictionViewStyledescription onSet-PSReadLineOption, norabout_PSReadLinementions it or the minimum window size.Microsoft Reviewers: Open in CodeFlow