Font Size: a A A

Code Completion Based On Local And Global Relationships In Abstract Syntax Tree

Posted on:2022-10-25Degree:MasterType:Thesis
Country:ChinaCandidate:W Y TangFull Text:PDF
GTID:2518306725993189Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
Integrated development environments(IDEs)play an important role in modern software engineering,and code completion is one of the IDEs' most important functions.Intelligent code completion,predicts the next token with the highest possibility to be chosen and uses it as a recommended completion item,thereby improving the programming efficiency of software developers.In recent years,machine learning techniques are widely used in code completion tasks,and representing the code context as a sequence and processing it with a language model is the mainstream among them.Language models based on deep learning can use long context,however,neglect some important relationships among context tokens or abstract syntax tree nodes,which ought to be taken into full consideration.In addition,the existing code completion methods can only use the code pieces near the position to complete,and can hardly extract and use the entire function scenario of the source code file.To address the above defects,we propose a code completion approach based on local and global relationships,with the following main innovations:1.Aiming at the characteristics of the code completion task,we design an algorithm to generate and embed the path feature which encodes relationships between the node to complete and context nodes.Furthermore,a multi-view masking mechanism is invented to fully utilize the different relationships between nodes in the context.The experimental results verify the effectiveness of using local relationship information in the context.Our method achieves a significant improvement compared to other code completion approaches on the predicting accuracy metric.2.The existing code completion approaches can only use a limited range of local information and can hardly extract overall functional semantics from long source code files.To address the above defect,we design a new approach of using global information to assist the code completion task.We select the essential nodes that indicate the code functional scenario with a top-down algorithm and define the relationships within these global nodes,as well as the relationships between local nodes and global nodes.According to the feature representation extracted from the local and global information in the context,the completion tokens are predicted in a novel mapping and merging way.Experimental results show that considering global information benefits the code completion tasks.
Keywords/Search Tags:Code Completion, Machine Learning, Graph Neural Network, Self-attention
PDF Full Text Request
Related items