Method for supporting code completion during ultra-large file editing

By maintaining a token set in memory for code completion, the problem of low efficiency in editing extremely large files in existing technologies is solved, achieving fast and accurate code completion, which is suitable for editing large-scale source code files in semiconductor testing.

WO2026045657A1PCT designated stage Publication Date: 2026-03-05NANJING MACROTEST SEMICON TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/106554
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-29
Filing Date
2025-07-02
Publication Date
2026-03-05

AI Technical Summary

Technical Problem

Existing code completion software is inefficient when editing extremely large files, especially in semiconductor testing where it is prone to freezing and becoming unresponsive during the editing of source code files with tens of millions of lines, and cannot effectively support code completion functionality.

Method used

By maintaining a set of tokens for code completion in memory, this set is dynamically maintained during the user's text editing process. At the cursor position, tokens that meet the criteria are filtered directly from memory for code completion, avoiding the need to re-traverse the entire editing window and improving efficiency.

Benefits of technology

It greatly improves the efficiency of code completion, reduces system retrieval work, lowers real-time load, and ensures the immediacy and accuracy of code completion, making it particularly suitable for large-scale source code file editing in semiconductor testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025106554_05032026_PF_FP_ABST
    Figure CN2025106554_05032026_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of code completion. Disclosed is a method for supporting code completion during ultra-large file editing. In the method for supporting code completion during ultra-large file editing, a token set involved in code completion is maintained in a memory, the token set is dynamically maintained in the memory during text editing by a user, and when the user subsequently taps a keyboard at a cursor position, tokens satisfying conditions are directly filtered from the token set in the memory for code completion, thereby greatly improving the efficiency of code completion. In the method for supporting code completion during ultra-large file editing, code maintenance types are classified, and for addition and deletion operations, different operation methods are selected and used on the basis of different operation positions, meeting the requirements of code completion during ultra-large file editing, and especially in semiconductor testing, where many source code files are very large, facilitating the writing of test procedures by testers.
Need to check novelty before this filing date? Find Prior Art

Description

A method to support code completion when editing extremely large files Technical Field

[0001] This invention relates to the field of code completion technology, specifically a method for supporting code completion when editing very large files. Background Technology

[0002] Code completion is a behavior that uses context to complete text matching a token, making it easier for users to edit without having to type all the text one by one.

[0003] In semiconductor testing, it is often necessary to edit and compile source code files of hundreds of megabytes or tens of millions of lines. In particular, code completion functionality is required during editing. Current source code compilation software, such as Microsoft's VS series software like VS2019 and VS2022, no longer support editing code with tens of millions of lines (and do not support completion for tags of the goto command). UltraEdit also cannot support it. VS Code can provide simple and highly tolerant suggestions, but when the open-source software Code::Blocks needs suggestions, it freezes and becomes unresponsive.

[0004] The main reason for this is that current technologies automatically determine whether code completion is needed based on the content before the keystroke when the user types in the editing window. If completion is needed, the entire editing window content is re-traversed, each token is extracted, and then each token is filtered and compared to obtain the final set of tokens that need to be suggested. The token set is then used to suggest the character. Every time a character is typed at the cursor, the content needs to be parsed again from the beginning of the editing window to obtain a token. For files with tens of millions of lines of code, this is extremely time-consuming, and the program will freeze and become unresponsive. Therefore, a method to support code completion when editing very large files is provided to solve the above problems. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a method for supporting code completion during the editing of extremely large files. This solves the problem that in semiconductor testing, it is often necessary to edit and compile source code files of hundreds of megabytes or tens of millions of lines; especially when implementing code completion functions during editing, the process is extremely time-consuming, causing the program to freeze and become unresponsive.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for supporting code completion during the editing of extremely large files, which involves maintaining a set of tokens participating in code completion in memory. During the user's text editing process, the memory of this token set is dynamically maintained. When the user subsequently presses the keyboard at the cursor position, tokens that meet the conditions are directly filtered out from the memory of the token set for code completion, thus greatly improving the efficiency of code completion.

[0007] Taking the label of a jump instruction as an example, the following memory set needs to be maintained:

[0008] The regular expression for Label is [a-zA-Z_][0-9], and the specific steps are as follows;

[0009] S1. Locate the insertion and deletion positions;

[0010] S2. Determine the operation type as follows: operation types include adding text content and deleting text content;

[0011] S3. Perform token maintenance operations;

