I have been a huge fan of JetBrain’s IntelliJ IDEA development tool for nearly a decade. I use it almost daily and I love that the makers of this tool have included a path for users to add functionality to the IDE on their own using custom plugins.
One feature that I have missed is SyncEdit which works somewhat like the variable refactoring currently available in IntelliJ. However, where as the current refactoring functionality lets you operate on code variables that the editor recognizes, SyncEdit allows you to highlight a custom range within the editor and then change any word within that range while simultaneously updating any corresponding words that also exist within the selected region.
This feature was available as a plugin which was originally written by Nathan Brown but has not been updated in over six years and simply no longer works with the latest version of IntelliJ. I tried to contact him to get his original source code but I never heard back. Since there was no license on the code and it was published on the IntelliJ plugins site for free, I simply reversed the available plugin, got it working and re-posted it as an open source implementation in hopes that it can be used and improved. (UPDATE: Nathan contacted me and supplied me with his original source so I hope to update the 2.0 codebase soon with anything that I missed)
I have never written an IntelliJ plugin before and you need to understand some of the inner workings of their architecture to truly know what you are doing. However, I was able to get it up and running again and I even tweaked a few thing to get the plugin to select only words instead of subsets of words as the first version did since it seemed to cause more problems than it solved. I was able to find on a few other blogs with some tips on ways to implement SyncEdit and get whole word selection working better. The code certain needs some tweaks but it seems to work at least as well as the previous version and better yet, it is open for anyone else to help improve it.
See the image below for a better idea of how it works. You just highlight a range of code, then select a word and change it. Any other instances of that word will also be updated. It ends up being a more flexible method of find-and-replace. Yes, there are other ways to do this that already exist but I find this way to be very intuitive and easy to execute.
You can get the source code here from GitHub and the plugin file is here. The IntelliJ plugin page is here and is awaiting approval.
Pingback: SyncEdit 2 – An (updated) IntelliJ IDEA Plugin