In recent years, several industrial solutions for the problem of multi-token code completion appeared, each making a great advance in the area but mostly focusing on cloud-based runtime and avoiding working on the end user's device. In this work, we describe our approach for building a multi-token code completion feature for the JetBrains' IntelliJ Platform, which we call Full Line Code Completion. The feature suggests only syntactically correct code and works fully locally, i.e., data querying and the generation of suggestions happens on the end user's machine. We share important time and memory-consumption restrictions, as well as design principles that a code completion engine should satisfy. Working entirely on the end user's device, our code completion engine enriches user experience while being not only fast and compact but also secure. We share a number of useful techniques to meet the stated development constraints and also describe offline and online evaluation pipelines that allowed us to make better decisions. Our online evaluation shows that the usage of the tool leads to 1.3 times more Python code in the IDE being produced by code completion. The described solution was initially started with a help of researchers and was then bundled into all JetBrains IDEs where it is now used by millions of users. Thus, we believe that this work is useful for bridging academia and industry, providing researchers with the knowledge of what happens when complex research-based solutions are integrated into real products.
翻译:近年来,针对多标记代码补全问题出现了若干工业解决方案,各自在该领域取得了重大进展,但大多聚焦于基于云的运行时环境,避免在终端用户设备上运行。本研究阐述了为JetBrains IntelliJ平台构建多标记代码补全功能的方法,我们称之为"全行代码补全"。该功能仅建议语法正确的代码,并完全在本地运行,即数据查询与建议生成均在终端用户机器上完成。我们分享了关键的时间与内存消耗限制,以及代码补全引擎应满足的设计原则。我们的代码补全引擎完全在终端用户设备上运行,在确保快速、紧凑的同时兼具安全性,从而提升了用户体验。我们提出了多种满足既定开发约束的实用技术,并描述了支持我们做出更优决策的离线与在线评估流程。在线评估表明,该工具的使用使得IDE中通过代码补全生成的Python代码量提升了1.3倍。所述解决方案最初在研究人员的协助下启动,现已集成至所有JetBrains IDE中,为数百万用户所使用。因此,我们相信这项工作有助于连接学术界与工业界,让研究者了解基于复杂研究的解决方案集成至实际产品时所需面对的现实挑战。