[0012] S4. Maintain the origin and destination of the token.

[0013] Preferably, in step S2, the types of insertion and deletion positions include: before all tokens, within one token, between two tokens, and after the last token.

[0014] Preferably, when the insertion position is "before the token, within a certain token, between two tokens, and after all tokens", if there is no ":label" in the text, the start and end positions of the token after the pos are directly added to the text length.

[0015] When the insertion position is "before all tokens, between two tokens, and after all tokens", if there is a ":" in the text, the text before the ":" is connected to the text before the insertion position. The text before the ":" and the continuous text before the insertion position need to be combined to generate a token and store it in the vector collection. As long as there is a ":" in the current text, the token is extracted and stored in the vector collection. The token start and end positions after pos are added to the text length. If there are multiple tokens in the text, the label needs to be parsed out and inserted into the vector collection.

[0016] The insertion position is "within pos". When there is no ":label" in the text, the content of the current label needs to be updated, which is the start and end positions of all labels after the current label plus the text length.

[0017] The insertion position is "pos". When the text contains ":label", the text before the first ":" is continuous text. The continuous text before ":" and the token part text before the insertion position need to be merged into a new token, stored in the vector collection, and the token after the insertion position is updated. If the inserted text has other tokens, they are stored in the token collection.

[0018] Preferably, the deletion position "pos before a certain token and between two tokens" means that if the next token has not been deleted, the token after the current token and the start and end positions of the vector minus the text length will be directly deleted.

[0019] When the deletion position is "pos before a certain token and between two tokens", if the deletion ends within the next token, then update the name, start and end positions of the token, and the start and end positions of the tokens after pos minus the text length; if there are multiple tokens in the text, the parsed tokens need to be removed from the vector collection.

[0020] When the deletion position is "pos before a certain token and between two tokens", if it crosses the next token, all tokens that are crossed need to be deleted from the vector collection. If the ending position reaches a token, the current token is updated, and the start and end positions of all subsequent tokens are set to the text length.

[0021] When deleting from the position "token inside", if it has not reached ":", then update the current token name and terminate at the position minus the length.

[0022] When the deletion position is "token after", it does not affect the token.

[0023] Preferably, the text editing window is essentially a text control that can retrieve text content.

[0024] Preferably, each label includes a name, a start position (startpos), and an end position (endpos).

[0025] This invention discloses a method for supporting code completion when editing extremely large files, which has the following beneficial effects:

[0026] 1. This method supports code completion when editing very large files by maintaining a set of tokens in memory for code completion. During text editing, this set of tokens is dynamically maintained in memory. When the user presses a key at the cursor position, tokens matching the criteria are directly filtered from this set for code completion. This greatly improves the efficiency of code completion and meets the needs of editing very large files, especially useful in semiconductor testing where source code files are numerous and very large, facilitating testers in writing test procedures. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 is a flowchart of the code completion method of the present invention;

[0029] Figure 2 is a schematic diagram of the code completion operation types of the present invention;

[0030] Figure 3 is a flowchart of the operation when the inserted content is within the token according to the present invention;

[0031] Figure 4 is a flowchart of the operation when the inserted content is outside the token according to the present invention;

[0032] Figure 5 is a flowchart of the operation of deleting content starting within the token according to the present invention;

[0033] Figure 6 is a flowchart of the operation of deleting content starting outside the token according to the present invention;

[0034] Figure 7 is a block diagram of the position and text content differentiation processing method of the present invention when inserting text content;

[0035] Figure 8 is a block diagram of the location and text content differentiation processing method of the present invention when deleting text content. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0037] This application provides a method for supporting code completion when editing extremely large files, solving the problem that in semiconductor testing, it is often necessary to edit and compile source code files of hundreds of megabytes or tens of millions of lines; especially when code completion is required during editing, it is extremely time-consuming and the program will freeze and become unresponsive.

[0038] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.

[0039] This invention discloses a method for supporting code completion when editing extremely large files.

[0040] As shown in Figures 1-8, by maintaining a set of tokens for code completion in memory, the memory of this token set is dynamically maintained during the user's text editing process. When the user presses the keyboard at the cursor position, the tokens that meet the conditions are directly filtered out from the memory of the token set for code completion, which will greatly improve the efficiency of code completion.

[0041] Taking the label of a jump instruction as an example, the following memory set needs to be maintained:

[0042] The regular expression for Label is [a-zA-Z_][0-9], and the specific steps are as follows;

