Skip to content

Rename Service Settings (F2 in Preview 2026.1.1) changes splatting variable #2324

Closed

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

The variable $SplatProcessss has a typo. It is also used for splatting later in the code


$SplatProcessss = @{
FilePath = 'C:\Windows\system32\cmd.exe'
}

Start-Process @SplatProcessss


Pressing F2 to rename the variable to SplatProcess results in changing the splatting variable to $SplatProcess instead of @SplatProcess

$SplatProcess = @{
FilePath = 'C:\Windows\system32\cmd.exe'
}

Start-Process $SplatProcess <--- wrong

Expected result renaming the variable


$SplatProcess = @{
FilePath = 'C:\Windows\system32\cmd.exe'
}

Start-Process @SplatProcess <--- correct


Thank you for the great feature

PowerShell Version

PS C:\> $PSVersionTable; $Host

Name                           Value                                                                                                                                                                            
----                           -----                                                                                                                                                                            
PSVersion                      5.1.26100.8655                                                                                                                                                                   
PSEdition                      Desktop                                                                                                                                                                          
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                          
BuildVersion                   10.0.26100.8655                                                                                                                                                                  
CLRVersion                     4.0.30319.42000                                                                                                                                                                  
WSManStackVersion              3.0                                                                                                                                                                              
PSRemotingProtocolVersion      2.3                                                                                                                                                                              
SerializationVersion           1.1.0.1                                                                                                                                                                          

Name             : Visual Studio Code Host
Version          : 2026.1.1
InstanceId       : 9c176ed1-2a2d-4562-b60e-cf1e6c8f9775
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : de-CH
CurrentUICulture : de-DE
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

PS C:\> code --version
1.125.1
fcf604774b9f2674b473065736ee75077e256353
x64

Extension Version

PS C:\> code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2026.1.1

Steps to Reproduce

See summary

Visuals

No response

Logs

No response

Activity

  1. added
    Issue-Bug
    Needs: Triage
    on Jun 23, 2026
  2. github-actions commented on Jun 23, 2026

    @github-actions

    Rename (textDocument/rename) drops the @ splat sigil when renaming a splatted variable — genuine, actionable bug.

    For maintainers

    Reproducibility
    High confidence. The report is self-contained: minimal before/after code snippet, unambiguous expected vs. actual output, and full version details (PS 5.1.26100.8655, VS Code 1.125.1, extension 2026.1.1). No missing information.

    Copilot-fix suitability
    Maybe. The bug is well-scoped and clearly defined: renaming a variable that is used as a splat argument (@VarName) incorrectly replaces the @ sigil with $. However, the rename edit list is computed by PowerShellEditorServices (the textDocument/rename LSP handler), not by this extension — the extension only proxies the request. A fix would need to target the PSES repo, making it a poor fit for a Copilot fix here.

    Likely area
    PowerShellEditorServices — the rename handler that produces WorkspaceEdit text edits. PSES likely uses the variable name without distinguishing $var (assignment/regular reference) from @var (splat) call sites, so the sigil is not preserved. The relevant code is probably in src/PowerShellEditorServices/Services/TextDocument/Handlers/RenameHandler.cs or the rename/refactoring subsystem of PSES.

    Reproduction steps (inferred)
    1. Open a new .ps1 file and paste:
      $SplatProcessss = @{
          FilePath = 'C:\Windows\system32\cmd.exe'
      }
      Start-Process `@SplatProcessss`
    2. Place the cursor on $SplatProcessss.
    3. Press F2 and rename to SplatProcess.
    4. Actual: @SplatProcessss → $SplatProcess (sigil changed).
    5. Expected: @SplatProcessss → @SplatProcess (sigil preserved).
    Related issues

    Generated by Agentic Issue Triage for issue #2324 · 54.5 AIC · ⌖ 12.8 AIC · ⊞ 23.9K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@2f03fdaafb8c1ae62dfde7e0be762a822a201aeb
    
  3. JustinGrote commented on Jun 23, 2026

    @JustinGrote
    Collaborator

    Thanks Jürg Steiger (@juergsteiger)! Surprised I missed that.

    @copilot prepare a test to replicate the behavior and a PR to resolve it.

  4. JustinGrote commented on Jun 23, 2026

    @JustinGrote
    Collaborator

    Whoops meant to direct this to PSES

  5. removed
    Needs: Triage
    on Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugOS-Windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions