A code index management method, device, equipment and medium

By creating a full index of code in the remote code repository and sending it to the integrated development device, the problem of high time consumption and low success rate when conducting code indexing is solved, and efficient and reliable code index management is achieved.

CN113220279BActive Publication Date: 2025-03-21HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010072041.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-21
Publication Date
2025-03-21
Estimated Expiration
2040-01-21

AI Technical Summary

Technical Problem

Existing IDEs take a lot of time to conduct code indexing and have low index success rates, resulting in the inability to develop large programs.

Method used

By creating a full index of code in a remote code repository and sending the index to an integrated development device, the integrated development device avoids creating a full index locally, thereby reducing resource usage and improving index success rate.

Benefits of technology

The efficiency and success rate of code indexing are improved, so that integrated development devices do not need to occupy a large amount of local system resources, and lightweight IDEs can also be used for large-scale program development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113220279B_ABST
    Figure CN113220279B_ABST
Patent Text Reader

Abstract

The present application provides a code index management method, including: a remote code repository receives code submitted by a code version control device, an indexing device obtains the code from the remote code repository, and then creates a full index of the code based on the code, stores the full index of the code, the remote code repository sends the code to an integrated development device, and the indexing device sends the full index of the code to the integrated development device. In this way, the problem of the integrated development device occupying local system resources for full indexing locally is solved, so that lightweight integrated development devices can also be used for large-scale program development. In addition, the time spent on indexing the code is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a code index management method, device, equipment and computer-readable storage medium. Background Art

[0002] When developing a program, developers often use an integrated development environment (IDE). An IDE is an application that provides a program development environment, generally including tools such as an editor, compiler, debugger, and graphical user interface.

[0003] At present, the development direction of IDE is to support multiple programming languages, such as C, Java, Python, etc. To this end, the industry provides an IDE architecture that includes a main process and multiple extension processes. Among them, the extension process includes a language server (LS). The editor does not need to support every language, but only needs to support the language server protocol (LSP), that is, through the interaction between LSP and the language server, all languages ​​that support LSP can get the same level of support in the editor, solving the compatibility problem between the editor and the programming language.

[0004] The language server provides a series of common functions for the languages ​​it supports, including reference query, jump to variable declaration, jump to function declaration, jump to class declaration, etc. The language server relies on code indexing to implement the above functions. The so-called code indexing refers to the metadata of objects that can be indexed in the code. Existing IDEs often take a lot of time to perform code indexing, and the indexing success rate is low, which makes it impossible to develop large programs. Summary of the invention

[0005] The present application provides a code index management method, which solves the problem that when IDE performs code indexing, it takes a lot of time and the indexing success rate is low, which makes it impossible to develop large programs. The present application also provides corresponding devices, equipment, computer-readable storage media and computer program products.

[0006] In a first aspect, the present application provides a code index management method, which is applied to a code index management system. The code index management system includes an indexing device and a remote code repository. Specifically, the remote code repository receives the code submitted by the code version control device, the indexing device can obtain the code from the remote code repository, and then create a full index of the code based on the code, and store the full index of the code. When the developer obtains the above code from the remote code repository to the integrated development device for development, the indexing device can generate a full index of the code to the integrated development device.

[0007] In this way, the integrated development device does not need to fully index the code locally, but can receive the full index sent by the indexing device, which solves the problem that the integrated development device occupies a large amount of local system resources when indexing the code and improves the indexing success rate. Moreover, the time it takes for the integrated development device to receive the full index is much shorter than the time it takes to create the full index, which saves the time spent on indexing the code and improves the indexing efficiency. Since it occupies fewer resources and takes less time, lightweight integrated development devices can also be used for large-scale program development, which improves usability.

[0008] In some possible implementations, in order to enable the integrated development device to obtain the index of the code in a timely manner after obtaining the code, so that the developer can obtain a better development experience, the indexing device can create a full index of the code before the integrated development device receives the code. In this way, it can avoid the situation where the integrated development device fails to index because the full index of the code is not stored in the indexing device, thereby improving the development experience.

[0009] In some possible implementations, the remote code repository also stores a commit ID of the code. The commit ID is used to distinguish the code corresponding to different commit operations. In a specific implementation, the commit ID can be a hash value calculated based on the code, that is, the commit ID can be a commit hash value (commit hash) obtained by hashing the code.

[0010] Correspondingly, the indexing device also stores the correspondence between the submission identification of the code and the full index of the code. When the remote code repository sends the code, it can also send the submission identification of the code to the integrated development device. The integrated development device can send an index acquisition request to the indexing device, and the index acquisition request includes the submission identification of the code. In this way, the indexing device can send the full index of the code to the integrated development device based on the submission identification of the code.

[0011] In some possible implementations, developers can also modify the code pulled from the remote code repository. For example, they can add new code to implement new functions or features. Another example is that they can modify the code to improve code defects. Of course, they can also delete code to delete unnecessary functions or features.

[0012] Based on this, the integrated development device can receive the change settings for the code and obtain the changed code. Before submitting the changed code to the remote code repository, the integrated development device creates an incremental index based on the changed code and stores the changed code and the incremental index corresponding to the changed code.

[0013] Full indexing refers to creating an index for all submitted code, and incremental indexing refers to creating an index for modified code based on the previous version. The resource overhead of local incremental indexing is much less than the resource overhead of local full indexing, which solves the problem of the indexing service occupying a large amount of local system resources. In addition, when a program is developed by multiple people, each developer only performs incremental indexing when the local code is changed, which greatly reduces the indexing time and improves the indexing efficiency.

[0014] In some possible implementations, considering that the program development process may be interrupted, for example, the developer has other affairs that cause the program development process to be interrupted, or the current program development project is interrupted due to an exception, the developer can restart the IDE. Based on this, the IDE can refresh the index stored in the IDE according to the full index stored by the indexing device. In addition, when an error occurs in the language service, the IDE can also refresh the index stored in the IDE according to the full index stored by the indexing device. The developer can also configure a refresh cycle, and the IDE can refresh the index stored in the IDE according to the full index stored by the indexing device according to the refresh cycle. By refreshing the index stored in the IDE, the stability and reliability of the indexing service can be improved.

[0015] Specifically, the integrated development device may send a submission identifier query request to the indexing device. The submission identifier query request includes an identifier list formed by submission identifiers stored by the integrated development device. The indexing device determines the submission identifier most recently submitted to the remote code repository based on the identifier list, and returns the submission identifier most recently submitted to the remote code repository to the integrated development device. The integrated development device obtains a target index based on the submission identifier most recently submitted to the remote code repository, and the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository, and is an index not stored by the integrated development device.

[0016] In some possible implementations, the submission identification query request includes an identification list formed by N submission identifications with earlier submission times among the submission identifications stored in the integrated development device, where N is a positive integer.

[0017] When the indexing device determines the latest submission identifier submitted to the remote code repository based on the identifier list formed by the submission identifiers stored by the integrated development device, it can query in sequence whether the N submission identifiers exist in the submission identifiers stored by the indexing device. If so, the indexing device can determine the first submission identifier successfully queried as the latest submission identifier submitted to the remote code repository. If not, the integrated development device is instructed to send the next submission identifier query request until the indexing device finds that the submission identifier included in the submission identifier query request exists in the submission identifiers stored by the indexing device.

[0018] The next submission identifier query request includes M submission identifiers whose submission time is after the submission time of the submission identifier included in the current submission identifier query request, and M is greater than or equal to N, so that the query efficiency can be improved. In some possible implementations, M can be twice of N.

[0019] In the second aspect, the present application provides a code index management method, which is applied to an indexing device. Specifically, after the remote code repository receives the submitted code, the indexing device can obtain the code from the remote code repository, and then the indexing device can create a full index of the code based on the code, and store the full index of the code. Then the indexing device receives an index acquisition request sent by the integrated development device, and the index acquisition request is used to request a full index of the code, and then the indexing device sends the full index of the code to the integrated development device according to the index acquisition request. In this way, the integrated development device is prevented from creating a full index locally, which causes a large amount of local system resources to be occupied, thereby improving the indexing success rate. In addition, since there is no need to create a full index locally, the time required for indexing is also saved.

[0020] In some possible implementations, the indexing device may create a full index of the code before the integrated development device sends the index acquisition request. In this way, the situation where the integrated development device fails to index due to the full index of the code not being stored in the indexing device can be avoided, thereby improving the development experience.

[0021] In some possible implementations, the method further includes:

