Code Completion using Language Model and Code Template

Automatic code completion helps the developer to write code efficiently and effectively. Developer spends much time on writing same code repetitively throughout the life cycle of the project development. We can think of such repetitive code snippet as code template, which serves a single or some limited number of functionalities. Some modern code editor provides an option for the developer to save code template manually so that they can reuse those code when needed. Maintaining such code templates and uses it manually is difficult for the developer. The language model is suitable to capture repetitiveness of source code and on the other hand, code a template can capture structural information for a big chunk of repetitive code. In this work, we proposed a novel approach for this code completion task leveraging language model and code template. Our preliminary result shows the effectiveness of using Neural Network based language models such as RNN, LSTM, Bidirectional LSTM over n-gram based language model. We also discuss potential ways of using templates to improve the performance of the language models as well as code completion.

Project Report