How to Refactor a Method Signature in the DVT IDE for VS Code
Overview
This video shows how you can easily add, remove and reorder the arguments of a function or task in the DVT IDE for VS Code.
This video was show using DVT 24.1.1 and VS Code 1.81.1
Details
Introduction
In the DVT IDE, you can easily add, remove, and reorder arguments of a function or task.
Adding a New Argument
To add a new argument, start by placing the editor cursor on a method name, either on its declaration or on a method call.
Then run the Refactor
command and choose Add Argument
from the pop-up list.
Enter the new argument type, its name, and the value to be used in existing calls.
Note that the argument was added both in the extern declaration and in the out-of-body implementation of the function, and that all existing function calls got updated as well.
Reordering Method Arguments
To reorder method arguments, place the cursor on an argument name, run the Refactor
command and choose Change Position of Argument
.
Then use the up
and down
arrow keys to set the new position and press Enter
when done.
Removing an Argument
Now let's take another example for removing an argument.
Note that this task has two overrides in UART monitor subclasses
.
Simply run the Refactor
command and choose Remove Argument
.
Note that all task declarations across the whole object-oriented inheritance tree, as well as the task calls, were automatically updated.