The Safe Delete refactoring allows you to safely remove files and symbols from the source code.
To safely delete a symbol
- Select the symbol to be deleted.
- Choose Refactor | Safe Delete on the main menu or in the context menu of the selection
or press Alt+Delete.
Alternatively, press Delete in the Project tool window. Then you can either perform a Safe Delete or simply delete the symbol.
Safe Delete dialog box that opens,
specify additional settings for the refactoring:
- To have the changes applied to comments and strings, select the Search in comments and strings check box.
- To have the changes applied to text files (such as documentation, HTML, JSP and other files included in your project), select the Search for text occurrences check box.
- Click OK to continue. If no usages of the symbol are found, the refactoring removes the symbol. If WebStorm finds any occurrences of the symbol in the code, the Usages Detected dialog box appears.
In the Usages Detected dialog box, do one of the following:
- To proceed with refactoring and delete the symbol, click the Ignore button, leaving all the usages of the symbol intact. In this case, to make your code compilable, you have to manually inspect the code and make the necessary corrections.
- To view the list of direct usages of the symbol, click the View usages button. WebStorm stops the refactoring procedure and the displays a list of direct usages of the selected symbol in the Find tool window. Navigate to each usage location and manually correct the code. When ready, click the Rerun Safe Delete button to invoke the refactoring again.