论文标题
将嵌入代码与静态分析相结合,以完成功能通话完成
Combining Code Embedding with Static Analysis for Function-Call Completion
论文作者
论文摘要
代码完成是集成开发环境(IDE)的重要特征。它允许开发人员更快地生成代码,尤其是新手的代码,他们对API和其他代码不完全熟悉。先前关于代码完成的工作主要利用了使用COMMON API的开发项目或其他项目的编程语言或代码历史记录的静态类型系统。在这项工作中,我们使用众所周知的自然语言处理模型(可以学习源代码的向量表示(代码嵌入)),通过从独立的代码存储库中学习来改善当前功能通话完成工具的新颖方法。我们的模型未经过特定项目的历史数据培训。取而代之的是,我们的方法允许在数千个项目中学习高级概念及其关系。结果,结果系统能够提供不具体的特定项目或API的一般建议。此外,通过考虑完成呼叫的上下文,我们的方法提出了与该上下文相关的函数调用。我们评估了在培训期间看不见的一系列开源项目的方法。结果表明,训练有素的模型以及基于静态类型分析的代码建议插件的使用可显着提高完成建议的正确性。
Code completion is an important feature of integrated development environments (IDEs). It allows developers to produce code faster, especially novice ones who are not fully familiar with APIs and others code. Previous works on code completion have mainly exploited static type systems of programming languages or code history of the project under development or of other projects using common APIs. In this work, we present a novel approach for improving current function-calls completion tools by learning from independent code repositories, using well-known natural language processing models that can learn vector representation of source code (code embeddings). Our models are not trained on historical data of specific projects. Instead, our approach allows to learn high-level concepts and their relationships present among thousands of projects. As a consequence, the resulting system is able to provide general suggestions that are not specific to particular projects or APIs. Additionally, by taking into account the context of the call to complete, our approach suggests function calls relevant to that context. We evaluated our approach on a set of open-source projects unseen during the training. The results show that the use of the trained model along with a code suggestion plug-in based on static type analysis improves significantly the correctness of the completion suggestions.