The Safe Delete refactoring lets you safely remove files and symbols from the source code.
To make sure that deletion is safe, WebStorm looks for the usages of the symbol being deleted. If such usages are found, you can explore them and make the necessary corrections in your code before the symbol is actually deleted.
Performing the refactoring
- Select the item to be deleted.
Do one of the following:
- Press Alt+Delete.
- Select from the main or the context menu.
- Select Safe Delete. from the main menu (Ctrl+Shift+Alt+T), and select
- In the Safe Delete dialog, select the necessary options and click OK.
If the refactoring is potentially unsafe,
the Usages Detected dialog opens.
Click this button to see where
in your code the item you are about to delete is used.
As a result, the Find tool window opens.
Analyze you code and make the necessary corrections. Then click Do Refactor. (If you want to rerun the refactoring from its start, click Rerun Safe Delete. WebStorm will check if the refactoring is safe once more.)
- Delete Anyway. Click this button to delete the item without looking at its usages.
- View Usages. Click this button to see where in your code the item you are about to delete is used. As a result, the Find tool window opens.