Coding is an integral aspect of programming. A programmer can automatically complete a code fragment after writing a few tokens, and the process of automatic completion is known as code completion. Several research studies on code completion have previously been conducted for method body completion and method parameter completion. However, this fundamental study explores the automatic completion of any program statement that might not even be part of a method.
The goal is to provide suggestions to the programmer for completing code throughout the codebase by identifying and analyzing code similarities. The proposed methodology can be regarded as a fundamental framework for automated code completion. From the investigation of hundreds of revisions of four subject systems written in C and Java, it is observed that the proposed method can automatically complete around 22% of code statements with an average accuracy of 87% that a programmer writes during development, accelerating software development time. The empirical analysis further demonstrates that the approach can be used with programming language neutrality.
The study concludes by illustrating that taking 10 characters as prefixes before invoking completion provides maximum precision.
CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completion
Key Laboratory of Multimedia Trusted Perception and Efficient Computing Ministry of Education of China(教育部多媒体可信感知与高效计算重点实验室);Xiamen University(厦门大学);Ant Group(蚂蚁集团)
CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequences
Delft University of Technology(代尔夫特理工大学)
代码完成是IDE的一个基本功能,但当前的自动完成器仅限于基于语法或基于NLP的单个标记完成。这两种方法都有明显的缺点:基于语法的自动完成在动态类型语言环境中受到限制,而基于NLP的自动完成程序很难理解程序设计语言的语义和开发人员的代码上下文。在这项工作中,我们提出了CodeFill,一个语言模型自动完成,结合了学习的结构和命名信息。使用并行Transformer架构和多任务学习,CodeFill使用源代码标记名称序列及其等效的AST标记类型。独特的是,CodeFill针对单标记和多标记(语句)预测进行了训练,这使其能够学习语法和命名元素之间的长期依赖关系。我们在两个数据集上训练CodeFill,分别由29 M和425 M行代码组成。为了使评估更加真实,我们开发了一种方法来自动推断源代码中的完成点。我们将CodeFill与四个基线和两个最先进的模型GPT-C和TravTrans+进行了比较。CodeFill在单令牌预测方面超过了所有基线(MRR:70.9% vs. 66.2%和67.8%),并且在多令牌预测方面优于最先进的模型(ROUGE-L:63.7% vs. 52.4%和59.2%,n=4个令牌)。我们公开发布我们的源代码和数据集。
Don't Complete It! Preventing Unhelpful Code Completion for Productive and Sustainable Neural Code Completion Systems
Singapore Management University(新加坡管理大学);Monash University(莫纳什大学);Key Laboratory of System Software (Chinese Academy of Sciences)(中国科学院系统软件重点实验室);State Key Laboratory of Computer Science(计算机科学国家重点实验室);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学);Nanjing Institute of Software Technology(南京软件技术学院);National University of Defense Technology(国防科技大学);University of Technology Sydney(悉尼科技大学);Beihang University(北京航空航天大学)