[0043] S1. Locate the insertion and deletion positions;

[0044] S2. Determine the operation type as follows: operation types include adding text content and deleting text content;

[0045] S3. Perform token maintenance operations;

[0046] S4. Maintain the origin and destination of the token.

[0047] In step S2, the types of insertion and deletion positions include: before all tokens, within one token, between two tokens, and after the last token.

[0048] Preferably, when the insertion position is "before the token, within a certain token, between two tokens, and after all tokens", if there is no ":label" in the text, simply add the start and end positions of the token after the position to the text length.

[0049] When the insertion position is "before all tokens, between two tokens, and after all tokens", if there is a ":" in the text, the text before the ":" is connected to the text before the insertion position. The text before the ":" and the continuous text before the insertion position need to be combined to generate a token and stored in the vector collection. As long as there is a ":" in the current text, the token is extracted and stored in the vector collection. The token start and end positions after pos are added to the text length. If there are multiple tokens in the text, the labels need to be parsed out and inserted into the vector collection.

[0050] The insertion position is "pos". When there is no ":label" in the text, the content of the current label needs to be updated, which includes the start and end positions of all labels after the current label plus the text length.

[0051] The insertion position is "pos". When the text contains ":label", the text before the first ":" is continuous text. The continuous text before ":" needs to be merged with the token part of the text before the insertion position into a new token, which is stored in the vector collection. Then, the tokens after the insertion position are updated. If there are other tokens in the inserted text, they are stored in the token collection.

[0052] Using the above scheme, different operation methods are adopted for different types of insertion positions during the user's code completion insertion process. This avoids affecting the content tokens above and below during the insertion process, ensuring that the inserted items meet the application requirements and can achieve the effect of fast and accurate recognition. In practical applications, it can automatically read and operate, which greatly improves the efficiency of code completion. Furthermore, during the code completion process, it ensures that each token operation conforms to the specifications.

[0053] The above describes the methods for distinguishing the position and text content when inserting text content, as shown in Figure 7.

[0054] Preferably, the deletion position is "pos before a certain token, between two tokens". If the next token has not been deleted, the token after the current pos and the start and end positions of the vector minus the text length are directly deleted.

[0055] When deleting a position "pos before a certain token and between two tokens", if the deletion ends within the next token, then update the name of that token, the start and end positions, and the start and end positions of the tokens after pos minus the text length; if there are multiple tokens in the text, the parsed tokens need to be removed from the vector collection.

[0056] When deleting a position "pos before a certain token and between two tokens", if it crosses the next token, all tokens that are crossed need to be deleted from the vector collection. If the ending position reaches a token, the current token is updated, and the start and end positions of all subsequent tokens are set to the text length.

[0057] When deleting from the position "token inside", if it has not reached ":", then update the current token name and terminate at the position minus the length;

[0058] Deleting the position "token after" does not affect the token.

[0059] The above describes the location and text content differentiation methods during text content deletion, as shown in Figure 8. During code completion deletion, different operation methods are used for different types of deletion locations to avoid affecting the surrounding content tokens, ensuring that the deleted items meet application requirements and achieve fast and accurate identification. In practical applications, it can automatically read and operate, greatly improving the efficiency of code completion. Furthermore, during code completion, it ensures that each token operation conforms to specifications, preventing code errors.

[0060] A text editing window is essentially a text control that allows you to access text content.

[0061] Each label contains a name, a start position (startpos), and an end position (endpos).

[0062] In current technological operations, semiconductor testing often involves editing and compiling source code files ranging from hundreds of megabytes to tens of millions of lines. Especially in editing, code completion functionality is required. Current technology automatically determines whether completion is needed based on the content before the keystroke when the user types in the editing window. If completion is needed, the entire editing window is re-examined, tokens are extracted, and then filtered and compared to obtain the final set of tokens for suggestion. This set of tokens is then used to suggest characters. Each time a character is typed at the cursor, the content needs to be parsed again from the beginning of the editing window to obtain a token. For files with tens of millions of lines of code, the program may experience lag and unresponsiveness. However, this method maintains a set of tokens for code completion in memory. This set of tokens is dynamically maintained in memory during text editing. When the user types at the cursor, the tokens that meet the criteria are directly filtered from the set of tokens in memory for code completion. There is no need to traverse the entire editing window; the target tokens are added or removed directly. This reduces the system's retrieval work, improves the convenience and immediacy of token maintenance, and greatly reduces the real-time load on the operating device.

