May 9, 2013

GSOC Proposal: Re-Writing SnipMatch Code Completion Engine






I am Madhuranga Lakjeewa. I hope to participate the Google Summer of Code 2013 with Eclipse Code Recommenders SnipMatch project. This is my project proposal. If you have any idea please comment here and i would be glad to hear your feedback.







Abstract

             SnipMatch is a code snippet search tool which falls under Eclipse Code Recommenders. It will be extended as a social snippet sharing tool in which the contributors can create and share snippets with others. Current version of SnipMatch can work only locally with a local snippet repository. But this current SnipMatch version has many problems in architecture level and code level. My proposal is to rewrite SnipMatch code completion engine by eliminating the current drawbacks.

Detailed Information

             Programmers often use code snippets to save their valuable time. But with the intention of time conserving they are wasting considerable amount of time to search good code snippets and customize those snippets to their code context. SnipMatch is the definite solution for this matter.
The core functionality of SnipMatch is providing code snippets quickly and adapting them to the current code context. Following are the major concerns which have been considered at the design of SnipMatch.

  • Snippet repository (Local/Remote)
  • Snippet Saving format
  • Snippet Searching Mechanism
  • Client UI

During last few years SnipMatch has been evolved through several design stages. Those are;

  • SnipMatch with remote repository [1]
  • SnipMatch with remote+local (Synchronized) repositories [2]
  • SnipMatch with social snippet contribution [3]

             SnipMatch with remote repository was the initial idea. But the advantages of having a local repository were noticed later. A remote repository was not suitable for offline and slow internet connection usage. The next design stage was SnipMatch with a local repository which had been synchronized with the main remote repository. The major designs of this stage were discussed at the last year GSoC (GSoC 2012). The Social Snippet is the recent idea which has been immerged with GSoC 2013 idea list. It is about creating a social snippets infrastructure for SnipMatch, which allows developers to create and rate snippets.
Being interested on this idea, I started testing the current version of SnipMatch. As with the original GSoC 2013 idea, this version of SnipMatch should be extended to facilitate social snippet sharing. But I encountered several issues in the current version during the testing period.

1.     Snippet resolution mechanism does not work as intended. It does not support to the standard JFace language format.
         
           JFace template language is the standard Eclipse template language. In SnipMatch, the same language is used for code snippets. Then the code snippets can be easily handled by the JFace library. But the current version of SnipMatch does not support to Eclipse template language.

               Eg: In the SnipMatch snippet templates, Library imports are declared as;
${import(java.util.Arrays)}

               But in the standard forms like SWT statements imports are declared as;
${imp:import(java.util.Arrays)}

Even though SnipMatch core uses its own way of template variable declaration, it triggers errors. [4]

2.     Snippet editor is not user friendly.

                    Current snippet editor is just like a simple text editor. It does not provide color syntax or syntax suggestion for users. And the window is not re-sizable. Whole code should be edited in this small window.


3.     Snippet search pop-up dialog does not work properly.

                   Eg: Some times it does not give any suggestion, though we type a search pattern.

Above problems are not all the problems SnipMatch current version exhibits.  Those are the problems I could found.

             I discussed the above problems in the Bugzilla bug entity [5].  There is no point of extending the current version of SnipMatch without addressing the existing problems. It is not a simple task since reasonable architecture level and code level changes may be required for this. For an example, to solve the above 1st problem SnipMatch core should be re-written.
             This is my proposal for GSoC 2013. I will rewrite the SnipMatch code completion engine by eliminating the current problem. I am limiting my project scope to code completion engine. To achieve the ultimate goal of SinpMatch Social Sharing System, I believe that we should have a SnipMatch version which is perfectly functioning in local mode. My goal is to create the SnipMatch completion engine which is working 100% with a local snippet repository.

Technology

             Eclipse Rich Client Platform (RCP) is the main technology which I will be using. In addition to that I will get the help of Java language and its’ related technologies. I will use Eclipse Plug-in Development Environment (PDE) as my development environment.

Preparing Background

             Until GSoC program get started, I am expecting to do several background tasks. I want to test the current version of SnipMatch further and find more problems it has. I will create a detailed list of existing problems and potential solutions, which will assist me to re-design the SnipMatch architecture. In addition to that I will continue my studies on Eclipse RCP development.

Deliverables

             SinipMatch completion engine is my main output. It will produce all the functionalities locally with a local snippet repository which the ultimate SinpMatch snippet sharing system required. Following features will be included in my final output.

  • SnipMatch preference window.
                     This window will provide the functionalities which are required to configure SnipMatch. In addition to that there will be entry in the 'Colors and Fonts' section in 'General->Appearance' for SnipMatch. It will allow users to change the colors and fonts in SnipMatch search view.

  • SnipMatch search view.
                    Drop down search view with suggestions. A preview will be shown with the user ratings.

  • SnipMatch search engine.
                     A good search engine with more intelligent suggestions. Apache Lucene is a potential technology which this search engine will be based on.

  • Snippet insertion mechanism.
                     Snippets in JFace language format will be inserted to the code with code context based changes.

Schedule

  • 17 June – 23 June (1 week)
                      Defining snippet serializing template format and finalize high level architecture

  • 24 June – 07 July (2 weeks)
                      Creating SnipMatch preference window

  • 08 July – 28 July (3 weeks)
                      Implementing snippet search view

  • 29 July - 18 August (3 weeks)
                      Implementing snippet search engine

  • 19 August - 08 September (3 weeks)
                       Implementing code context adaptation of snippets (Snippet insertion mechanism)

  • 09 September – 16 September (1 week)
                      Testing and finalizing

Expectations

             I am expecting a mentor who is accessible and responsive. As I do not have a vast knowledge about the technologies related to Eclipse plug-in development, I like if my mentor can introduce me new technologies when it is applicable. Then I can learn myself and use them properly.


References

[1]. Doug Wightman,Zi Ye,Joel Brandt, Roel Vertegaal “SnipMatch: Using Source Code Context to Enhance Snippet Retrieval and Parameterization” [Online] Available:http://joelbrandt.org/publications/wightman_uist2012_snipmatch.pdf
[2]. “Merge and improve SnipMatch into Eclipse Code Recommenders” [Online] Available:https://code.google.com/p/snipmatch/wiki/Merge_SnipMatch_into_Recommeners_project_proposal
[3]. “Google Summer of Code 2013 Ideas Eclipse Code Recommenders: Social Snippets” [Online] Available:http://wiki.eclipse.org/Google_Summer_of_Code_2013_Ideas#Eclipse_Code_Recommenders:_Social_Snippets
[4]. Bugzilla Comment 44 [Online] Available: https://bugs.eclipse.org/bugs/show_bug.cgi?id=401771#c44
[5]. Bugzilla Bug 401771 - [gsoc] Social Snippets [Online] Available: https://bugs.eclipse.org/bugs/show_bug.cgi?id=401771