Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell rename refactor (F2) does nothing in VS Code

Pressing F2 when editing a PowerShell file does nothing in VS Code. (for other languages like C#, Python rename refactor (F2) works fine)

What I've tried:

  • completely uninstalled MS PowerShell extension and reinstalled it, including VS Code restarts
  • checked the Keyboard Shortcuts: PowerShell keybindings are present when PowerShell extension is installed, not present when uninstalled
  • Rename Symbol (editor.action.rename) is bind to F2 (and again, it works for other languages)
  • Edited file extension is .PS1, I can run and debug it, so VS Code recognizes (?) it a PowerShell file
like image 967
g.pickardou Avatar asked Feb 07 '26 13:02

g.pickardou


1 Answers

This is not currently supported by VS Code's builtin PowerShell language support or the non-builtin PowerShell VS Code extension, but there is an open feature-request issue ticket for it: F2 (rename) doesn't work for PowerShell variables #1440, and also "Smart" variable rename #261. I suggest that you give those issue tickets a thumbs up to show support for it. You can also subscribe to them to get notified about discussion and progress. Please avoid making noisy comments there like ones that just consist of "+1" / "bump". If you're interested in helping implement the feature, there's related guidance here.

like image 185
starball Avatar answered Feb 09 '26 03:02

starball



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!