[0063] The following example uses a memory-based data structure for a token collection:

[0064] In this example, the token used will be the label for implementing the redirection.

[0065] typedef struct LabelInfo

[0066] {

[0067] char labelName

[0256] ;

[0068] int startpos;

[0069] int endpos;

[0070] bool operator()(const LabelInfo*t1,const LabelInfo*t2){

[0071] return t1->startpos <t2->startpos;}

[0072] bool operator<(const LabelInfo&ti)const{

[0073] return startpos <ti.startpos;}

[0074] }_LabelInfo_; / / token is label

[0075] typedef struct atpToken

[0076] {

[0077] char vectorName

[0256] ;

[0078] int startpos;

[0079] int endpos;

[0080] std::vector<_LabelInfo_>vecLabel; / / Stores a collection of all labels that participate in code completion.

[0081] }_AtpToken_; / / Stores the valid range of the label, including the start and end points.

[0082] The atpToken structure stores the valid range, start point, and end point of all labels. This structure is necessary because the test cases use a language from semiconductor testing, which requires setting the location range.

[0083] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A method for supporting code completion when editing extremely large files, characterized in that, By maintaining a set of tokens for code completion in memory, the memory of this token set is dynamically maintained during the user's text editing process. When the user presses the keyboard at the cursor position, the tokens that meet the conditions are directly filtered out from the memory of the token set for code completion, which will greatly improve the efficiency of code completion. The label for a jump instruction needs to maintain the following memory set: The regular expression for Label is [a-zA-Z_][0-9], and the specific steps are as follows; S1. Locate the insertion and deletion positions; S2. Determine the operation type as follows: operation types include adding text content and deleting text content; S3. Perform token maintenance operations; S4. Maintain the start / end point of the token; In step S2, the types of insertion and deletion positions include: before all tokens, within one token, between two tokens, and after the last token; When the insertion position is "before token, within a certain token, between two tokens, and after all tokens", if there is no ":label" in the text, the starting position and ending position of the token after the updated pos will be directly updated. The starting position = starting position + text length; the ending position = ending position + text length. When the insertion position is "before all tokens, between two tokens, and after all tokens", if the text contains a ":", the text before the ":" is connected to the text before the insertion position. The text before the ":" and the continuous text before the insertion position need to be combined to generate a token and store it in the vector collection. As long as the current text contains a ":", the token is extracted and stored in the vector collection. The token start and end positions after pos are added to the text length. If there are multiple tokens in the text, the labels need to be parsed out and inserted into the vector collection. The insertion position is within "token". When there is no ":label" in the text, the content of the current label needs to be updated, including the start and end positions of all labels after the current label plus the text length. The insertion position is within "token". When the text contains ":label", the text before the first ":" is continuous text. The continuous text before ":" needs to be merged with the token part of the text before the insertion position into a new token, stored in the vector collection, and the tokens after the insertion position are updated. If the inserted text has other tokens, they are stored in the token collection. The deletion position "pos before a certain token and between two tokens" means that if the next token has not been deleted, the tokens after pos and the start and end positions of the vector minus the text length will be directly deleted. When the deletion position is "pos before a certain token and between two tokens", if the deletion ends within the next token, then update the name, start and end positions of the token, and the start and end positions of the tokens after the token minus the text length; if there are multiple tokens in the text, the parsed tokens need to be removed from the vector collection. When the deletion position is "pos before a certain token and between two tokens", if it crosses the next token, all tokens that are crossed need to be deleted from the vector collection. If the ending position reaches a token, the current token is updated, and the start and end positions of all subsequent tokens are set to the text length. When deleting from the position "token inside", if it has not reached ":", then update the current token name and terminate at the position minus the length. When the deletion position is "token after", it does not affect the token.

2. The method for supporting code completion when editing extremely large files according to claim 1, characterized in that: A text editing window is essentially a text control that allows you to access text content.

3. The method for supporting code completion when editing extremely large files according to claim 1, characterized in that: Each label contains a name, a start position (startpos), and an end position (endpos).

Citation Information

Patent Citations

  • Keyword prompt method for improving Qt development environment

    CN106843528A

  • A method and a device for realizing code completion based on ace expansion

    CN109918064A

  • Code completion method and device, storage medium, processor and terminal

    CN114721640A

  • Method for supporting code completion during oversized file editing

    CN118708170A

  • Text code editing method and system

    WO2024066995A1