Code processing method, device and system
By monitoring the editing interface in the code editor and providing a set of component code snippets, the reuse and management of code snippets is solved, and the problem of strong dependence on code reuse in the existing technology is solved, simplifying code management and improving development efficiency .
Patent Information
- Application Number
- CN202310650898.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-02
- Publication Date
- 2024-12-03
AI Technical Summary
Existing code reuse technology has strong dependence on annotated documents and user manuals, resulting in complex code management and maintenance. Developers need to be familiar with the manual to flexibly use base classes or functional functions.
By listening to the editing interface in the code editor, providing a collection of component code snippets lists, and receiving the insertion operation of the target component code snippets, introducing them into the editing interface, replacing index symbols, and realizing the reuse and management of code snippets.
It simplifies code management and maintenance, improves the feasibility of code reuse, reduces dependence on annotated documents, and improves development efficiency.
Smart Images

Figure CN119065660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of code development technology, and in particular to a code processing method, device and system. Background Art
[0002] Reusing code or components developed by code is an important means to improve the development efficiency of code or components. At present, the main way to reuse code or components developed by code is to extract and encapsulate the reused base classes or functions separately, and then make code comments or generate user manuals for the use of these base classes or function functions. Developers need to be familiar with the user manuals or code comments to use the base classes or function functions more flexibly, which makes code reuse highly dependent on the integration of annotation documents or user manuals with resources, making management and maintenance more complicated. Summary of the invention
[0003] In view of this, embodiments of the present invention provide a code processing method, device and system, which can effectively simplify code management and maintenance to improve the feasibility of code reuse.
[0004] To achieve the above object, according to one aspect of an embodiment of the present invention, a code processing method is provided, which is applied to a code editor, and includes:
[0005] For a code development task being edited in the code editor, monitoring an editing interface of the code editor;
[0006] In case of monitoring the input of the index symbol in the editing interface, providing a list set including one or more component code snippets corresponding to the code development task;
[0007] receiving an insert operation for a target component code snippet in the list set;
[0008] The target component code snippet is introduced into the editing interface, and the index symbol is replaced, so as to reuse the target component code snippet into the code of the code development task.
[0009] Optionally, providing a list set of one or more component code snippets corresponding to the corresponding code development task includes:
[0010] Providing a guide symbol through the editing interface, wherein the guide symbol indicates a root directory or a link address or a storage folder corresponding to the list set of the code development tasks;
[0011] When a trigger operation for the guidance symbol is received, the root directory or the link address or the storage folder indicated by the guidance symbol is accessed, and one or more component code snippets contained in the list set under the root directory or the link address or the storage folder and the description information of the component code snippets are displayed.
[0012] Optionally, the above code processing method further includes:
[0013] When a trigger operation is received for a specific position in the target component code snippet introduced into the editing interface, the comments, parameter descriptions and configuration information of the target component code snippet are displayed to adjust the target component code snippet introduced into the editing interface based on the comments, parameter descriptions and configuration information.
[0014] Optionally, the above code processing method further includes: providing a resource integration entry;
[0015] In response to the triggering operation on the resource integration portal, the step of displaying the annotations, parameter descriptions and configuration information of the target component code snippet is performed through the resource integration area or the resource integration page.
[0016] Optionally, the above code processing method further includes:
[0017] Upon monitoring an adding operation of any component code snippet input into the editing interface of the code editor, providing an information guide for interactive operation, so as to input comments, parameter descriptions and configuration information of the component code snippet based on the information guide;
[0018] Obtaining comments, parameter descriptions, and configuration information of the component code snippet input by the information guide;
[0019] The annotation, the parameter description and the configuration information are stored in a root directory or a link address or a storage folder corresponding to the component code snippet, and the list set is updated.
[0020] Optionally, the above code processing method further includes:
[0021] After receiving the activation trigger, a list set of code development tasks is obtained from the code hosting platform, and the list set is stored in the directory of the code editor;
[0022] In the case of monitoring the input of an index symbol in the editing interface, searching for the list set in the directory of the code editor.
[0023] Optionally, the above code processing method further includes:
[0024] Monitor the list set of the code hosting platform;
[0025] When an update of the list set of the code hosting platform is monitored, the list set stored in the directory of the code editor is updated using the list set of the code hosting platform.
[0026] Optionally, the above code processing method is implemented based on a method provided by VS Code Extension.
[0027] Optionally, the above code processing method further includes:
[0028] Registering a programming environment for a code development task based on the Context.subscriptions method API provided by the VS Code Extension, and generating a root directory and an environment configuration file under the root directory for the registered programming environment, so as to configure parameters of the programming environment and the list set through the environment configuration file;
[0029] Based on the provideCodeActions method provided by the VS Code Extension, an asynchronous callback is declared and encapsulated to read the parameters configured in the environment configuration file under the root directory and the list set through the asynchronous callback;
[0030] Based on the new vscode.CodeAction method provided by the VS Code Extension, the step of providing a list set containing one or more component code snippets corresponding to the code development task is implemented.
[0031] Optionally, the above code processing method further includes:
[0032] Based on the API lineAt() provided by the vscode.TextDocument object in the VS Code Extension, it is implemented to monitor whether an index symbol is input in the editing interface of the code editor.
[0033] In a second aspect, an embodiment of the present invention provides a code processing device, which is applied to a code editor, and includes: a monitoring unit, a code fragment management unit, and a code reuse unit, wherein:
[0034] The monitoring unit is used to monitor the editing interface of the code editor for the code development task being edited in the code editor;
[0035] The code snippet management unit is configured to provide a list set including one or more component code snippets corresponding to the code development task when an index symbol is inputted into the editing interface;
[0036] The code reuse unit is used to receive an insertion operation for a target component code snippet in a list set provided by the code snippet management unit; introduce the target component code snippet into the editing interface, and replace the index symbol to reuse the target component code snippet into the code of the code development task.
[0037] In a third aspect, an embodiment of the present invention provides a code processing system, including: a code editor including the code processing device provided by the embodiment of the second aspect and a code hosting platform, wherein:
[0038] The code hosting platform is communicatively connected to the code editor and is used to manage a list set of the code processing devices included in the connected code editor.
[0039] An embodiment of the above invention has the following advantages or beneficial effects: for a code development task being edited in a code editor, by monitoring the editing interface of the code editor, when an index symbol is input in the editing interface, a list set containing one or more component code snippets corresponding to the code development task is provided, and an insert operation for a target component code snippet in the list set is received; the target component code snippet is introduced into the editing interface, and the index symbol is replaced to reuse the target component code snippet into the code of the code development task, that is, the reusable component code snippets are managed through a list set, and the list set is given through index symbols, which effectively simplifies code management and maintenance to improve the feasibility of code reuse.
[0040] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0042] Figure 1 is a schematic diagram of the main flow of a code processing method applied to a code editor according to an embodiment of the present invention;
[0043] Figure 2 is a schematic diagram of a main process of providing a list set according to an embodiment of the present invention;
[0044] Figure 3 is a main flow chart of adding a reusable component code snippet to a list set according to an embodiment of the present invention;
[0045] Figure 4 is a schematic diagram of a main process of using a list set according to an embodiment of the present invention;
[0046] Figure 5 is a schematic diagram of main units of a code processing device according to an embodiment of the present invention;
[0047] Figure 6 is a schematic diagram of main devices of a code processing system according to an embodiment of the present invention;
[0048] Figure 7 is a schematic diagram of the main flow of a code processing method according to another embodiment of the present invention;
[0049] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0050] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0052] Figure 1 FIG. 1 is a schematic diagram of the main flow of a code processing method applied to a code editor according to an embodiment of the present invention. Figure 1 As shown, the code processing method applied to the code editor may include the following steps:
[0053] Step S101: for a code development task being edited in a code editor, monitoring an editing interface corresponding to the code development task in the code editor;
[0054] Among them, code development tasks are generally tasks generated for each code development project by the code hosting platform in order to manage different code development projects, that is, a code development task can correspond to a complete code development project or a part of a code development project. For a code development task that can correspond to a complete code development project, development members belonging to the same code development project have the same code development task. Correspondingly, the code editors used by development members belonging to the same code development project all have the same code development task, so as to realize the unified management (integration or sharing, etc.) of the code belonging to the same code development task through the code hosting platform. In addition, a code editor can also have multiple code development tasks.
[0055] The code development task in editing refers to a code development task corresponding to the code of the development project corresponding to the code development task which is currently displayed on the editing interface of the code editor or the code development task corresponding to the code that the developer is editing using the editing interface of the code editor.
[0056] Step S102: when an index symbol is inputted in the editing interface, a list set including one or more component code snippets corresponding to the code development task is provided;
[0057] The index symbol can be a predefined symbol or a combination of multiple symbols that can be input through the keyboard. By monitoring the input index symbol, a list set containing one or more component code snippets is provided to facilitate retrieval of the list set, so that users can easily retrieve the component code snippets that need to be reused.
[0058] Among them, the component code snippet generally refers to the code snippet needed to develop a component, such as a specific button, a function key of a page, etc., and some information such as parameters in the component code snippet can be adjusted accordingly according to the needs. For example, the component code snippet can be a template code snippet such as vue, php, and react.
[0059] Step S103: receiving an insert operation for a target component code snippet in the list set;
[0060] The insert operation refers to a predefined user operation that can insert a component code snippet into the editing interface and replace an index symbol.
[0061] Step S104: import the target component code snippet into the editing interface and replace the index symbol to reuse the target component code snippet into the code of the code development task.
[0062] exist Figure 1In the illustrated embodiment, for a code development task being edited in a code editor, by monitoring the editing interface of the code editor, when an index symbol is input in the editing interface, a list set containing one or more component code snippets corresponding to the code development task is provided, and an insert operation for a target component code snippet in the list set is received; the target component code snippet is introduced into the editing interface, and the index symbol is replaced so as to reuse the target component code snippet into the code of the code development task, that is, the reusable component code snippets are managed through a list set, and the list set is given through index symbols, thereby effectively simplifying code management and maintenance to improve the feasibility of code reuse.
[0063] In addition, the above process realizes unified management of component codes to improve the reuse rate of component codes.
[0064] It is worth noting that the above code processing method is generally applied to a code editor in the form of a plug-in to facilitate the use of the above code processing method.
[0065] In addition, in addition to the above-mentioned management and reuse of component code snippets, function class code snippets and the like can also be managed and reused.
[0066] In particular, through the management, import and reuse process of the component code snippet, code developers of specific languages (such as PHP / Vue / React / Reactive and other languages containing template classes) can be better served.
[0067] Specifically, Figure 2 As shown, the specific implementation of providing a list set containing one or more component code snippets corresponding to the corresponding code development task may include the following steps:
[0068] Step S201: providing a guide symbol through an editing interface, wherein the guide symbol indicates a root directory or a link address or a storage folder of a list set corresponding to a code development task;
[0069] The guide symbol can be used to guide the user to obtain the list set, so as to facilitate the user operation.
[0070] Step S202: When a trigger operation for a guidance symbol is received, the root directory or link address or storage folder indicated by the guidance symbol is accessed, and one or more component code snippets and description information of the component code snippets contained in the list set under the root directory or link address or storage folder are displayed.
[0071] Through the above process, a list collection is provided to the user through guide symbols, which facilitates the management of the list collection.
[0072] Further, the above code processing method may further include: in the case of receiving a trigger operation for a specific position in the target component code snippet introduced into the editing interface, displaying the annotations, parameter descriptions and configuration information of the target component code snippet, so as to adjust the target component code snippet introduced into the editing interface based on the annotations, parameter descriptions and configuration information. Among them, the trigger operation can be a mouse hovering at a specific position or a click operation on a specific position, selecting a component code snippet, moving the mouse up, console output, etc. Through the annotations, parameter descriptions and configuration information, the user can be provided with instructions for use of the component code snippet, so that the user can adjust the parameters in the target component code snippet based on these, so as to facilitate the user's editing operation on the target component code snippet. In addition, by displaying the necessary information such as the annotations, parameter descriptions and configuration information of the component code snippet, this information is provided to the developer more intuitively, so that the developer can directly use or adjust the components required for the component code snippet development based on the displayed information, so that the use and reuse of the component code snippet is more convenient. In addition, by freely controlling the display of this information, development time can be saved and development efficiency can be improved.
[0073] It is worth noting that the necessary information such as comments, parameter descriptions, and configuration information of the above-mentioned display component code snippets can be output to code developers in a variety of forms (such as floating layers, pop-up boxes, template introductions, etc.), so as to provide code developers with a more intuitive usage reference and facilitate the use of component code snippets.
[0074] In addition, the solution provided by the embodiment of the present invention shares a list set in the project dimension, so that the information, resources, etc. related to the components are highly integrated and collected.
[0075] In an embodiment of the present invention, the code processing method may further include: providing a resource integration portal; in response to a trigger operation on the resource integration portal, performing a step of displaying the annotations, parameter descriptions, and configuration information of the target component code snippet through the resource integration area or resource integration page. The setting of the resource integration portal can facilitate users to display the annotations, parameter descriptions, and configuration information of the component code snippet according to their needs, so that the editing interface is more operable.
[0076] In the embodiment of the present invention, Figure 3 As shown, the above code processing method may further include the following steps:
[0077] Step S301: when an adding operation of any component code snippet inputted into the editing interface of the code editor is monitored, an information guide for interactive operation is provided, so as to input comments, parameter descriptions and configuration information of the component code snippet based on the information guide;
[0078] The information guide is mainly a page that provides information navigation for adding reusable code snippets, so that users can add the required component code snippets and some required or optional information corresponding to the component code snippets according to the navigation.
[0079] Step S302: Obtain comments, parameter descriptions, and configuration information of the component code snippet input by the information guide;
[0080] Step S303: store the comments, parameter descriptions and configuration information in a corresponding root directory or link address or storage folder with the component code snippet, and update the list set.
[0081] The above process is used to update the list collection to better meet the needs of code reuse.
[0082] The above process of adding component code snippets is generally completed when a code development project is initially created, so that developers of the code development project can quickly import the shared list collection and continue to create new components, thereby better serving the developers of the code development project.
[0083] In addition, during the code development project development process, developers can add component code snippets according to actual needs.
[0084] In the embodiment of the present invention, Figure 4 As shown, the above code processing method may further include the following steps:
[0085] Step S401: after receiving the activation trigger, obtaining a list set of code development tasks from the code hosting platform, and storing the list set in a directory of the code editor;
[0086] After the activation trigger, a list collection of code development tasks is obtained to better meet user needs, that is, the user's monitoring authorization is obtained through the activation trigger, so that the monitoring process is carried out with the user's permission, and whether the index symbol is entered in the editing interface is monitored. The entire monitoring process does not involve the monitoring and collection of sensitive information.
[0087] In addition, the activation trigger can be performed at any stage or at any time of the code development project to better meet the needs of developers.
[0088] Step S402: When an index symbol is input in the editing interface, a list set is searched in the directory of the code editor.
[0089] In an embodiment of the present invention, the code processing method may further include: monitoring the list set of the code hosting platform; when monitoring the update of the list set of the code hosting platform, using the list set of the code hosting platform to update the list set stored in the directory of the code editor. Through this process, the list set stored in the directory of the code editor is updated online, so as to effectively improve the reuse rate of component code snippets.
[0090] Specifically, the above code processing method is implemented based on the method provided by VS Code Extension (code editing extension program). By implementing the method based on VS Code Extension, the existing code editor can be relatively compatible with the code processing method, so that the code processing method provided by the embodiment of the present invention has better use value.
[0091] Furthermore, the code processing method implemented based on the method provided by VS Code Extension can register the programming environment of the code development task based on the environment subscription method interface provided by VSCode Extension (such as Context.subscriptions method API), and generate a root directory and an environment configuration file under the root directory for the registered programming environment, so as to configure the parameters and list collection of the programming environment through the environment configuration file; based on the declaration and encapsulation methods provided by VS Code Extension (such as provideCodeActions method), declare and encapsulate asynchronous callbacks, so as to read the parameters and list collection configured in the environment configuration file under the root directory through asynchronous callbacks; based on the methods for code activation and management provided by VS Code Extension, such as (new vscode.CodeAction method), implement the step of providing a list collection containing one or more component code snippets corresponding to the code development task.
[0092] Among them, based on the API provided by the text file object in the VS Code Extension (such as the vscode.TextDocument object): lineAt() is used to monitor whether the editing interface of the code editor inputs an index symbol.
[0093] That is, the solution provided by the embodiment of the present invention is implemented through the method or API provided by the VS Code Extension, so that the solution provided by the embodiment of the present invention can be implemented simply, conveniently and at low cost. The solution provided by the embodiment of the present invention implemented based on the VS Code integrated environment can also reduce manual and human factors, improve code consistency based on business development, automatically bring out a set of code snippets shared by the same development task, select the target code snippet you want to use, and automatically bring out the reference method, annotations (data type, meaning, description, etc. of the formal parameter), and documentation, which is easier to read, manage and maintain. Code snippets can be complex, dynamically generated, have business logic, and are not limited to programming languages.
[0094] Figure 5 Schematic diagram of a code processing device provided by an embodiment of the present invention. Figure 5 As shown, the code processing device 500 is applied to a code editor and may include: a monitoring unit 501, a code fragment management unit 502 and a code reuse unit 503, wherein:
[0095] The monitoring unit 501 is used for monitoring the editing interface corresponding to the code development task in the code editor for the code development task being edited in the code editor;
[0096] The code snippet management unit 502 is used to provide a list set including one or more component code snippets corresponding to the code development task when an index symbol is inputted in the editing interface;
[0097] The code reuse unit 503 is used to receive an insert operation for a target component code snippet in the list set provided by the code snippet management unit 502; introduce the target component code snippet into the editing interface and replace the index symbol to reuse the target component code snippet into the code of the code development task.
[0098] In an embodiment of the present invention, the code snippet management unit 502 is further used to provide a guidance symbol through an editing interface, wherein the guidance symbol indicates a root directory or a link address or a storage folder of a list set corresponding to a code development task; when a trigger operation for the guidance symbol is received, the root directory or the link address or the storage folder indicated by the guidance symbol is accessed, and one or more component code snippets contained in the list set under the root directory or the link address or the storage folder and description information of the component code snippets are displayed.
[0099] In an embodiment of the present invention, the code snippet management unit 502 is further used to display comments, parameter descriptions and configuration information of the target component code snippet upon receiving a trigger operation for a specific position in the target component code snippet introduced into the editing interface, so as to adjust the target component code snippet introduced into the editing interface based on the comments, parameter descriptions and configuration information.
[0100] In an embodiment of the present invention, the code snippet management unit 502 is further used to provide a resource integration portal; in response to a triggering operation on the resource integration portal, the steps of displaying comments, parameter descriptions and configuration information of the target component code snippet are executed through the resource integration area or resource integration page.
[0101] In an embodiment of the present invention, the code snippet management unit 502 is further used to provide information guidance for interactive operations when listening to an addition operation of any component code snippet input into the editing interface of the code editor, so as to input comments, parameter descriptions and configuration information of the component code snippet based on the information guidance; obtain the comments, parameter descriptions and configuration information of the component code snippet input by the information guidance; store the comments, parameter descriptions and configuration information in the corresponding root directory or link address or storage folder of the component code snippet, and update the list collection.
[0102] In an embodiment of the present invention, the code snippet management unit 502 is further used to obtain a list set of code development tasks from the code hosting platform after receiving an activation trigger, and store the list set in the directory of the code editor; when an index symbol is input in the editing interface, the list set is searched in the directory of the code editor.
[0103] In the embodiment of the present invention, the code snippet management unit 502 is further used to monitor the list set of the code hosting platform; when monitoring the update of the list set of the code hosting platform, the list set stored in the directory of the code editor is updated using the list set of the code hosting platform.
[0104] In an embodiment of the present invention, each module of the above-mentioned code processing device 500 is implemented based on the method provided by VS Code Extension.
[0105] In an embodiment of the present invention, the code snippet management unit 502 of the code processing device 500 registers the programming environment of the code development task based on the Context.subscriptions method API provided by VS CodeExtension, and generates a root directory and an environment configuration file under the root directory for the registered programming environment, so as to configure the parameters and list set of the programming environment through the environment configuration file;
[0106] The code reuse unit 503 declares and encapsulates an asynchronous callback based on the provideCodeActions method provided by VS Code Extension, so as to read the parameters and list set configured in the environment configuration file in the root directory through the asynchronous callback;
[0107] The code snippet management unit 502 of the above-mentioned code processing device 500 further implements the step of providing a list set containing one or more component code snippets corresponding to the code development task based on the new vscode.CodeAction method provided by VS Code Extension.
[0108] In the embodiment of the present invention, the monitoring unit 501 in the code processing device 500 monitors whether an index symbol is input in the editing interface of the code editor based on the API lineAt() provided by the vscode.TextDocument object in the VS CodeExtension. Figure 6 As shown, an embodiment of the present invention provides a code processing system 600, and the code processing system 600 may include: Figure 5 The code processing device 500 provides a code editor 601 and a code hosting platform 602, wherein:
[0109] The code hosting platform 602 is connected to the code editor 601 in communication, and is used to manage the list set of code processing devices 500 included in the connected code editor 601.
[0110] In the following, the code editor of terminal device A and the code editors installed on multiple other terminal devices are all used to develop the code of the same project, and the code editor of terminal device A interacts with the code hosting platform. The code editors installed on multiple other terminal devices provide component code snippets, and the code editor of terminal device A obtains the component code snippets provided by the code editors installed on multiple other terminal devices through the code hosting platform. That is, taking the sharing of component code snippets between the code editor of terminal device A and the code editors installed on multiple other terminal devices as an example, the code processing process implemented by the method provided by VS Code Extension provided by an embodiment of the present invention is described in detail. Figure 7 As shown, the code processing process may include the following steps:
[0111] Step S701: activating a code processing device in a code editor installed in terminal device A and a code processing device in a code editor installed in any one or more other terminal devices among a plurality of other terminal devices;
[0112] Step S702: the activated code processing device monitors the editing interface of the code editor in which it is located;
[0113] Step S703: when an adding operation of any component code snippet inputted into the editing interface of the code editor is monitored, an information guide for interactive operation is provided, so as to input comments, parameter descriptions and configuration information of the component code snippet based on the information guide;
[0114] The information guide mainly provides a navigation interface for users to enter the characteristic information of component code snippets. For example, users can first enter or load the component code snippet into the navigation interface, and then click Next on the navigation interface. The navigation interface provides annotation items, parameter descriptions, component code snippet descriptions, configuration information, etc. Users can fill in this information according to their needs for reference when using the component code snippet later.
[0115] Step S704: Obtaining comments, parameter descriptions, and configuration information of the component code snippet input by the information guide;
[0116] Step S705: storing the comments, parameter descriptions, and configuration information corresponding to the component code snippets in the root directory or link address or storage folder of the code hosting platform, and updating the list set;
[0117] The code hosting platform uniformly manages the code development of various projects, and it assigns multiple developers to different code development projects. Therefore, in this step, in order to enable the code hosting platform to accurately manage the list collections of different projects, in the process of sending comments, parameter descriptions, configuration information, and component code snippets, it can also provide the code editor or project information or developer information that can uniquely indicate the project to which the component code snippet belongs to the code hosting platform. This enables the code hosting platform to manage the list collections of different projects according to the project. That is, the list collections of different projects have different root directories or link addresses or storage folders on the code hosting platform.
[0118] Step S706: after the code processing device in the code editor of the terminal device A is activated, a list set of code development tasks is obtained from the code hosting platform, and the list set is stored in a directory of the code editor;
[0119] For example, the code development task (the code development task is the aforementioned code development project) being edited in the code editor of the terminal device A is task 1, and the list set corresponding to task 1 is obtained from the code hosting platform through this step. Offline project code development is achieved by storing the list set in the directory of the code editor to reduce the impact of factors such as network instability on project code development.
[0120] Step S707: the activated code processing device in the code editor of the terminal device A monitors the editing interface of the code editor for the code development task being edited in the code editor;
[0121] Step S708: when an index symbol is inputted in the editing interface, a guide symbol is provided through the editing interface, wherein the guide symbol indicates a root directory or a link address or a storage folder of a list set corresponding to the code development task;
[0122] The index character can be defined according to the requirements, for example, the index character can be ":#", "**", "%&", etc. The specific form of the index character is not limited here. The index symbol can be used to quickly search the list set.
[0123] Furthermore, the guide symbol is a channel that enables the user to quickly obtain the component code snippets and corresponding information in the list set. The guide symbol can be presented in the form of any operable mark, such as a clickable colored prompt light mark, a clickable text mark, etc. The user can quickly obtain the list set through the channel provided by the guide symbol.
[0124] Step S709: when a trigger operation for a guide symbol is received, access the root directory or link address or storage folder indicated by the guide symbol, and display one or more component code snippets and description information of the component code snippets contained in the list set under the root directory or link address or storage folder;
[0125] Step S710: receiving an insert operation for a target component code snippet in the list set;
[0126] The target component code snippet may be any component code snippet in the list set. The insert operation may be an operation in which a user clicks on a component code snippet in the list set, or an operation in which a user places a cursor on a component code snippet in the list set, or a user selects a component code snippet and right-clicks the mouse to select insert from a menu that appears. The insert operation may be any operation that can be implemented by a terminal device, and the specific implementation of the insert operation is not limited here.
[0127] Step S711: importing the target component code snippet into the editing interface and replacing the index symbol to reuse the target component code snippet into the code of the code development task;
[0128] Step S712: providing a resource integration entry corresponding to the target component code snippet;
[0129] Step S713: in response to the triggering operation on the resource integration portal, the annotations, parameter descriptions and configuration information of the target component code snippet are displayed in the resource integration area or the resource integration page, so as to adjust the target component code snippet introduced into the editing interface based on the annotations, parameter descriptions and configuration information;
[0130] Step S714: monitoring the list set of the code hosting platform;
[0131] Step S715: when an update of the list set of the code hosting platform is detected, the list set stored in the directory of the code editor is updated using the list set of the code hosting platform.
[0132] Among them, the above steps S701 to S705 are the process of generating a list set for project code development and adding component code snippets to the list set; steps S706 to S713 are the process of reusing component code snippets; steps S714 and S715 are the process of updating the list set. It can be understood that there is no strict order between the process of updating the list set and the process of reusing component code snippets and the process of adding component code snippets to the list set. They can be performed before or after the above two processes, and there is no limitation here.
[0133] Figure 8 An exemplary system architecture 800 is shown to which the code processing method or code processing apparatus according to the embodiment of the present invention can be applied.
[0134] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, network 803 and server 804. Network 803 is used to provide a medium for communication links between terminal devices 801, 802 and server 804. Network 804 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0135] The project code developers can use the terminal devices 801 and 802 to interact with the server 804 through the network 803, so that the terminal devices 801 and 802 receive a list set containing one or more component code snippets corresponding to the code development task sent by the server 804 or send newly added component code snippets to the terminal devices 801 and 802. Various applications can be installed on the terminal devices 801 and 802, such as code editors, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0136] The server 804 may be a server that provides various services, such as a background management server that provides support for developers to manage the development code using multiple terminal devices (only as an example). The background management server may process the component code snippets provided by the terminal devices, and provide the processing results (such as a list set containing one or more component code snippets - only as an example) to the terminal devices 801 and 802. The background management server may also receive reusable component code snippets provided by the terminal devices 801 and 802.
[0137] The terminal devices 801 and 802 may be various electronic devices having a display screen and supporting web browsing, including but not limited to handheld scanning devices, smart phones, tablet computers, and the like.
[0138] It should be noted that the code processing method provided in the embodiment of the present invention is generally executed by a code editor installed in the terminal devices 801 and 802. Accordingly, the logistics order outbound processing device is generally arranged in a code editor installed in the terminal devices 801 and 802.
[0139] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0140] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0141] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0142] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.
[0143] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are executed.
[0144] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0145] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0146] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be arranged in a processor, for example, they may be described as: a processor including a monitoring unit, a code fragment management unit, and a code reuse unit. The names of these units do not constitute limitations on the units themselves in certain cases, for example, the monitoring unit may also be described as a "unit for monitoring the editing interface of the code editor".
[0147] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: for a code development task being edited in the code editor, monitoring the editing interface of the code editor; in the case of monitoring the input of an index symbol in the editing interface, providing a list set corresponding to the code development task containing one or more component code snippets; receiving an insert operation for a target component code snippet in the list set; introducing the target component code snippet into the editing interface, and replacing the index symbol to reuse the target component code snippet in the code of the code development task.
[0148] According to the technical solution of an embodiment of the present invention, for a code development task being edited in a code editor, by monitoring the editing interface of the code editor, when an index symbol is input in the editing interface, a list set containing one or more component code snippets corresponding to the code development task is provided, and an insert operation for a target component code snippet in the list set is received; the target component code snippet is introduced into the editing interface, and the index symbol is replaced to reuse the target component code snippet into the code of the code development task, that is, the reusable component code snippets are managed through a list set, and the list set is given through an index symbol, thereby effectively simplifying code management and maintenance to improve the feasibility of code reuse.
[0149] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A code processing method, It is characterized in that Applies to code editors, including: For a code development task being edited in the code editor, monitoring an editing interface corresponding to the code development task in the code editor; In case of monitoring the input of the index symbol in the editing interface, providing a list set including one or more component code snippets corresponding to the code development task; receiving an insert operation for a target component code snippet in the list set; The target component code snippet is introduced into the editing interface, and the index symbol is replaced, so as to reuse the target component code snippet into the code of the code development task.
2. The code processing method according to claim 1, It is characterized in that The providing of a list set of one or more component code snippets corresponding to the code development task includes: Providing a guide symbol through the editing interface, wherein the guide symbol indicates a root directory or a link address or a storage folder corresponding to the list set of the code development tasks; When a trigger operation for the guidance symbol is received, the root directory or the link address or the storage folder indicated by the guidance symbol is accessed, and one or more component code snippets contained in the list set under the root directory or the link address or the storage folder and the description information of the component code snippets are displayed.
3. The code processing method according to claim 1, It is characterized in that Also includes: When a trigger operation is received for a specific position in the target component code snippet introduced into the editing interface, the comments, parameter descriptions and configuration information of the target component code snippet are displayed to adjust the target component code snippet introduced into the editing interface based on the comments, parameter descriptions and configuration information.
4. The code processing method according to claim 3, It is characterized in that It also includes: providing a resource integration portal; In response to the triggering operation on the resource integration portal, the step of displaying the annotations, parameter descriptions and configuration information of the target component code snippet is performed through the resource integration area or the resource integration page.
5. The code processing method according to claim 1, It is characterized in that Also includes: Upon monitoring an adding operation of any component code snippet input into the editing interface of the code editor, providing an information guide for interactive operation, so as to input comments, parameter descriptions and configuration information of the component code snippet based on the information guide; Obtaining comments, parameter descriptions, and configuration information of the component code snippet input by the information guide; The annotation, the parameter description and the configuration information are stored in a root directory or a link address or a storage folder corresponding to the component code snippet, and the list set is updated.
6. The code processing method according to claim 1, It is characterized in that Also includes: After receiving the activation trigger, obtaining a list set of the code development tasks from a code hosting platform, and storing the list set in a directory of the code editor; In the case of monitoring the input of an index symbol in the editing interface, searching for the list set in the directory of the code editor.
7. The code processing method according to claim 6, It is characterized in that Also includes: Monitor the list set of the code hosting platform; When an update of the list set of the code hosting platform is monitored, the list set stored in the directory of the code editor is updated using the list set of the code hosting platform.
8. A code processing device, It is characterized in that Applied to code editor, including: monitoring unit, code snippet management unit and code reuse unit, among which, The monitoring unit is configured to monitor an editing interface corresponding to a code development task in the code editor for the code development task being edited in the code editor; The code snippet management unit is configured to provide a list set including one or more component code snippets corresponding to the code development task when an index symbol is inputted into the editing interface; The code reuse unit is used to receive an insertion operation for a target component code snippet in a list set provided by the code snippet management unit; introduce the target component code snippet into the editing interface, and replace the index symbol to reuse the target component code snippet into the code of the code development task.
9. A code processing system, It is characterized in that include: A code editor and a code hosting platform comprising the code processing device according to claim 8, wherein: The code hosting platform is communicatively connected to the code editor and is used to manage a list set of the code processing devices included in the connected code editor.
10. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.
11. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
