PowerShellEditorServices
PowerShellEditorServices copied to clipboard
Completion for parameter aliases
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been requested.
Summary
It appears that it does not provide prompt for parameter aliases such as -Target as an alias for -Value in New-Item command.
Proposed Design
No response
The completion values comes from PowerShell itself and it intentionally leaves out parameter aliases if the real parameter is available in the completion result list. If you type in New-Item -T<Tab> you should get Target as one of the available options.
The idea behind this design is simple: It declutters the completion result list and it encourages the use of the real parameter names. Why do you want to use the alias over the real value?
I just think it should be available anyway. Sometimes alias is more readable such as when you create a symlink with -Target instead of -Value. And I wonder how could I do -T<Tab> in neovim, is it builtin for vscode extension or ISE? I'm not familiar with lsp, I guess it should be a trigger character or something?
<Tab> represents hitting the tab key to tab complete the text. So whatever method you use to trigger completions in neovim should be triggered after you've typed -T.
Yeah, there's no -Target in the list when after -T so I thought maybe I missed something
PS C:\> (TabExpansion2 'New-Item -t').CompletionMatches
CompletionText ListItemText ResultType ToolTip
-------------- ------------ ---------- -------
-Type Type ParameterName [string] Type
-Target Target ParameterName [Object] Target
PS C:\>
Most likely the completion request is triggered by neovim when you type - and then it filters the results locally, which would give you this:
PS C:\> (TabExpansion2 'New-Item -').CompletionMatches
CompletionText ListItemText ResultType ToolTip
-------------- ------------ ---------- -------
-Path Path ParameterName [string[]] Path
-Name Name ParameterName [string] Name
-ItemType ItemType ParameterName [string] ItemType
-Value Value ParameterName [Object] Value
-Force Force ParameterName [switch] Force
-Credential Credential ParameterName [pscredential] Credential
-WhatIf WhatIf ParameterName [switch] WhatIf
-Confirm Confirm ParameterName [switch] Confirm
-Verbose Verbose ParameterName [switch] Verbose
-Debug Debug ParameterName [switch] Debug
-ErrorAction ErrorAction ParameterName [ActionPreference] ErrorAction
-WarningAction WarningAction ParameterName [ActionPreference] WarningAction
-InformationAction InformationAction ParameterName [ActionPreference] InformationAction
-ProgressAction ProgressAction ParameterName [ActionPreference] ProgressAction
-ErrorVariable ErrorVariable ParameterName [string] ErrorVariable
-WarningVariable WarningVariable ParameterName [string] WarningVariable
-InformationVariable InformationVariable ParameterName [string] InformationVariable
-OutVariable OutVariable ParameterName [string] OutVariable
-OutBuffer OutBuffer ParameterName [int] OutBuffer
-PipelineVariable PipelineVariable ParameterName [string] PipelineVariable
PS C:\>