Context-Based Code Completion With Static Analysis Ranking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current AI-based code completion methods suffer from low accuracy in predicting to-be-completed code, requiring manual completion or correction by users, and are resource-intensive, leading to inefficiencies and poor user experience.
Innovation Solution
A code processing method that performs static analysis on user input to determine candidate items from a context database, using features like syntax and semantic analysis, and employs a lightweight assessment model to filter and rank suggestions, avoiding network delays and recommending high-accuracy code completions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Extent of automation
If AI-based code completion is used, then code completion automation is improved, but prediction accuracy deteriorates
Solution Approach 1:
The patent introduces a context database as an intermediary between the user's code input and the completion suggestions. Instead of directly using AI prediction, the system queries a pre-built database of code contexts and uses static analysis results as intermediaries to retrieve relevant completion candidates, thereby improving accuracy while maintaining automation.
Solution Approach 2:
The system performs preliminary static analysis on the user's code input before generating completion suggestions. By analyzing the code structure, semantics, and context in advance, the system can retrieve more accurate completion candidates from the database, resolving the accuracy issue without sacrificing automation.
2Extent of automation
If complex AI models are used for code completion, then prediction capability is improved, but computing resource consumption increases
Solution Approach 1:
The patent replaces expensive, complex AI models with a simpler database-querying approach. The context database stores pre-computed code completion information that can be retrieved quickly without requiring heavy computational resources, thus reducing energy consumption while maintaining automation capability.
Solution Approach 2:
The system substitutes the mechanical process of running complex AI models with a database query mechanism. Instead of using computational power to generate completions in real-time, the system queries pre-processed information from the context database, significantly reducing computing resource requirements.
3Extent of automation
If network-based AI prediction is used, then code completion functionality is improved, but response time increases due to network transmission delay
Solution Approach 1:
The system performs self-service by executing static analysis locally on the user's code input and querying the context database without requiring network connections. This self-contained approach eliminates network transmission delays while maintaining full code completion functionality through local processing.
Solution Approach 2:
The context database is pre-built and stored locally, containing code completion information that can be accessed immediately without network requests. By performing the database query locally after static analysis, the system eliminates network delays and provides fast response times while maintaining automation functionality.
Data Source
AI summary
Code inputted by a user is received through a user interface. A feature of context of to-be-completed code is determined based on the code inputted by the user. Next, at least one candidate item of the to-be-completed code is determined from a context database based on the feature of context of the to-be-completed code. The context database stores sample code and a feature of context of the sample code. Then, the at least one candidate item is presented to the user through the user interface.


