PowerShell / PowerShell/vscode-powershell

Alias expansion should move cursor to end of command name

Open
#5,136 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug Up for Grabs
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the alias-expansion command and its Alt+Shift+E keybinding in the extension, then reproduce the behavior with cd|. Done means expanding the alias places the cursor after the full command name, with any spacing behavior resolved by the implementation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.