vscode-powershell
vscode-powershell copied to clipboard
Parameter Intellisense should include parameter aliases
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been reported.
Summary
Example: Get-Childitem -System has a parameter alias so it can also be referenced as -as, this should show up as a valid autocomplete, and maybe have an option to auto-translate the parameter to its non-aliasesd name (though format-on-save should do this so maybe not necessary)
Proposed Design
<The above should also show "as", maybe with an indicator that shows it's an alias to System>
(I'm about to explain some things, but I don't think this should be closed. I don't know of a good way to fix it off the top of my head though, so I'm just going to explain)
This is sort of a weird quirk both in how PowerShell decides to include aliases in tab completion and in how VSCode requests intellisense.
So PowerShell only includes aliases once you've typed at least one character that matches it. e.g. even in the console if you do gci -<tab> you won't see aliases. But gci -a<tab> and you'll see them.
VSCode only requests intellisense results when a trigger character is typed. If you continue typing after the initial trigger character, it won't request new results from the LSP but instead just filter the existing list.
Put these two things together and you end up never receiving aliases as intellisense unless you explicitly request intellisense (e.g. Ctrl + Space) at a non-trigger character.
@SeeminglyScience fair point, maybe have it go ahead and retrieve aliases that start with that same initial character so that it can continue to filter? I can't remember if for a completion parameter you can have both a "display" and an "actual" value.
Issue is we get all of our intellisense directly from PowerShell (SMA.CommandCompletion.CompleteInput method). So if we want to do something different than what PowerShell does already, we have to reimplement a lot of what it does before we can get to a point where we can inject something of our own.