[0022] The indexing device receives a submission identification query request from the integrated development device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device;

[0023] The indexing device determines the submission identifier of the latest submission to the remote code repository according to the identifier list;

[0024] Return the submission identifier of the latest submission to the remote code repository to the integrated development device, so that the integrated development device obtains a target index according to the submission identifier of the latest submission to the remote code repository, wherein the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is an index not stored by the integrated development device.

[0025] In some possible implementations, the submission identification query request includes an identification list formed by N submission identifications with earlier submission times among the submission identifications stored in the integrated development device, where N is a positive integer;

[0026] The indexing device determines the latest submission identifier submitted to the remote code repository according to the identifier list formed by the submission identifiers stored in the integrated development device, including:

[0027] The indexing device sequentially queries whether the N submission identifiers exist in the submission identifiers stored in the indexing device;

[0028] If not, the integrated development device is instructed to send the next submission identifier query request until the index device queries that the submission identifier included in the submission identifier query request exists in the submission identifiers stored in the index device, and the next submission identifier query request includes M submission identifiers whose submission time is after the submission time of the submission identifier included in the current submission identifier query request, and M is greater than or equal to N.

[0029] In the third aspect, the present application provides a code index management method, which is applied to an integrated development device. Specifically, the integrated development device obtains the code stored in a remote code repository and the submission identifier of the code. Then the integrated development device sends an index acquisition request to the index device, and the index acquisition request includes the submission identifier. Among them, the index device stores the correspondence between the full index of the code and the submission identifier of the code. In this way, the integrated development device can receive the full index of the code determined by the index device according to the submission identifier of the code, thereby avoiding the integrated development device from creating a full index locally, resulting in a large amount of local system resources being occupied, and improving the indexing success rate. In addition, since there is no need to create a full index locally, the time required for indexing is also saved.

[0030] In some possible implementations, the method further includes:

[0031] The integrated development device receives the modification setting of the code and obtains the modified code;

[0032] Before the modified code is submitted to the remote code repository, the integrated development device creates an incremental index according to the modified code, and stores the modified code and the incremental index corresponding to the modified code.

[0033] In some possible implementations, the method further includes:

[0034] The integrated development device sends a submission identification query request to the index device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device;

[0035] The integrated development device receives a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list;

[0036] The integrated development device obtains a target index according to the submission identifier of the latest submission to the remote code repository, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

[0037] In a fourth aspect, the present application provides a code index management system, the code index management system comprising:

[0038] Remote code repository, used to receive code submitted by code version control device;

[0039] An indexing device, configured to obtain the code from the remote code repository, create a full index of the code based on the code, and store the full index of the code;

[0040] The remote code repository is also used to send the code to the integrated development device;

[0041] The indexing device is also used to send the full index of the code to the integrated development device.

[0042] In some possible implementations, the indexing device is specifically used to:

[0043] A full index of the code is created before the integrated development device receives the code.

[0044] In some possible implementations, the remote code repository further stores a submission identifier of the code, and the indexing device further stores a correspondence between the submission identifier of the code and a full index of the code;

[0045] The remote code repository is specifically used for:

[0046] Sending the code and a submission identifier of the code to an integrated development device;

[0047] The code index management system also includes:

[0048] The integrated development device is used to send an index acquisition request to the index device, wherein the index acquisition request includes a submission identifier of the code;

[0049] The indexing device is specifically used for:

[0050] According to the submission identifier of the code, a full index of the code is sent to the integrated development device.

[0051] In some possible implementations, the integrated development device is further used to:

[0052] Receiving a modification setting of the code and obtaining the modified code;

[0053] Before submitting the modified code to the remote code repository, an incremental index is created according to the modified code, and the modified code and the incremental index corresponding to the modified code are stored.

[0054] In some possible implementations, the integrated development device is further used to:

[0055] Sending a submission identification query request to the indexing device, wherein the submission identification query request includes an identification list formed by the submission identifications stored in the integrated development device;

[0056] Receiving a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list;

[0057] According to the submission identifier of the latest submission to the remote code repository, a target index is obtained, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

[0058] In some possible implementations, the submission identification query request includes an identification list formed by N submission identifications with earlier submission times among the submission identifications stored in the integrated development device, where N is a positive integer;

[0059] The indexing device determines the latest submission identifier submitted to the remote code repository according to the identifier list formed by the submission identifiers stored in the integrated development device, including:

[0060] The indexing device sequentially queries whether the N submission identifiers exist in the submission identifiers stored in the indexing device;

[0061] If not, the integrated development device is instructed to send the next submission identifier query request until the index device queries that the submission identifier included in the submission identifier query request exists in the submission identifiers stored in the index device, and the next submission identifier query request includes M submission identifiers whose submission time is after the submission time of the submission identifier included in the current submission identifier query request, and M is greater than or equal to N.

[0062] In a fifth aspect, the present application provides an indexing device, the indexing device comprising:

[0063] A communication module, used to obtain the code from a remote code repository;

[0064] An index creation module, used to create a full index of the code according to the code;

[0065] A storage module, used to store the full index of the code;

[0066] The communication module is also used to send the full index of the code to the integrated development device.

[0067] The index creation module is specifically used for:

[0068] In some possible implementations, a full index of the code is created before the integrated development device receives the code.

[0069] In some possible implementations, the remote code repository further stores a submission identifier of the code, and the storage module further stores a correspondence between the submission identifier of the code and a full index of the code;

[0070] The communication module is also used for:

[0071] Receiving an index acquisition request from an integrated development device, wherein the index acquisition request includes a submission identifier of the code;

[0072] According to the submission identifier of the code, a full index of the code is sent to the integrated development device.

[0073] In some possible implementations, the device further includes an index management module;

[0074] The communication module is further used to receive a submission identification query request from the integrated development device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device;

[0075] The index management module is used to determine the submission identifier of the latest submission to the remote code repository according to the identification list;

[0076] The communication module is also used to return the submission identifier of the latest submission to the remote code repository to the integrated development device, so that the integrated development device obtains the target index according to the submission identifier of the latest submission to the remote code repository, and the target index is the index corresponding to the code submitted by the integrated development device to the remote code repository, and is an index not stored by the integrated development device.

[0077] In some possible implementations, the submission identification query request includes an identification list formed by N submission identifications with earlier submission times among the submission identifications stored in the integrated development device, where N is a positive integer;

[0078] The index management module is specifically used for:

[0079] querying in sequence whether the N submission identifiers exist in the submission identifiers stored in the indexing device;

[0080] If not, the integrated development device is instructed to send the next submission identifier query request until the index device queries that the submission identifier included in the submission identifier query request exists in the submission identifiers stored in the index device, and the next submission identifier query request includes M submission identifiers whose submission time is after the submission time of the submission identifier included in the current submission identifier query request, and M is greater than or equal to N.

[0081] In a sixth aspect, the present application provides an integrated development device, the device comprising:

[0082] A communication module, used to receive the code sent by the remote code repository, and receive the full index of the code sent by the indexing device;

[0083] A storage module is used to store the code and a full index of the code.

[0084] In some possible implementations, the remote code repository further stores a submission identifier of the code, and the indexing device further stores a correspondence between the submission identifier of the code and a full index of the code;

[0085] The communication module is also used for:

[0086] An index acquisition request is sent to the indexing device, wherein the index acquisition request includes a submission identifier of the code, so that the indexing device sends a full index of the code according to the submission identifier of the code.

[0087] In some possible implementations, the device further includes:

[0088] A basic development module, used for the integrated development device to receive the modification settings of the code and obtain the modified code;

[0089] The language service module is used to create an incremental index according to the modified code before submitting the modified code to the remote code repository, and store the modified code and the incremental index corresponding to the modified code.

[0090] In some possible implementations, it is characterized in that the communication module is further used for:

[0091] Sending a submission identification query request to the indexing device, wherein the submission identification query request includes an identification list formed by the submission identifications stored in the integrated development device;

[0092] Receiving a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list;

[0093] According to the submission identifier of the latest submission to the remote code repository, a target index is obtained, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

[0094] In a seventh aspect, the present application provides a device, the device comprising a processor and a memory;

[0095] The processor is used to execute instructions stored in the memory to perform the code index management method as described in the second aspect of the present application.

[0096] In an eighth aspect, the present application provides a device, the device comprising a processor and a memory;

[0097] The processor is used to execute instructions stored in the memory to perform the code index management method as described in the third aspect of the present application.

