Extract Function / Method


Home » Support » Index of All Documentation » Wing IDE Reference Manual » Refactoring »

The extract function / method operation creates a new function or method from the currently selected lines. It replaces the lines with a call to the new function or method, passing in needed arguments and returning any values needed in the calling block of code.

To start an extract operation, select the lines to be extract in the editor and then select Extract Function/Method from the Refactor menu or from the Refactor sub-menu of the editor context menu (right-click). Wing will then display the Refactoring tool. To complete the operation, enter the name for the new function or method, select the scope in which to define it, and press the Extract button.

After it completes, the extract operation can be undone with the Revert button in the Refactoring tool.

Note that the extract operation currently cannot extract lines that contain return statements before the final line.

« 6.1. Move SymbolTable of Contents6.3. Introduce Variable »