Speak and Shout

Tuesday, February 06, 2007

Komodo Hacks: Extract Method

Today's hack allows you to highlight a section of existing Python code in Komodo and refactor it into its own separate method.

Like yesterday's hack, Extract Method uses Bicycle Repair Man for its functionality. If you didn't catch the procedure for including the BRM package into Komodo, see my last post.

You can download the macro here. Install it into Komodo by using the Import Package option under the Toolbox menu.

Usage notes:
  • Just highlight a section of code, and double-click on the Extract Method macro in the toolbox. The macro will prompt you for the name of the new method and then perform the refactoring operation.
  • Before refactoring, Komodo will prompt you to save your file if necessary. (This is a requirement of BRM.)
  • After refactoring, Komodo will tell you that your file has changed and prompt you to reload it. Go ahead! You should see your changes in the updated file. If you don't like what you see, you can Undo the changes, via the Edit menu or CTRL-Z.
One more BRM macro to go, coming tomorrow!

Labels: , , ,

2 Comments:

  • Very cool - this is the refactoring I use the most.
    This makes Komodo even more favourable for Python editing.

    By Anonymous Hanno Stock, At 8:31 AM  

  • Has anyone gotten this working on Komodo 4.3? (Specifically the IDE version under Linux.)

    By Anonymous Anonymous, At 9:07 PM  

Post a Comment



<< Home