Extract parameter
Refactor | Extract/Introduce | Parameter
CtrlAlt0P
The Extract Parameter refactoring is used to add a new parameter to a function declaration and to update the function calls accordingly.
Extract Parameter uses either the default type value or the value with which the variable is initialized.
The following demo illustrates the usage of the Extract parameter refactoring, as well as Extract function, Extract lambda parameter, and Live templates:
Place the caret inside an expression or variable declaration to be replaced by a parameter.
Press CtrlAlt0P or select Refactor | Parameter from the main menu or the context menu.
If several expressions are detected for the current caret position, select the required option from the list:
Specify the parameter name in the popup.
Preview and apply the changes.
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Thanks for your feedback!