[0098] In a ninth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a device, enables the device to execute the code index management method as described in the second aspect.

[0099] In a tenth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a device, enables the device to execute the code index management method as described in the third aspect.

[0100] In an eleventh aspect, the present application provides a computer program product comprising instructions, which, when executed on a device, enables the device to execute the code index management method described in the second aspect or any one of the implementations of the second aspect.

[0101] In a twelfth aspect, the present application provides a computer program product comprising instructions, which, when executed on a device, enables the device to execute the code index management method described in the third aspect or any one of the implementations of the third aspect.

[0102] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0103] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.

[0104] Figure 1 A schematic diagram of a code file and an index file provided in an embodiment of the present application;

[0105] Figure 2 An architectural diagram of a code index management system provided in an embodiment of the present application;

[0106] Figure 3 A schematic diagram of an application scenario of a code index management system provided in an embodiment of the present application;

[0107] Figure 4 A schematic diagram of an application scenario of a code index management system provided in an embodiment of the present application;

[0108] Figure 5 An interactive flow chart of a code index management method provided in an embodiment of the present application;

[0109] Figure 6 An interactive flow chart of a code index management method provided in an embodiment of the present application;

[0110] Figure 7 A schematic diagram of refreshing an index stored in an integrated development device according to a full index provided in an embodiment of the present application;

[0111] Figure 8 A schematic diagram of the structure of a device provided in an embodiment of the present application;

[0112] Fig. 9 A schematic diagram of the structure of a device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0113] The scheme in the embodiments provided in this application will be described below in conjunction with the drawings in this application.

[0114] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances. This is just a way of distinguishing objects with the same attributes when describing the embodiments of this application.

[0115] In order to facilitate understanding of the technical solution of the present application, some technical terms involved in the present application are first introduced.

[0116] An integrated development environment (IDE), also known as an integrated development device, is used to provide a program development environment for developers. Specifically, IDE can provide basic functions for program development. In one example, the basic functions can specifically include at least one of code editing, file reading, and debugging. Among them, when developers perform code editing, it is based on the programming language implementation. In order to improve editing efficiency, IDE also provides functions related to programming languages. In one example, the functions related to programming languages ​​can be functions for understanding codes, including understanding the meaning expressed by the codes, such as functions, variables, classes, or interfaces, etc.

[0117] Taking into account the situation that developers use different programming languages ​​to develop programs, IDE can decouple programming language-related functions from IDE, so that the IDE editor does not need to support every programming language, but only needs to support the language server protocol (LSP) to support different programming languages ​​through the language server (LS).

[0118] Among them, IDE can implement syntax checking, lexical checking, reference query, automatic completion and other functions for different programming languages ​​through LS. For example, when developers use IDE to edit code, if the variable sayhello is pre-defined, when defining the function sayhello, IDE can prompt that sayhello is occupied, and the developer can rename the above function, such as naming it sayhi, to implement syntax checking. For another example, when developers use IDE to edit code, if they type say, IDE can prompt multiple candidates, such as variable sayhello and function sayhi, etc. In this way, the developer selects one of the candidates to achieve automatic completion, thus avoiding tedious typing operations.

[0119] When implementing functions such as syntax checking, lexical checking, reference query or automatic completion, the IDE relies on the index of indexable objects in the code file. The indexable object is specifically an identifier (symbol) in the code file. As an example, the indexable object can be a variable (variable, var), a constant (constant, const) or a function (function, func) in the code file, etc. The index specifically refers to the metadata of the indexable object. Among them, metadata is data that describes data, and specifically in this application, it is data that describes the indexable object.

[0120] In one example, the index may include at least one of the declaration and position of the above-mentioned identifier. The declaration is used to inform the compiler of the relevant information of the identifier. Taking a function as an example, the declaration of a function may include a function name, parameter types, and parameters. The following shows a format of a function declaration and a corresponding example:

[0121] Return type function name (parameter 1 type parameter 1, parameter 2 type parameter 2, ...);

[0122] int add(int x, int y);

[0123] For ease of understanding, the present application also provides examples of code files and indexes of indexable objects in code files in conjunction with accompanying drawings.

[0124] like Figure 1 As shown, the code file includes at least one statement, which may specifically include at least one of a function declaration statement, a function definition statement, a variable definition statement, a variable declaration statement, a constant definition statement, and a constant declaration statement. For external functions (functions defined in other code files) and standard input and output functions, the corresponding functions can be declared in a declaration file. For variables or constants, the definition is implemented when they are declared.

[0125] Indexes for indexable objects in code files can be stored in index files. The indexes include Figure 1 The declaration and location of the identifier included in the code file shown. The declaration of the identifier is specifically at least one of a function declaration, a variable declaration, and a constant declaration. The location of the identifier can be characterized based on the row number and column number of the identifier in the code file.

[0126] Figure 1A sample code file is provided, which includes identifiers such as variable c, function pow2, and function printf. Function pow2 is defined in other code file other.h, and function printf is defined in standard input and output file stdio.h. Developers can embed header files such as other.h and stdio.h through the include directive include to declare the above functions pow2 and printf. Correspondingly, Figure 1 An index file of the code file sample is also provided, which includes the declaration of variable c and the line number and column number of variable c, the declaration of function pow2 and the line number and column number of function pow2, and the declaration of function printf and the line number and column number.

[0127] It should be noted that the index file is generally a binary file. For the convenience of description, the embodiment of the present application schematically shows the content stored in the index file. In addition, the embodiment of the present application is illustrated by using a code file and an index file based on the C language. In other possible implementations, the code file and the index file can also be formed based on other programming languages ​​such as Java, Python, etc.

[0128] At present, most IDEs implement code indexing locally. Specifically, the language server in the IDE fully indexes the indexable objects of the entire program code file in the initial stage of program development, which will take up a lot of local system resources. If the local system resources are small, it may even cause indexing failure, and the IDE will be difficult to use for developing large programs. In addition, when a program is developed by multiple people, each developer performs full indexing, which increases the time cost.

[0129] In order to solve the above problems, the present application provides a code index management method, which decouples the index service from the IDE, that is, the code submitted to the remote code repository is fully indexed at the remote end, and all IDEs can share the full index. New developers can pull code from the remote code repository through the IDE and obtain the above full index from the remote end, avoiding the creation of a full index locally and occupying a large amount of local system resources, so that fewer local system resources can also meet the indexing requirements, thereby improving the indexing success rate. In this way, lightweight IDEs can also be used to develop large programs. Furthermore, when there are code changes locally, the IDE performs incremental indexing locally.

[0130] Among them, full indexing refers to creating an index for all submitted codes, and incremental indexing refers to creating an index for modified codes based on the previous version. The resource overhead of local incremental indexing is much less than the resource overhead of local full indexing, which solves the problem of indexing services occupying a large amount of local system resources. In addition, when a program is developed by multiple people, each developer only performs incremental indexing when the local code is changed, which greatly reduces the indexing time and improves the indexing efficiency.

[0131] The index management method provided in the present application can be implemented by a code index management system. Next, the system architecture of the code index management system provided in the present application is introduced.

[0132] See also Figure 2 The system architecture diagram of the code index management system shown in the figure, the code index management system includes at least one integrated development device 102, a remote code repository 104 and an index device 106. Among them, the program can be developed by multiple people in collaboration or by a single person independently. This application is illustrated by an example of a scenario of multiple people collaborating.

[0133] The integrated development device 102 includes a basic development module 1022, a language service module 1024, a communication module 1026 and a storage module 1028. Among them, the basic development module 1022 is used to provide basic functions for program development, including at least one of code editing, file reading and code debugging. The language service module 1024 is used to provide functions related to programming languages, such as understanding the meaning expressed by the code, such as understanding functions, variables, classes or interfaces. The communication module 1026 is used to implement interaction with external devices. Among them, the interaction with external devices may include interaction with the remote code repository 104 and the indexing device 106. The storage module 1028 is used to store code. For the code to be submitted or the code that has been submitted, the storage module 1028 also stores the corresponding submission identification (commit ID). Among them, the submission identification is used to distinguish the versions of the code corresponding to different submission operations. The submission identification can be a hash value (commithash) obtained by hashing the submitted code (or the code to be submitted). The storage module 1028 also stores an index of indexable objects included in the code, and the language service module 1024 provides functions such as syntax checking, lexical checking, automatic completion, function jumping, and variable jumping based on the index.

