SnipMatch, Top Eclipse Luna Feature #4
Code Recommenders is one of the most exciting and innovative plug-ins available for Eclipse. With standard content-assist, Eclipse will show you all the method calls, variables uses, template options, etc… for the current context. Most of these options are irrelevant, and if you’re learning a new API, all these options can be confusing. Furthermore, listing the code completion options in alphabetical order provides very little value. Code recommenders aims to fix this by displaying the available completion options according to their relevance.
As we enter the final weekend before Eclipse Luna ships, the webmaster is busy moving all the bits into their final location. I’m going to spend some time off the grid, but before I go, I’m going to continue my countdown of The Top 10 Eclipse Luna Features I’m most excited about. Number 4 is SnipMatch, from the code recommenders project.
SnipMatch lets developers search for, and quickly insert, code snippets. API usage is often more than method calls, requiring proper setup, usage and possibly teardown code. With SnipMatch, entire blocks of templated code can be inserted with a single click. To use SnipMatch, install code recommenders and press CTRL+ALT+Space.
There is also a snippets view that shows all the available templates.
By default, the snippets are fetched from a GitRepository (configured in Preferences -> Code Recommenders -> SnipMatch). Of course, you could fork this repository and modify it as you see fit.
Finally, SnipMatch allows you to edit or even add your own snippets using the JFace template language.
Of course, while many of us are getting ready to enjoy the start of summer in the northern hemisphere, the code recommenders team is pushing ahead with more goodness for Luna SR1 (available in September) which includes better tools for creating snippets from existing code blocks.
If you’ve developed an API, consider publishing snippets using SnipMatch to help developers get started. For more Eclipse Tips and Tricks, follow me on Twitter.