CLion 2017.3 Help

Extract Parameter

The Extract Parameter refactoring is used to add a new parameter to a function declaration and to update the function calls accordingly.


cl extractParameterBefore
cl extractParameterAfter

To extract parameter

  1. In the editor, place the cursor within the expression or local variable declaration to be replaced by a parameter.
  2. Do one of the following:
    • Press Ctrl+Alt+P.
    • Choose Refactor | Extract | Parameter on the main menu or on the context menu.
  3. If more than one expression is detected for the current cursor position, the Expressions list appears. If this is the case, select the required expression. To do that, click the expression. Alternatively, use the Up and Down arrow keys to navigate to the expression of interest, and then press Enter to select it.
    cl extractParameterExpressions
  4. In the:
    1. Specify the parameter name in the Name field.
    2. If more than one occurrence of the expression is found within the function body, you can choose to replace only the selected occurrence or all the found occurrences with the references to the new parameter. Use the Replace all occurrences checkbox to specify your intention.
  5. Preview and apply changes.
    cl extractParameterName
Last modified: 27 March 2018

See Also

External Links: