Search code examples
visual-studio-code

Does "Rename Symbol" work across files when editing JavaScript?


Does the "Rename Symbol" feature work across files, when editing JavaScript? Currently it's only working within the current file being edited. I seem to recall it working across files, though. It would open all the files that it had made changes to. It's no longer doing that, though.

Am I remembering incorrectly or does it work this way?


Solution

  • The feature Rename Symbol only works for the current file. But there is another feature, which fits your description: Replace in Files (Menu Bar: Edit > Replace in Files).

    From Visual Studio Code User Guide:

    You can also Search and Replace across files. Expand the Search widget to display the Replace text box.

    When you type text into the Replace text box, you will see a diff display of the pending changes. You can replace across all files from the Replace text box, replace all in one file or replace a single change.

    For a quick use you can select a word in your source and hit Ctrl+Shift+H.