Rename File

Renaming a file will automatically update its references across the project, such as include directives.

There are multiple ways to perform this operation.

  • From the Project Explorer
    • Right click on a file and select Rename…

../../_images/sv-refactoring-rename-file-project-explorer.png

Tip

You can also press F2 after selecting a file.

  • Inside an Editor
    • Place your cursor inside the editor, Right click and then select Refactor > Rename File to rename the current file.

    • Place your cursor on an included file name, Right click and then select Refactor > Rename File to rename the included file.

../../_images/sv-refactoring-rename-file-editor-included.png

You will be prompted to choose a new name for the selected file.

../../_images/sv-refactoring-rename-file-new-name.png

Click OK to perform the refactoring operation, or Preview to see the changes that are about to be performed in the source code. In the Preview page you can select which changes will be performed, and then click Finish.

(1) You can select a file/change to see the source differences produced by the refactoring.

(2) Uncheck a file/change to prevent those changes from being applied.

../../_images/sv-refactoring-rename-file-preview.png

Tip

Matches hidden inside a macro call cannot be automatically renamed. Instead, DVT will insert a FIXME comment above the macro call to indicate that it should be refactored by hand.

(1) These matches are marked with the tag Inside Macro.

(2) You can apply a filter to list only this type of matches.

../../_images/sv-refactoring-rename-file-macros.png