[0134] A developer or project manager in the program development project team can create a remote code repository 104 through version control tools such as Git, subversion (SVN), etc. The remote code repository 104 includes a storage module 1042, a hook module 1044, and a communication module 1046. Among them, the storage module 1042 can store code submitted by at least one member of the program development project team (including developers and project managers). The hook module 1044 can monitor the setting event. Once the setting event occurs, the hook module 1044 can generate a notification message. The communication module 1046 can send the above notification message to the indexing device 106 to notify the setting event. Among them, the setting event can specifically be an event of submitting code to the remote code repository 104.

[0135] The indexing device 106 includes a communication module 1062, an index creation module 1064, an index management module 1066, and a storage module 1068. The communication module 1062 is used to realize communication with the outside, such as communication with the integrated development device 102 and / or the remote code repository 104. The index creation module 1064 is used to create a full index based on the code submitted to the remote code repository 104. The index management module 1066 is used to manage the full index created by the index creation module 1064. The storage module 1068 is used to store the code submitted to the remote code repository 104, the corresponding submission identifier, and the full index.

[0136] In a specific implementation, a developer or project administrator (or other developers, of course) who creates a remote code repository 104 can trigger a code submission operation. In response to the code submission operation, the integrated development device 102 sends a code submission request to the remote code repository 104. The code submission request includes the code and a corresponding submission identifier (commitID).

[0137] Correspondingly, the hook module 1044 in the remote code repository 104 monitors the occurrence of the event of submitting code to the remote code repository 104, generates a notification message, and sends the notification message to the indexing device 106 through the communication module 1046. The communication module 1062 of the indexing device 106 is used to obtain the submitted code and the corresponding submission identifier from the remote code repository 104 when receiving the notification message from the remote code repository 104. The index creation module 1064 creates a full index based on the acquired code. It should be noted that the index creation module 106 can support multi-process or multi-threaded operations, and it can create a full index for the code submitted by developers or project managers in multiple program development project groups. The storage module 1068 can store the above-mentioned code, submission identifier and index.

[0138] Other developers in the program development project team or newly joined developers can trigger a code pull operation, and the communication module 1026 of the integrated development device 102 responds to the code pull operation by sending a code pull request to the remote code repository 104. The remote code repository 104 returns a code pull response to the integrated development device 102, and the code pull response includes the code submitted by the developer or project manager in the program development project team and the corresponding submission identifier.

[0139] The communication module 1026 of the integrated development device 102 is further used to send an index acquisition request to the index device 106, and the communication module 1062 of the index device 106 returns the index corresponding to the above code to the integrated development device 102 in response to the above index acquisition request. The storage module 1028 of the integrated development device 102 stores the code and the corresponding submission identifier and index, so that the language service module 1024 can provide at least one service of syntax checking, lexical checking, automatic completion, variable jump or function jump based on the above index.

[0140] After the developer pulls the code from the remote code repository, the developer can make changes based on the pulled code through the basic development module 1022, for example, adding new code to implement new functions or new features, or modifying the code to implement defect repairs, or deleting code to delete functions or features. For the modified code, if the developer does not trigger the operation of submitting to the remote code repository 104, the language service module 1024 can also create an incremental index based on the modified code, and the storage module 1028 stores the incremental index created by the language service module 1024. The incremental index specifically refers to an additional index relative to the full index obtained by the integrated development device 102 from the indexing device 106.

[0141] It should be noted that different developers can pull codes at different times, and the codes stored in the remote code repository 104 at different times may be different. Correspondingly, the full index stored by the indexing device 106 at different times may be different. In this way, the codes pulled by different developers from the remote code repository 104 at different times may be different, and the full index obtained from the indexing device 106 may be different. In addition, after pulling the code, different developers can perform different changes to the code. For example, different developers can develop a new function respectively. Based on this, the incremental index created by the language service module 1024 for the modified code can be different.

[0142] In this case, the index stored in the integrated development device 102 corresponding to each developer who makes changes to the code can be divided into two parts, one part is the full index obtained from the indexing device 106, and the other part is the incremental index created by the integrated development device 102. In this way, the problem that the full index needs to be performed locally in each integrated development device 102, which occupies more local system resources and affects the indexing success rate, is solved. In addition, each integrated development device 102 directly obtains the full index from the indexing device 106, and performs incremental indexing when there are code changes locally, thus saving the time consumed in indexing the code.

[0143] The above is an example of the integrated development device 102 coupled with the code submission function and the code pull function. In actual application, the code submission function and the code pull function can also be decoupled from the integrated development device 102, and the code submission function and the code pull function can be implemented by the code version control device 101. The code version control device 101 in this application can be a part of the integrated development device 102 or an independent device.

[0144] like Figure 2 As shown, the code version control device 101 includes a communication module 1012 and a storage module 1014. Among them, the storage module 1014 can store code. Further, the storage module 1014 can also store a submission identifier corresponding to the code. The communication module 1012 is used to send a code submission request to a remote code repository in response to a code submission operation, and the code submission request at least includes the code. In some cases, the code submission request may also include a submission identifier corresponding to the code. In this way, the code version control device 101 implements the code submission function, submits the code and its corresponding submission identifier to the remote code repository 104, and the integrated development device 102 can obtain the code submitted by the code version control device 101 and the corresponding submission identifier from the remote code repository 104, and then perform an index acquisition operation, thereby realizing index management.

[0145] The communication module 1012 may also send a code pull request to the remote code repository 104 in response to the code pull operation, and then the communication module 1012 may receive the code sent by the remote code repository 104, and in some cases, also receive the submission identifier corresponding to the code. The storage module 1014 stores the code and the corresponding submission identifier. In this way, the code version control device 101 implements the code pull function, and pulls the code and its corresponding submission identifier to the code version control device 101. The integrated development device 102 may obtain the code and the corresponding submission identifier from the code version control device 101, and then perform an index acquisition operation to implement index management.

[0146] It should be noted that in Figure 2 In the illustrated embodiment, the code version control device 101 and the integrated development device 102 are optional devices of the code index management system. In some possible implementations, the code index management system can implement code index management through a remote code repository 104 and an index device 106 .

[0147] For ease of description, the following is an example of an integrated development device 102 coupling a code submission function and a code pull function. In other possible implementations of the embodiment of the present application, when performing code index management, the code submission function and the code pull function can also be implemented through the code version control device 101.

[0148] Among them, the code version control device 101 can be deployed in a virtualized cloud device, or directly deployed in a physical device (physical machine, PM). The integrated development device 102 can be deployed in a virtualized cloud device. The basic development module 1022 and the language service module 1024 in the integrated development device 102 can be two containers in the above-mentioned cloud device, or two virtual machines (virtual machines, VM). In some possible implementations, the integrated development device 102 can also be directly deployed in a physical device. Similarly, the remote code repository 104 can also be deployed in a cloud device. The storage module 1042 and the hook module 1044 of the remote code repository 104 can be containers or virtual machines in the cloud device. Of course, the remote code repository can also be directly deployed in a physical device. The indexing device 106 can be deployed in a cloud device, and the index creation module 1064, the index management module 1066 and the storage module 1068 can be containers or virtual machines in the cloud device. Of course, the indexing device 106 can also be directly deployed in a physical device.

[0149] Considering the data transmission resource overhead and transmission delay, the above-mentioned code version control device 101 and the integrated development device 102 can be deployed in the same device. Similarly, the above-mentioned remote code warehouse 104 and indexing device 106 can also be deployed in the same device. Of course, the code version control device 101, the integrated development device 102, the remote code warehouse 104 and the indexing device 106 can also be deployed in different devices respectively, so as to ensure the robustness of the code index management system.

[0150] Figure 3A possible application scenario of an embodiment of the present application is shown. In this application scenario, device 310, device 320, device 330, and device 340 are all devices in the network. Among them, device 310 is a user device, for example, it can be a tablet computer, a personal computer, etc. Device 320 is specifically a cloud device that provides cloud services, and the cloud service provider can virtualize at least one device and provide it to the outside in a unified form. Among them, an integrated development device 102 is deployed in device 320 to provide a program development environment. Device 330 is specifically a device that provides indexing services, which provides the above-mentioned indexing services by deploying an indexing device 106. In a specific implementation, device 330 can be a server. A remote code repository 104 is deployed in device 340 to provide code storage services. Device 340 and device 320 can both be cloud devices provided by a cloud service provider.

