DVT IDE for VS Code VHDL User Guide
Rev. 22.1.36, 22 November 2022

Chapter 12. 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 and use the "Rename Symbol" command.

Provide the new name of the entity and click Enter to perform the refactoring operation or Shift + Enter to preview and select the changes that should be performed in the source code.

Tip: Matches hidden inside a macro call (matches found inside a macro call expansion, but not among the macro call parameters) cannot be automatically renamed.

Instead, DVT will insert a FIXME comment above the macro call to indicate that it should be refactored by hand.


Rename in File

To rename a variable, signal, method, etc. within the current file, select the name of the element and use the "Replace" command. Write the new name and choose to replace occurrence by occurrence or all of them at once.

This is a lightweight Rename Refactoring which you should use in contexts where the renamed element is local to the file: local parameters, method argument names, local variables, signals of a module, etc.


Extract to Variable

To extract an expression inside a function or task to a local variable, select the expression, run the "Refactor..." command and select "Extract to local variable".

Provide a name for the new variable, which is declared and initialized with the extracted expression in the correct scope.


Add New Port to Entity

To add a new port to an entity, place the cursor on the entity name, run the "Refactor..." command and select "Add port".

After tuning the name, direction, type, and width of the new port, an empty port connection is added to all the instances of the selected module along with a FIXME comment.


Add New Generic to Entity

To add a new generic to an entity place the editor cursor on the entity name, run the "Refactor..." command and select "Add generic".

After tuning the name, type, width and the default value of the new generic, an empty generic is added to all the instances of the selected entity along with a FIXME comment.