12

I've been quite happy with my purchase of Sublime Text 3 for developing and, either natively or through extensions, this piece of software covered almost all of my needs.

The one thing I found myself wanting for, however, was a way to do refactorings, for example through PyRope or better. There is already a PyRope extension for ST3, but it doesn't actually use the refactoring backend. The ST2 version does have this support, but it is not robust at all and often fails without a clear error message.

What I'm looking for:

  • I don't want to learn vim or emacs just to refactor code — unless the plugin is so simple you can explain how to use it in the body of your answer. Sorry.
  • I don't want to set up workspaces, project files and the such just to refactor code. The tool should work with an existing file structure.
  • Bonus points for coming with .deb packages.
  • More bonus points for being in the Ubuntu repos (at least Trusty's)
  • All of the bonus points if it's actually an ST3 plugin.

Non-goals:

  • It doesn't have to use PyRope, but it should at least have "extract function".
  • It doesn't even have to be a text editor. Even just a program like this would be sufficient:

    py-refactor extract-function myNewFunction \
                --from mycode.py:42:60 \
                --dry-run
    
  • I could easily explain how to use VimRope, or Bicycle Repairman in my answer, what I couldn't do is explain how to use Vim, in my answer. – Lyndon White Feb 12 '14 at 5:19
  • @Oxinabox That's what I asked. :) – badp Feb 12 '14 at 8:14
  • So you are ok with an answer that is a Vim Plugin? – Lyndon White Feb 12 '14 at 8:15
  • @Oxinabox So long as the answer is sufficiently detailed, yes... I know the basics of vim (enough to set the networking and repositories of a system and then go install nano :P), but I've never dealt with a plugin before. – badp Feb 12 '14 at 8:19
3

Note: I am the co-founder of Wingware, makers of Wing IDE for Python

You could try Wing IDE, which has refactoring operations for renaming, moving, extracting code to a function or method, and introducing variables. It is a whole IDE but starts quickly, is very configurable (e.g., you can hide things you're not interested in), and reloads code from disk automatically, so you could use it side by side with another editor.

You do need to make sure Wing (and I think any refactoring tool) knows what the Python Path is, if your code is not all in the same directory. Otherwise it cannot know for sure which module an import refers to and thus may miss uses of a symbol you are changing. This may not be relevant in your source base, but is still worth being aware of.

To address your other requirements: Wing has various keyboard personalities and doesn't require you know emacs or vim. It comes as a .deb (and in other forms) but isn't in the Ubuntu repository and your refactoring engine isn't available as a ST3 plugin (sorry!).

  • This is "Software Recommendations". Are you recommending this from personal experience, or simply reporting what you believe to be true about this? – Ira Baxter Feb 19 '14 at 8:34
  • @IraBaxter He's on the dev team – Fractaliste Feb 26 '14 at 8:16
  • @Fractaliste: Good. Now at least his experience and connection with it are clear. – Ira Baxter Mar 3 '14 at 13:48
  • Thanks for clarifying that. Sorry, this was my first post here and I did it from the wrong account. – Wingware Mar 4 '14 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.