[0151] Specifically, the developer can purchase cloud services by accessing a web page through the device 310. The cloud service provider creates an instance of the integrated development device 320 in the device 320 according to the developer's purchase result, that is, an IDE instance. The developer can develop the program based on the IDE instance and obtain the program code. When developing the program, a developer or project manager of the program development project team can trigger a code submission operation through the IDE instance. The IDE instance can send a code submission request to the device 340 in response to the code submission operation to submit the code, and the device 330 can create a full index based on the submitted code. Other developers of the program development project team can trigger a code pull operation through their corresponding IDE instances. The IDE instance can respond to the code pull operation and send a code pull request to the device 340 to pull the code from the device 340. Then the IDE instance can send an index acquisition request to the device 330. The device 330 returns the index corresponding to the code to the IDE instance in response to the index acquisition request. The IDE instance stores the above index so as to provide services related to the programming language based on the index.

[0152] Furthermore, when the developer also performs code modification operations through the IDE instance, such as adding new code, modifying code and / or deleting code, and the developer does not trigger a code submission operation for the modified code, i.e., submitting the modified code to the remote code repository 104, the IDE instance can also create an incremental index based on the modified code and store the incremental index.

[0153] Figure 4Another possible application scenario of an embodiment of the present application is shown. In this application scenario, device 410, device 420, and device 430 are all devices in the network. Among them, device 410 is a user device, for example, it can be a tablet computer, a personal computer, etc. Device 410 is deployed with an integrated development device 102, and the integrated development device 102 can exist in the form of a software program. Device 410 runs the integrated development device 102 to generate an IDE instance to provide a program development environment for developers. Developers develop programs based on the IDE instance and obtain the code of the program. Device 420 is specifically a device that provides indexing services, which provides the above-mentioned indexing services by deploying an indexing device 106. In a specific implementation, device 420 can be a server. A remote code repository 104 is deployed in device 430 for providing code storage services.

[0154] exist Figure 4 In the scenario shown, a developer or project manager of the program development project team can trigger a code submission operation through an IDE instance, and the IDE instance can send a code submission request to device 420 in response to the code submission operation to submit the code, and device 430 can create a full index based on the submitted code. Other developers of the program development project team can trigger a code pull operation through their corresponding IDE instances, and the IDE instance can send a code pull request to device 420 in response to the code pull operation to pull the code from device 420, and then the IDE instance can send an index acquisition request to device 430, and device 430 returns the index corresponding to the code to the IDE instance in response to the index acquisition request, and the IDE instance stores the above index so as to provide services related to programming languages ​​based on the index.

[0155] Furthermore, when the developer performs code modification operations through the IDE instance and the developer does not trigger the operation of submitting the modified code to the remote code repository 104, the IDE instance can also create an incremental index based on the modified code and store the incremental index.

[0156] In order to make the technical solution of the present application clearer and easier to understand, the code index management method provided by the embodiment of the present application will be introduced from the perspective of the interaction between the integrated development device 102, the remote code repository 104 and the indexing device 106.

[0157] In this application, a program development project team may include multiple developers. For ease of description, in this embodiment of the application, the developer who performs the code submission operation for the first time is referred to as the first developer, and the developer who pulls the code submitted by the first developer for development is referred to as the second developer.

[0158] Next, see Figure 5 The flowchart of the code index management method shown in FIG. 1 includes:

[0159] S502: The code version control apparatus 101 sends a code submission request to the remote code repository 104 in response to the code submission operation triggered by the first developer.

[0160] Specifically, the code submission request includes the code and the corresponding commit ID. The commit ID is used to distinguish the codes submitted by different code submission operations. Based on this, the commit ID can be determined based on the submitted code. In some possible implementations, the code can be hashed and the calculated hash value can be used as the commit ID. That is, the commit ID can be the hash value (commit hash) obtained by hashing the code.

[0161] S504: The remote code repository 104 stores the code and the corresponding submission identifier in response to the code submission request.

[0162] In order to implement version control of the code, such as operating a specified version of the code, etc., the remote code repository 104 stores the correspondence between the code and the commit identifier when storing the code and the commit identifier, so that the developer can search or obtain the corresponding code based on the commit identifier.

[0163] S506 : the indexing device 106 receives a notification message indicating the occurrence of an event of submitting code to the remote code repository 104 , and obtains the code and the submission identifier from the remote code repository 104 .

[0164] The indexing device 106 can monitor the setting event by setting the hook module 1044 in the remote code repository 104. When the setting event occurs, the hook module 1044 generates a notification message. The setting event can be an event of submitting code to the remote code repository 104. In this way, when the code version control device 101 performs a code submission operation, the remote code repository 104 can generate a notification message, and the indexing device 106 can receive the notification message, which is used to identify that a developer (such as the first developer) has submitted code to the remote code repository 104. The indexing device 106 can obtain the code submitted by the first developer through the code version control device 101 and the corresponding submission identifier.

[0165] S508: The indexing device 106 creates a full index according to the submitted code.

[0166] Specifically, the indexing device 106 can identify the indexable object from the submitted code, that is, identify the identifier in the submitted code. When the indexable object is identified, the indexing device 106 can extract the metadata of the indexable object, and the metadata of the indexable object includes the declaration and location of the indexable object.

[0167] The code includes statements related to the indexable object, such as definition statements and / or declaration statements. The indexing device 106 determines the statement related to the indexable object based on the format of the statement related to the indexable object, such as the format of the definition statement and / or declaration statement, and then determines the indexable object based on the statement.

[0168] Further, the indexing device 106 can determine the position of the indexable object based on the position of the statement where the indexable object is located. The position of the indexable object can be represented by the line number and column number of the statement where the indexable object is located. The indexing device 106 also determines the declaration of the indexable object based on the declaration statement in the statement related to the indexable object. In this way, the indexing device 106 can generate an index of the indexable object based on the metadata of the indexable object. Accordingly, the indexing device 106 generates an index for each indexable object in the submitted code, and the index of the code includes the index of each indexable object in the code.

[0169] It should be noted that the indexing device 106 creates an index for all codes submitted to the remote code repository 104 , and the index is a full index.

[0170] S510: The indexing device 106 stores the code and the corresponding submission identifier and index.

[0171] When storing the code, submission identifier and index, the indexing device 106 stores the correspondence between the three, so as to facilitate subsequent operations such as searching or obtaining based on the correspondence.

[0172] S512 : The integrated development apparatus 102 sends a code pull request to the remote code repository 104 in response to the code pull operation triggered by the second developer.

[0173] In a specific implementation, the second developer needs to obtain the code submitted by the first developer in order to develop a program based on the code. Specifically, the second developer can trigger a code pull operation through the integrated development device 102, and the integrated development device 102 sends a code pull request to the remote code repository 104 in response to the code pull operation.

[0174] The second developer can access the remote code repository 104 through the integrated development device 102, and the remote code repository 104 can display the code submitted by the first developer of at least one program development project group and the corresponding submission identifier. Based on this, the second developer can trigger a code pull operation for the code submitted by the first developer who belongs to the same program development project group as the second developer. In response to the code pull operation, the integrated development device 102 generates a code pull request according to the submission identifier corresponding to the code submitted by the first developer, and sends the code pull request to the remote code repository 104.

[0175] S514: The remote code repository 104 sends the code submitted by the first developer and the corresponding submission identifier to the integrated development device 102.

[0176] The remote code repository 104 determines the code requested by the integrated development device 102, that is, the code submitted by the first developer, based on the code pull request, specifically the submission identifier included in the code pull request. Then, the remote code repository 104 sends the code and the corresponding submission identifier to the integrated development device 102.

[0177] S516 : The integrated development device 102 sends an index acquisition request to the indexing device 106 .

[0178] The integrated development device 102 also sends an index acquisition request to the index device 106 to obtain the full index corresponding to the code submitted by the first developer from the index device 106. In a specific implementation, the second developer can access the index device 106 through the integrated development device 102, and the index device 106 can display the full index created for the code submitted by developers in different program development project groups.

[0179] Based on this, the second developer can trigger an index acquisition operation corresponding to the code submitted by the first developer of the program development project group, generate an index acquisition request according to the submission identifier corresponding to the code submitted by the first developer, and send the index acquisition request to the indexing device 106.

[0180] S518: The indexing device 106 sends the full index of the code submitted by the first developer to the integrated development device 102.

[0181] The remote code repository 104 determines the index requested by the integrated development device 102 , that is, the full index corresponding to the code submitted by the first developer, according to the submission identifier included in the index acquisition request. Then, the indexing device 106 sends the full index corresponding to the code to the integrated development device 102 .

[0182] S520: The integrated development device 102 stores the code and the corresponding submission identifier and full index.

[0183] When the integrated development device 102 stores the code, submission identifier, and full index, it also stores the correspondence between the code, submission identifier, and full index, so as to query or obtain the code, submission identifier, and full index based on the correspondence. In this way, when the developer develops a program based on the integrated development device 102, the integrated development device 102 can provide programming language-related services based on the full index, including syntax checking, lexical checking, automatic completion, and jump services for functions, variables, and constants.

[0184] S522: The integrated development device 102 receives the code modification settings made by the second developer.

[0185] Furthermore, after obtaining the code submitted by the first developer, the second developer can use the integrated development device to modify the code submitted by the first developer. For example, based on the code submitted by the first developer, add new code, modify code, or delete code, etc. Correspondingly, the integrated development device 102 receives the modification settings of the code by the second developer.

[0186] S524: The integrated development device 102 creates an incremental index according to the modified code.

[0187] Specifically, before the modified code is submitted to the remote code repository 104, the integrated development device 102 can create an index based on the modified code, and the index created by the integrated development device 102 is an incremental index. The process of the integrated development device 102 creating an index can be referred to the description of S508, which will not be repeated here.

[0188] It should be noted that the integrated development device 102 only needs to create indexes for the modified codes, and does not need to create indexes for all codes. On the one hand, it reduces the occupation of system resources, and on the other hand, it saves the time required to create indexes for all codes locally.

[0189] S526: The integrated development device 102 stores the modified code and the incremental index.

[0190] When storing the modified code and the incremental index, the integrated development device 102 may store the correspondence between the modified code and the incremental index, so as to perform operations such as index search or index acquisition based on the above correspondence.

[0191] Furthermore, when the modified code is submitted to the remote code repository 104, the hook module 1044 in the remote code repository 104 can send a notification message to the indexing device 106 to notify the occurrence of the event of submitting the code to the remote code repository 104. The indexing device 106 can obtain the submitted code and create a full index based on all submitted code.

[0192] It should be noted that the code index management method provided in the embodiment of the present application can be divided into three stages. In the first stage, the indexing device 106 creates a corresponding full index based on the code submitted by the first developer. In the second stage, the integrated development device 102 obtains the full index corresponding to the code submitted by the first developer from the indexing device 106. In the third stage, the integrated development device 102 creates an incremental index based on local code changes.

[0193] Based on the above description, the embodiment of the present application provides a code index management method, which supports the remote indexing device 106 to create a full index based on the code submitted to the remote code repository 104. In this way, when the developer pulls the code from the remote code repository 104 for program development, the full index corresponding to the above code can be obtained from the indexing device 106 without creating a full index locally, which solves the problem of occupying a large amount of local system resources, improves the indexing success rate, and enables lightweight IDEs to be used for large-scale program development. Furthermore, when there are local code changes, the IDE can create an incremental index based on the changed code. The IDE does not need to occupy a large amount of local system resources to obtain the latest index, which improves the reliability of the indexing service.

[0194] Taking into account that the program development process may be interrupted, for example, the developer has other affairs that cause the program development process to be interrupted, or the current program development project is interrupted due to an exception, the developer can restart the IDE. Based on this, the IDE can refresh the index stored in the IDE according to the full index stored by the indexing device 106. In addition, when an error occurs in the language service, the IDE can also refresh the index stored in the IDE according to the full index stored by the indexing device 106. The developer can also configure the refresh cycle, and the IDE can refresh the index stored in the IDE according to the full index stored by the indexing device 106 according to the refresh cycle.

[0195] For ease of understanding, the following Figure 5 The index refresh process of the integrated development device 102 in the illustrated embodiment introduces the code index management method provided in the embodiment of the present application.

[0196] See also Figure 6 The flowchart of the code index management method shown in FIG. 1 includes:

[0197] S602 : The integrated development device 102 sends a submission identification query request to the indexing device 106 .

[0198] The submission identifier query request is used to request to query the submission identifier that was most recently submitted to the remote code repository 104. In a specific implementation, the submission identifier query request may include an identifier list formed by the submission identifiers stored by the integrated development device 102. The submission identifiers in the identifier list may be sorted according to the submission time, for example, the submission identifiers may be filled into a table in the order of submission time from the latest to the earliest to form an identifier list.

[0199] After receiving the developer's code modification settings, the integrated development device 102 can also perform hash calculation on the modified code to obtain a hash value as a commit ID to distinguish the code submitted at different times. That is, the commit ID can be a hash value (commit hash) determined based on the modified code.

[0200] Based on this, the submission identifiers stored in the integrated development device 102 may include not only submission identifiers submitted to the remote code repository 104, but also submission identifiers not submitted to the remote code repository 104. Among them, the submission identifiers not submitted to the remote code repository 104 may include at least one of the submission identifiers submitted to the local code repository, or the submission identifiers determined when the code is added to the temporary storage area.

[0201] Furthermore, when the integrated development device 102 stores multiple submission identifiers, considering the data transmission overhead, the integrated development device 102 can generate multiple identifier lists based on the multiple identifiers, and send the identifier lists in sequence in multiple transmissions. When the indexing device 104 determines the latest submission identifier submitted to the remote code repository 104, the integrated development device 102 can stop sending the identifier list. Compared with sending the identifier list including all identifiers at one time, this method can significantly reduce the resource overhead of transmitting the identifier list.

[0202] It should be noted that, in order to improve the query efficiency, the integrated opening device 102 can also increase the number of submitted identifiers included in the identifier list sent this time on the basis of the number of submitted identifiers included in the identifier list sent last time when sending the identifier list. For example, the number of submitted identifiers included in the identifier list sent this time can be twice the number of submitted identifiers included in the identifier list sent last time.

[0203] S604 : the indexing device 106 queries the submission identifier of the latest submission to the remote code repository 104 .

[0204] The indexing device 106 stores the submission identifiers submitted by all developers to the remote code repository. The intersection of the submission identifiers stored by the indexing device 106 and the submission identifiers stored by the integrated development device 102 is the submission identifier submitted by the second developer corresponding to the integrated development device 102 to the remote code repository 104. The indexing device 106 selects the submission identifier with the latest submission time from the above intersection to obtain the submission identifier submitted to the remote code repository 104 the latest.

[0205] In a specific implementation, the identification list sent by the integrated development device 102 is sorted in order from the latest submission time to the earliest submission time, and the indexing device 106 can sequentially query whether the submission identification included in the identification list sent by the integrated development device 102 exists in the indexing device 106, and if so, it is determined that the submission identification is the latest submission identification submitted to the remote code repository 104. If not, the indexing device 106 can instruct the integrated development device 102 to continue sending the identification list, and then the indexing device 106 can continue to perform the above query operation until the latest submission identification submitted to the remote code repository 104 is determined.

[0206] For ease of understanding, the explanation is provided in conjunction with a specific example. In one example, the integrated development device 102 stores 1,000 commit hashes, which are numbered from 0 to 999 in order from the last to the first time. The integrated development device 102 may first send 100 commit hashes numbered from 0 to 99 to the indexing device 106, and the indexing device 106 sequentially queries whether these 100 commit hashes exist in the hash list on the indexing device 106 side. If so, the first commit hash determined to exist in the hash list on the indexing device 106 side is determined as the latest commit hash submitted to the remote code repository 104. If not, the integrated development device 102 sends 200 commit hashes numbered from 100 to 299, and the indexing device 106 queries whether these 200 commit hashes exist in the hash list on the indexing device 106 side. And so on, which will not be repeated here.

[0207] S606 : the indexing device 106 sends the latest submission identifier submitted to the remote code repository 104 to the integrated development device 102 .

[0208] S608: The integrated development device 102 determines whether the integrated development device 102 stores a corresponding index according to the latest submission identifier submitted to the remote code repository 104 and the previous submission identifiers.

[0209] When the index corresponding to the latest submission identifier submitted to the remote code repository 104 and the previous submission identifiers is not stored in the integrated development device 102, for the convenience of description, the above-mentioned unstored index is called the target index.

[0210] S610 : The integrated development device 102 sends an index acquisition request to the indexing device 106 .

[0211] The index acquisition request is used to request to acquire the target index determined in S608 . The target index is the index corresponding to the latest submission identifier submitted to the remote code repository 104 and the previous submission identifiers and is not stored in the integrated development device 102 .

[0212] S612: The indexing device 106 sends the target index to the integrated development device 102 in response to the index acquisition request.

[0213] The indexing device 106 queries the full index according to the latest submission identifier submitted to the remote code repository 104 and the previous submission identifiers, obtains the target index from the full index, and then sends the target index to the integrated development device 102 .

[0214] S614: The integrated development device 102 stores the target index.

[0215] Specifically, the integrated development device 102 may store the target index in an index cache, thereby refreshing the index in the integrated development device 102. For ease of understanding, the present application also provides a specific example for illustration.

[0216] like Figure 7 As shown, it shows an identification list formed by the submission identifications stored on the integrated development device 102 and the indexing device 106. The indexing device 106 determines the latest submission identification submitted to the remote code repository 104 by comparing the identification list on the integrated development device 102 side with the identification list on the indexing device 106 side. In this example, the latest submission identification submitted to the remote code repository 104 may be 3bd1323f.

[0217] In the identifier list on the integrated development device 102 side, the identifier above the latest submission identifier submitted to the remote code repository 104, such as d331c1fd, is a submission identifier for which the remote submission operation has not been performed. In the identifier list on the indexing device 106 side, the identifier above the latest submission identifier submitted to the remote code repository 104, such as 345bd321, is a submission identifier submitted to the remote code repository 104 by other developers.

[0218] The integrated development device 102 queries whether a corresponding index is stored on the integrated development device 102 side based on the identification list on the integrated development device 102 side, the latest submission identification submitted to the remote code repository 104, and the previous submission identification. If not stored, the corresponding index is obtained from the full index stored in the index device 106 based on the submission identification, and stored in the index cache to refresh the index of the integrated development device 102.

[0219] In some possible implementations, if the identification list on the integrated development device 102 side is empty, the integrated development device 102 may not execute the above S602 to S608, and directly obtain the full index from the indexing device 106. In other possible implementations, if the integrated development device 102 does not have a submission identification submitted to the remote code repository 104, the integrated development device 102 may not execute the above S610 to S614.

[0220] Combination of the above Figures 1 to 7 The code index management method provided by the present application is introduced. Next, the relevant devices and equipment provided by the present application will be introduced in conjunction with the accompanying drawings.

[0221] See also Figure 2 The structural diagram of the indexing device 106 shown in FIG. 1 includes:

[0222] The communication module 1062 is used to obtain the code from the remote code repository 104;

[0223] An index creation module 1064, configured to create a full index of the code according to the code;

[0224] Storage module 1068, used to store the full index of the code;

[0225] The communication module 1062 is further configured to send a full index of the code to the integrated development device 102 .

[0226] In some possible implementations, the index creation module 1064 is specifically used to:

[0227] A full index of the code is created before the integrated development device receives the code.

[0228] In some possible implementations, the remote code repository 104 further stores a submission identifier of the code, and the storage module 1068 further stores a correspondence between the submission identifier of the code and a full index of the code;

[0229] The communication module 1062 is also used for:

[0230] Receiving an index acquisition request from the integrated development device 102, wherein the index acquisition request includes a submission identifier of the code;

[0231] According to the submission identifier of the code, a full index of the code is sent to the integrated development device 102.

[0232] In some possible implementations, the apparatus 106 further includes an index management module 1066;

[0233] The communication module 1062 is further configured to receive a submission identification query request from the integrated development device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device;

[0234] The index management module 1066 is used to determine the submission identifier of the latest submission to the remote code repository according to the identifier list;

[0235] The communication module 1062 is also used to return the submission identifier of the latest submission to the remote code repository to the integrated development device, so that the integrated development device obtains the target index according to the submission identifier of the latest submission to the remote code repository, and the target index is the index corresponding to the code submitted by the integrated development device to the remote code repository, and is an index not stored by the integrated development device.

[0236] In some possible implementations, the submission identification query request includes an identification list formed by N submission identifications with earlier submission times among the submission identifications stored in the integrated development device, where N is a positive integer;

[0237] The index management module 1066 is specifically used for:

[0238] querying in sequence whether the N submission identifiers exist in the submission identifiers stored in the indexing device;

[0239] If not, the integrated development device is instructed to send the next submission identifier query request until the index device queries that the submission identifier included in the submission identifier query request exists in the submission identifiers stored in the index device, and the next submission identifier query request includes M submission identifiers whose submission time is after the submission time of the submission identifier included in the current submission identifier query request, and M is greater than or equal to N.

[0240] Next, see Figure 2 The structure diagram of an integrated development device 102 is shown, and the integrated development device 102 includes:

[0241] The communication module 1026 is used to receive the code sent by the remote code repository 104 and receive the full index of the code sent by the indexing device 106;

[0242] The storage module 1028 is used to store the code and the full index of the code.

[0243] In some possible implementations, the remote code repository 104 further stores a submission identifier of the code, and the indexing device 106 further stores a correspondence between the submission identifier of the code and a full index of the code;

[0244] The communication module 1026 is also used for:

[0245] An index acquisition request is sent to the indexing device 106, wherein the index acquisition request includes the submission identifier of the code, so that the indexing device 106 sends a full index of the code according to the submission identifier of the code.

[0246] In some possible implementations, the device 102 further includes:

[0247] The basic development module 1022 is used for the integrated development device to receive the modification settings of the code and obtain the modified code;

[0248] The language service module 1024 is used to create an incremental index according to the modified code before submitting the modified code to the remote code repository, and store the modified code and the incremental index corresponding to the modified code.

[0249] In some possible implementations, it is characterized in that the communication module 1026 is further used for:

[0250] Sending a submission identification query request to the indexing device, wherein the submission identification query request includes an identification list formed by the submission identifications stored in the integrated development device;

[0251] Receiving a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list;

[0252] According to the submission identifier of the latest submission to the remote code repository, a target index is obtained, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

[0253] According to the embodiment of the present application, the indexing device 106 and the integrated development device 102 may correspond to executing the method described in the embodiment of the present application, and the above and other operations and / or functions of each module in the integrated development device 102 and the indexing device 106 are respectively to implement Figure 5 to Figure 6 For the sake of brevity, the corresponding processes of each method in are not repeated here.

[0254] Figures 8 to 9 A device is also provided. Figure 8 The device 800 shown can be specifically used to implement the above Figure 2 The function of the indexing device 106 in the embodiment shown is: Fig. 9 The device 900 shown can be specifically used to implement the above Figure 2 In the illustrated embodiment, the functionality of the development device 102 is integrated.

[0255] Device 800 includes bus 801, processor 802, communication interface 803 and memory 804. Processor 802, memory 804 and communication interface 803 communicate through bus 801. Bus 801 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The communication interface 803 is used to communicate with the outside, such as receiving a notification message indicating an event of submitting code to the remote code repository 104, obtaining code from the remote code repository 104, and the like.

[0256] The processor 802 may be a central processing unit (CPU). The memory 804 may include a volatile memory, such as a random access memory (RAM). The memory 804 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a HDD or a SSD.

[0257] The memory 804 stores executable codes, and the processor 802 executes the executable codes to perform the aforementioned code index management method.

[0258] Specifically, in implementing Figure 2 In the case of the embodiment shown, and Figure 2 When each module described in the embodiment is implemented by software, Figure 2 The software or program code required for the index creation module 1064 and the index management module 1066 functions are stored in the memory 804. The storage module 1068 can be a storage space in the memory 804, in which the code and the corresponding submission identifier and the full index are stored. The communication module 1062 function is implemented through the communication interface 803. The processor 802 is used to execute the instructions in the memory 804 and execute the code index management method applied to the indexing device 106.

[0259] The device 900 includes a bus 901, a processor 902, a communication interface 903, and a memory 904. The processor 902, the memory 904, and the communication interface 903 communicate with each other via the bus 901. Figure 2In the case of the embodiment shown, and Figure 2 When each module described in the embodiment is implemented by software, the software or program code required for the basic development module 1022 and the language service module 1024 functions in Execution 2 is stored in the memory 904. The storage module 1028 can be a storage space in the memory 904, in which the code and the corresponding submission identifier and the full index and incremental index are stored. The function of the communication module 1026 is implemented through the communication interface 903. The processor 902 is used to execute the instructions in the memory 904 and execute the code index management method applied to the integrated development device 102.

[0260] The embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on a computer, enables the computer to execute the code index management and resolution method applied to the indexing device 106 .

