CompletionPredictor icon indicating copy to clipboard operation
CompletionPredictor copied to clipboard

Cannot repurpose the alias 'dir' as a custom user alias

Open RalfReddings opened this issue 2 years ago • 1 comments

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, especially the pinned issues.

Exception report

[no errors are output in my issue]

Screenshot

Environment data

PS Version: 7.3.4
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.3.4
PSReadLine EditMode: Windows
OS: Windows 11
BufferWidth: 172
BufferHeight: 32

Steps to reproduce

The Alias dir which is by default is assigned to get-childitem cannot be repurposed by the user to something else, of their own choosing.

  • Remove the default dir alias with `Remove-Alias -Name dir
  • Assign the alias dir to another command `set-alias -Name dir -Value start-process
  • Type dir then space and try to tab to get parameter suggestions

PsReadline suggests get-childitem parameters instead of the parameters for get-process such as filepath.

The alias is bound to get-process, which can be confirmed by just executing dir.

I have been having this issue with older PsReadline versions too.

Of course, it makes no sense to assign dir to get-process, its just an example, I want to use dir for my own command. Cheers

Expected behavior

When I use dir, I am expecting the parameters for get-process to be suggested instead of get-childitem

Actual behavior

[I dont understand this section]

RalfReddings avatar Nov 13 '23 13:11 RalfReddings

Transferring to CompletionPredictor repo, this module may not unwrap the aliases properly to get the right tab completion.

StevenBucher98 avatar Nov 13 '23 21:11 StevenBucher98