-
Notifications
You must be signed in to change notification settings - Fork 395
Alias "?" is changed to "%" by Invoke-Formatter #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I confirmed that the issue is also occurred in the macOS 10.14 with PSCore 6.2 . |
Thanks for reporting this. I had a look at it and the bug seems to be caused by the CommandInfo lookup here, where PSSA takes the first element, when it executes >Get-Command -Name '?' -ErrorAction SilentlyContinue
CommandType Name Version Source
----------- ---- ------- ------
Alias % -> ForEach-Object
Alias ? -> Where-Object
Alias d -> dotnet.exe
Alias g -> git.exe
Alias h -> Get-History
Alias r -> Invoke-History Concluding, I think we might have to change the default setting of this rule to be not enabled by default in the VS-Code extension to prevent to minimise the damage (although people are encourage to use source control and look at the diff). I'd hope that we can patch PSSA at some point then and modify the rule to look only for certain CommandTypes and not aliases. I'd also like to raise the question in the PowerShell repo as to why PowerShell returns such a result. cc @TylerLeonhardt @SteveL-MSFT |
A bit of topic, but why not use:
|
Invoke-Formatter will convert "?" to "%".
Before formatting
After formatting
I found this bug when I research PowerShell/vscode-powershell#1842 and PowerShell/vscode-powershell#1849 .
It's a ridiculous bug.
Steps to reproduce
In the standalone Windows PowerShell console.
Environment data
The text was updated successfully, but these errors were encountered: