Skip to content

Alias expansion should move cursor to end of command name #5136

Open
@quantumfrost

Description

@quantumfrost

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

After typing an alias, if you press Alt + Shift + E to replace it with the full command name, the cursor remains at the original position. It should be moved to the end of the command so you can continue typing.

For example (| denotes the cursor):
cd| > Press expansion shortcut > Se|t-Location

I cannot think of a use case where leaving the cursor in the middle of the command name would be desirable. In fact, inserting a space after the command name (if there isn't already) may be desirable too.

PowerShell Version

PowerShell 7.4.7
Ubuntu 24.04.1 LTS

Visual Studio Code Version

1.96.4

Extension Version

ms-vscode.powershell@2025.0.0

Steps to Reproduce

| denotes the cursor:
cd| > Press alias expansion shortcut Alt + Shift + E > Se|t-Location

Expected:
Set-Location|
Perhaps also insert space after command name, if there isn't one already

Visuals

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Wishlist

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions