I can\'t figure out how to find and replace all occurrences of a word in different files using Visual Studio Code version 1.0.
I get the impression this should be po
This is the best way.
First put your cursor on the member and click F2.
Then type the new name and hit the Enter key. This will rename all of the occurrences in every file in your project.
This is ideal for when you want to rename across multiple files. For example, you may want to rename a publicly accessible function on an Angular service and have everywhere that uses it get updated.
For more great tools I highly recommend: https://johnpapa.net/refactoring-with-visual-studio-code/
I'm using Visual Studio Code 1.8, and this feature is available. But it's a little tricky to understand at first, and (at the time of writing) the docs don't explain clearly how to use it, so here's how it works, step by step:
Invoke Replace in Files (under the Edit menu, or with shortcut Ctrl+Shift+H)
You'll see a standard Find/Replace input replacing the files pane on the left:
Enter your search string and the replace string, then press enter. It may churn for a second searching all files, then it'll show the proposed changes in all your project files -- but note, these changes haven't been made yet! Here's what it looks like:
Now you need to make the changes (and even after that, you have to save the modified files.)
You can make those changes in various ways:
Click the replace icon next to your replace string (note: you'll get a dialog to confirm this bulk action.)
Click the replace icon next to the filename (note: the icon only shows up when you hover over the filename row)
Click the replace icon next to the individual change: (note: the icon only shows up when you hover over the change row)
All those files are now modified in the editor and not yet saved to disk.
Use File -> Save All (or Ctrl+Alt+S)
Update: I'm not sure when this was added, but if you click the "Replace all" button and see this dialog, clicking "Replace" will change and save all files in one click:
On the Visual Studio Code Key Bindings page, the section Keyboard Shortcuts Reference has links to a PDF for each major OS. Once open, search for "replace in files" or any other shortcut you might need.
Another way is to use the Command Palette (ctrl/cmd+shift+P) where you can type "replace" to list all related commands, including the one you want:
Replace in Files ctrl/cmd+shift+H
To replace a string in a single file (currently opened): CTRL + H
For replacing at workspace level use: CTRL + SHIFT + H
Update - as of version 1.3 (june 2016) it is possible to search and replace in Visual Studio Code. Using ctrl + shift + f , you can search and replace text in all files.
It seems this is not possible at the moment (Version 1.1.1 (April 2016))
"Q: Is it possible to globally search and replace?
A: This feature is not yet implemented, but you can expect it to come in the future!"
https://code.visualstudio.com/Docs/editor/codebasics
This seems also requested by community: https://github.com/Microsoft/vscode/issues/1690
There are 2 methods technically same
First put your cursor on the word and press F2. Replace your word and press Enter.
First put your cursor on the word and left click it. Click "Rename Symbol" option. Replace your word and press Enter.