Powershell intellisense doesn't complete previous multiline commands
Prerequisites
- [x] Write a descriptive title.
- [x] Make sure you are able to repro it on the latest released version
- [x] Search the existing issues.
- [x] Refer to the FAQ.
- [x] Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
echo '1
2
3'
echo ' # psreadline doesn't fill in previous command
Expected behavior
# Should fill in previous command.
Actual behavior
# Nothing happens.
Error details
Environment data
Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
This should be in the PSReadLine repo, tagging @daxian-dbw for additional insight but personally I see this to be pretty tricky given a situation where the prompt is at the bottome of the screen do we scroll it up to make room for the new lines? Similiarly we would need to limit the amount of new lines suggested to a certain length because often times folks (myself included) like to copy and paste a large function and would not want to see that suggested to me with predictive intellisense.
@StevenBucher98, at list in the list view the scrolling problem could be solved by using a single-line representation in the suggestions list, in the simplest case with an ellipsis (…) indicating the omission of the subsequent lines.
This technique is already used for overly long single-line commands.
As for the default inline view:
- Note that even an excessively long single-line command can already result in multiple lines being offered as a history completion, due to line wrapping.
- Similarly, history recall with up-arrow already restores multi-line commands as-is.
Simply omitting multi-line statements from the history, as is currently the case, is definitely suboptimal.