During the summer of 2013, Google sponsored the Eclipse Code Recommenders project with five Google Summer of Code (GSOC) student projects. Mentored by staff at Codetrails and Fabian Steeg, the students all successfully completed their objectives.
In this blog post, I want to present the Snipmatch project, which is organized into two parts: a snippet search and completion plugin by Madhuranga Lakjeewa and a snippet editor by me, Stefan Prisca.
Snipmatch is a search tool for quickly finding and inserting code snippets into your code, that is tightly integrated into the code completion of the Eclipse IDE. All you need to do is press CTRL+Enter (or CMD+Enter on a Mac) to open the Snipmatch search box, type your search keywords such as "button", select the code snippet that fits your needs and press enter. The code will be inserted into your editor at the cursor position.
Placeholders defined in the inserted snippet are automatically replaced with existing variables and fields that match the placeholder type.
The search dialog allows the use of “+” and “-” operators to narrow your search.
All available snippets can be found in the snippets view, available under Window->Show View->Other->Recommenders->Snippets.
Snippets can also be edited. Double click on a snippet from the SnippetsView which launches the snippet editor pop-up.
On the first page you can edit the code contained in snippets using the JFace template language. The editor offers syntax highlighting for both Java as well as template language keywords.
On the second page you can edit additional information about the snippets including its name, description and search phrases.
For a more in-depth look at Snipmatch please refer to our Documentation.