Graph-based pattern-oriented, context-sensitive source code completion
Abstract
Code completion helps improve developers' programming productivity. However, the current support for code completion is limited to context-free code templates or a single method call of the variable on focus. Using software libraries for development, developers often repeat API usages for certain tasks. Thus, a code completion tool could make use of API usage patterns. In this paper, we introduce GraPacc, a graph-based, pattern-oriented, context-sensitive code completion approach that is based on a database of such patterns. GraPacc represents and manages the API usage patterns of multiple variables, methods, and control structures via graph-based models. It extracts the context-sensitive features from the code under editing, e.g. the API elements on focus and their relations to other code elements. Those features are used to search and rank the patterns that are most fitted with the current code. When a pattern is selected, the current code will be completed via a novel graph-based code completion algorithm. Empirical evaluation on several real-world systems shows that GraPacc has a high level of accuracy in code completion.
BibTeX
@inproceedings{Nguyen-al:ICSE12,
author = {Anh Tuan Nguyen and
Tung Thanh Nguyen and
Hoan Anh Nguyen and
Ahmed Tamrawi and
Hung Viet Nguyen and
Jafar M. Al{-}Kofahi and
Tien N. Nguyen},
title = {Graph-based pattern-oriented, context-sensitive source code completion},
booktitle = {ICSE},
pages = {69--79},
publisher = {{IEEE} Computer Society},
year = {2012},
}