[0261] The embodiment of the present application further provides a computer-readable storage medium, including instructions, which, when executed on a computer, enables the computer to execute the above-mentioned code index management method applied to the integrated development device 102.

[0262] The embodiment of the present application also provides a computer program product, and when the computer program product is executed by a computer, the computer executes any of the aforementioned code index management methods. The computer program product can be a software installation package, and when any of the aforementioned code index management methods is needed, the computer program product can be downloaded and executed on a computer.

[0263] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0264] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0265] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0266] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A code index management method, characterized in that: include: The remote code repository receives the code submitted by the code version control device; The indexing device obtains the code from the remote code repository; The indexing device creates a full index of the code according to the code, and stores the full index of the code; The remote code repository sends the code to an integrated development device; The indexing device sends the full index of the code to the integrated development device; The integrated development device receives the modification setting of the code and obtains the modified code; Before submitting the modified code to the remote code repository, the integrated development device creates an incremental index according to the modified code, and stores the modified code and the incremental index corresponding to the modified code.

2. The method according to claim 1, characterized in that The indexing device creates a full index of the code before the integrated development device receives the code.

3. The method according to claim 1 or 2, characterized in that: The remote code repository further stores a submission identifier of the code, and the indexing device further stores a correspondence between the submission identifier of the code and a full index of the code; The remote code repository sends the code to the integrated development device, including: The remote code repository sends the code and a submission identifier of the code to an integrated development device; The method further comprises: The integrated development device sends an index acquisition request to the index device, wherein the index acquisition request includes a submission identifier of the code; The indexing device sends the full index of the code to the integrated development device, including: The indexing device sends a full index of the code to the integrated development device according to the submission identifier of the code.

4. The method according to claim 3, characterized in that The method further comprises: The integrated development device sends a submission identification query request to the index device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device; The indexing device determines the submission identifier of the latest submission to the remote code repository according to the identifier list, and returns the submission identifier of the latest submission to the remote code repository to the integrated development device; The integrated development device obtains a target index according to the submission identifier of the latest submission to the remote code repository, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

5. A code index management method, characterized in that: The method comprises: After the remote code repository receives the submitted code, the indexing device obtains the code from the remote code repository; The indexing device creates a full index of the code according to the code, and stores the full index of the code; The indexing device receives an index acquisition request sent by the integrated development device, wherein the index acquisition request is used to acquire a full index of the code; The indexing device sends the full index of the code to the integrated development device according to the index acquisition request; The indexing device receives a submission identification query request from the integrated development device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device; The indexing device determines the submission identifier of the latest submission to the remote code repository according to the identifier list; The indexing device returns the submission identifier of the latest submission to the remote code repository to the integrated development device, so that the integrated development device obtains a target index based on the submission identifier of the latest submission to the remote code repository, wherein the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is an index not stored by the integrated development device.

6. The method according to claim 5, characterized in that The indexing device creates a full index of the code before the integrated development device sends the index acquisition request.

7. A code index management method, characterized in that: The method comprises: The integrated development device obtains the code stored in the remote code repository and the submission identifier of the code; The integrated development device sends an index acquisition request to the index device, wherein the index acquisition request includes the submission identifier of the code, and the index device stores a correspondence between the full index of the code and the submission identifier of the code; The integrated development device receives the full index of the code determined by the indexing device according to the submission identifier of the code; The integrated development device receives the modification setting of the code and obtains the modified code; Before the modified code is submitted to the remote code repository, the integrated development device creates an incremental index according to the modified code, and stores the modified code and the incremental index corresponding to the modified code.

8. The method according to claim 7, characterized in that The method further comprises: The integrated development device sends a submission identification query request to the index device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device; The integrated development device receives a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list; The integrated development device obtains a target index according to the submission identifier of the latest submission to the remote code repository, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

9. A code index management system, characterized in that: The code index management system comprises: Remote code repository, used to receive code submitted by code version control device; An indexing device, configured to obtain the code from the remote code repository, create a full index of the code based on the code, and store the full index of the code; The remote code repository is also used to send the code to the integrated development device; The indexing device is further used to send the full index of the code to the integrated development device; The integrated development device is also used for: Receiving a modification setting of the code and obtaining the modified code; Before the modified code is submitted to the remote code repository, an incremental index is created according to the modified code, and the modified code and the incremental index corresponding to the modified code are stored.

10. The code index management system according to claim 9, characterized in that: The indexing device is specifically used for: A full index of the code is created before the integrated development device receives the code.

11. The code index management system according to claim 9, characterized in that: The remote code repository further stores a submission identifier of the code, and the indexing device further stores a correspondence between the submission identifier of the code and a full index of the code; The remote code repository is specifically used for: Sending the code and a submission identifier of the code to an integrated development device; The code index management system also includes: The integrated development device is used to send an index acquisition request to the index device, wherein the index acquisition request includes a submission identifier of the code; The indexing device is specifically used for: According to the submission identifier of the code, a full index of the code is sent to the integrated development device.

12. The code index management system according to claim 11, characterized in that: The integrated development device is also used for: Sending a submission identification query request to the indexing device, wherein the submission identification query request includes an identification list formed by the submission identifications stored in the integrated development device; Receiving a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list; According to the submission identifier of the latest submission to the remote code repository, a target index is obtained, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

13. An indexing device, characterized in that: The indexing device comprises: Communication module, used to obtain code from remote code repositories; An index creation module, used to create a full index of the code according to the code; A storage module, used to store the full index of the code; The communication module is further used to send the full index of the code to the integrated development device; The communication module is further used to receive a submission identification query request from the integrated development device, wherein the submission identification query request includes an identification list formed by submission identifications stored in the integrated development device; An index management module, configured to determine the latest submission identifier submitted to the remote code repository according to the identifier list; The communication module is also used to return the submission identifier of the latest submission to the remote code repository to the integrated development device, so that the integrated development device obtains the target index according to the submission identifier of the latest submission to the remote code repository, and the target index is the index corresponding to the code submitted by the integrated development device to the remote code repository, and is an index not stored by the integrated development device.

14. The device according to claim 13, characterized in that The index creation module is specifically used for: A full index of the code is created before the integrated development device receives the code.

15. The device according to claim 13 or 14, characterized in that The remote code repository also stores a submission identifier of the code, and the storage module also stores a correspondence between the submission identifier of the code and a full index of the code; The communication module is also used for: Receiving an index acquisition request from an integrated development device, wherein the index acquisition request includes a submission identifier of the code; According to the submission identifier of the code, a full index of the code is sent to the integrated development device.

16. An integrated development device, characterized in that: The device comprises: A communication module, used to receive the code sent by the remote code repository, and receive the full index of the code sent by the indexing device; A storage module, used to store the code and a full index related to the code; A basic development module, used for receiving a modification setting of the code and obtaining the modified code; The language service module is used to create an incremental index according to the modified code before submitting the modified code to the remote code repository, and store the modified code and the incremental index corresponding to the modified code.

17. The device according to claim 16, characterized in that The remote code repository further stores a submission identifier of the code, and the indexing device further stores a correspondence between the submission identifier of the code and a full index of the code; The communication module is also used for: An index acquisition request is sent to the indexing device, wherein the index acquisition request includes a submission identifier of the code, so that the indexing device sends a full index of the code according to the submission identifier of the code.

18. The device according to claim 17, characterized in that The communication module is also used for: Sending a submission identification query request to the indexing device, wherein the submission identification query request includes an identification list formed by the submission identifications stored in the integrated development device; Receiving a submission identifier of the latest submission to the remote code repository determined by the indexing device according to the identification list; According to the submission identifier of the latest submission to the remote code repository, a target index is obtained, where the target index is an index corresponding to the code submitted by the integrated development device to the remote code repository and is not stored by the integrated development device.

19. A computer, characterized in that: The computer includes a processor and a memory; The processor is used to execute instructions stored in the memory to perform the code index management method as described in claim 5 or 6.

20. A computer, characterized in that: The computer includes a processor and a memory; The processor is used to execute instructions stored in the memory to execute the code index management method as described in claim 7 or 8.

21. A computer-readable storage medium, characterized in that: The method comprises instructions which, when executed on a computer, enable the computer to execute the code index management method as claimed in claim 5 or 6.

22. A computer-readable storage medium, characterized in that: The method comprises instructions which, when executed on a computer, cause the computer to execute the code index management method as claimed in claim 7 or 8.