Refactoring JavaScript Files

You can find all usages of a variable or operation within a product. After finding these usages, you can rename all occurrences of the variable or operation and refactor throughout the product. Before performing the refactoring, you can preview the changes in a split screen UI.

To find and rename all usages of a variable or operation:

  1. Select an occurrance of the variable or operation in the editor.
  2. Select Edit > Find Usages (Alt-F7). You have the option of searching the comments as well as the active code. The Usages view opens, showing a tree view of all usages of the variable or operation.
  3. Select the variable in the editor again and select Refactor > Rename (Ctrl-R/Command-R). A dialog box opens in which you type the new name.
  4. Click Preview. The Refactoring view opens with a tree view of replacements on the left and a split screen of the original and refactored file on the right.
  5. You can choose not to rename the variable or operation in indiviual places. Deselect the individual renaming in the tree view on the left.
  6. After review, click Do Refactoring and the IDE refactors all files.

Instant Rename

Press Ctrl-R/Command-R on a local variable and you can rename the symbol synchronously throughout the file.


Legal Notices