Extract Function / Method

Index of All Documentation » Wing Pro 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 extracted in the editor and then select Extract Function/Method from the Refactor menu or from the Refactor sub-menu of the editor's right-click context menu. 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 Enter or click on 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.