一句话:提出检索式方法 FeaRS,根据 IDE 中当前代码推荐下一个完整方法(签名与实现)。
现有代码补全通常只能推荐接下来几个 token 或若干 API,无法帮助开发者写出完整方法。本文提出 FeaRS,一种基于检索的方法:给定开发者在 IDE 中正在编写的代码,推荐其接下来可能实现的完整方法(包括签名与方法体)。FeaRS 通过挖掘数千个开源项目学习“实现模式”,即通常在同一任务中一起实现的方法组,并将其应用于 Android 应用场景。作者在超过 2 万个应用上进行了大规模实证评估,初步结果令人鼓舞,同时也揭示了未来需要克服的挑战。
Code completion is one of the killer features of Integrated Development Environments (IDEs), and researchers have proposed different methods to improve its accuracy. While these techniques are valuable to speed up code writing, they are limited to recommendations related to the next few tokens a developer is likely to type given the current context. In the best case, they can recommend a few APIs that a developer is likely to use next. We present FeaRS, a novel retrieval-based approach that, given the current code a developer is writing in the IDE, can recommend the next complete method (i.e., signature and method body) that the developer is likely to implement. To do this, FeaRS exploits "implementation patterns" (i.e., groups of methods usually implemented within the same task) learned by mining thousands of open source projects. We instantiated our approach to the specific context of Android apps. A large-scale empirical evaluation we performed across more than 20k apps shows encouraging preliminary results, but also highlights future challenges to overcome.