Graph-based Pattern-oriented, Context-sensitive Code Completion

Anh Tuan Nguyen, Tung Thanh Nguyen, Hoan Anh Nguyen, Ahmed Tamrawi, Hung Viet Nguyen, Jafar Al-Kofahi,
Tien N. Nguyen

Video Demo Downloads

Motivation

 

Most of state-of-the-art code completion tools are able to help in the completion of a single method call or a single object declaration/initialization. For example, Eclipse's code completion provides an alphabetical-order list of available methods for a variable under editing. While some IDEs have done a good job of suggesting the templates for common program constructs (e.g. for, while) and popular classes/methods, it is often that they recommend too many options without ranking and much considering the context of the code under editing.

To support better API usages, it would be preferable to have a code completion tool that can help in completion of code under editing with API usage patterns. Moreover, a good code completion tool should be able to recognize/predict the developer's intention based on the current context of code under editing (e.g. API elements currently used in the incomplete code) in order to provide best-fit API usage patterns. That motivate our approach in Grapacc.

Following are motivating examples for those statements.

  1. Example about API usage patterns,
  2. Example about alternative patterns,
  3. Example about interleaving patterns,
  4. Example about graph-based patterns.