.. _Rename Refactoring:

Rename Refactoring
==================


To rename an entity (type, method, macro etc.) in the source code along with all its references, *place the cursor on the desired element*, then **right click** and select :menuselection:`Refactor --> Rename` (or use the shortcut combination :kbd:`Shift + Alt + R`).

You will be prompted for the new name of the entity:

.. figure:: ../../images/vlogdt-refactoring-rename-newname.png



Click *OK* to perform the refactoring, or *Preview* to see the changes that are about to be performed in the source code. In the *Preview* page you can select the changes that should be performed. After you click *Finish* the changes are performed, and the project is rebuilt.

.. figure:: ../../images/vlogdt-refactoring-rename-preview.png



#.  Select a file/change to see the source differences produced by the refactoring.
#.  Uncheck a file/change to prevent those changes from being applied.

.. 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.

Hidden matches are those matches found inside a macro call expansion, but not among the macro call parameters.

.. figure:: ../../images/vlogdt-refactoring-rename-macro-call.png



.. tip:: 

    DVT can also rename matches found in JavaDoc-like annotations, such as **@link**, **@param** and **@see**. This feature is disabled by default, to enable it go to :menuselection:`Window --> Preferences --> DVT --> SystemVerilog --> Refactoring` and untick the *Ignore JavaDoc comments* box.

.. tip:: 

    You can limit the scope of Rename Refactoring to the current file, see :ref:`Rename in File`.

