Code text importing method and device, electronic equipment and computer storage medium
By determining the import location and storage path in the code editing page, displaying the code information in the database, and inserting the information in the target code text into the specified location in response to user selection operations, the problem of the inability to support cross-device and cross-person code sharing in the prior art is solved, and an efficient and simplified code import process is achieved.
Patent Information
- Application Number
- CN202311620240.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art fixed code snippets triggered by keywords rely on local storage of computer devices, resulting in the inability to support code sharing across computer devices and across personnel.
Provides a code text import method, by determining the import location and storage path in the interactive operation of the code editing page, displaying the code information in the database, and in response to user selection operations, inserting the information in the target code text into a specified location.
It realizes code text sharing across devices and people, simplifies the code import process, improves code import efficiency, reduces development time and improves development efficiency.
Smart Images

Figure CN120066473A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of computer vision technology, data processing technology, and computer technology, and particularly relates to a method, apparatus, electronic device, and computer storage medium for importing code text. Background Art
[0002] With the continuous development of computer technology and computer vision technology, developers can perform software development, project development, etc. through the interaction window of a computer device.
[0003] In the process of implementing the above inventive concept, the inventor found that the related art has at least the following technical problems: The fixed code snippets triggered by keywords rely on the code snippets stored locally on the computer device. Therefore, the method of triggering fixed code snippets by keywords to implement code input does not support sharing across computer devices and personnel. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides a method, apparatus, electronic device, and computer storage medium for importing code text.
[0005] According to a first aspect of the present disclosure, there is provided a method for importing code text, including:
[0006] In response to detecting an import operation by a user on a code editing page, determining import location information and a target storage path of the currently edited file, wherein the code in the currently edited file is edited through an interaction operation on the code editing interface, and the import location information represents the import location within the code editing page;
[0007] Displaying code information of at least one code text in a database;
[0008] In response to detecting a selection operation by the user on at least one piece of code information, determining a target code text to be imported; and
[0009] Based on the target storage path, inserting target information in the target code text into the import location represented by the import location information.
[0010] According to an embodiment of the present disclosure, wherein the code information includes code text content, code type, and code language type;
[0011] Displaying code information of at least one code text in a database includes:
[0012] Displaying the code type and code language type of at least one code text through a first display window;
[0013] Displaying the code text content of at least one code text through a second display window;
[0014] Among them, the first display window and the second display window are set within the same display page.
[0015] According to an embodiment of the present disclosure, it further includes:
[0016] In response to detecting a filtering operation by the user on the code type and code language type in the display page, determine the filtered code type and the filtered code language type;
[0017] Determine the code text content that matches the filtered code type and the filtered code language type;
[0018] Display the filtered code type and the filtered code language type through the first display window; and
[0019] Display the code text content that matches the filtered code type and the filtered code language type through the second display window.
[0020] According to an embodiment of the present disclosure, among them, the display page further includes a search box; the method further includes:
[0021] Detect the text information input by the user through the search box, where the text information includes the name or description information of the code text;
[0022] Determine the code text content that matches the text information; and
[0023] Display the code text content that matches the text information through the second display window.
[0024] According to an embodiment of the present disclosure, among them, in response to detecting a selection operation by the user on at least one code information, determining the target code text to be imported includes:
[0025] In response to detecting a selection operation by the user on the code text content in the second display window, determine the target code text to be imported.
[0026] According to an embodiment of the present disclosure, among them, the target information includes the first field value of the first field, and the first field value includes at least one line of code for implementing the target logical function;
[0027] Based on the target storage path, insert the target information in the target code text into the import position characterized by the import position information, including:
[0028] Parse out the first field value from the target code text according to the first field;
[0029] Determine the first code text in the currently edited file according to the target storage path; and
[0030] Insert a first field value into the first code text according to the import location information.
[0031] According to an embodiment of the present disclosure, wherein inserting a first field value into the first code text according to the import location information includes:
[0032] Decompose the first code text based on line breaks to obtain a second code text in the form of an array;
[0033] Determine the line position and column position to be inserted in the second code text according to the import location information; and
[0034] Insert the first field value into the second code text according to the line position and column position.
[0035] According to an embodiment of the present disclosure, wherein the target information further includes a second field value of a second field, and the second field value is used to characterize the data on which the target code text depends;
[0036] The method further includes:
[0037] Parse the second field value from the target code text according to the second field; and
[0038] Insert the second field value before the first data in the first code text.
[0039] According to an embodiment of the present disclosure, after performing the insertion operation, it further includes:
[0040] Based on the storage path, overwrite the code in the current edited file with the third code text after performing the insertion operation.
[0041] A second aspect of the present disclosure provides a code text import device, including:
[0042] A first determination module, configured to determine import location information and a target storage path of the current edited file in response to detecting a user's import operation on the code editing page, wherein the code in the current edited file is edited through an interactive operation on the code editing interface, and the import location information characterizes the import location within the code editing page;
[0043] A display module, configured to display code information of at least one code text in the database;
[0044] A second determination module, configured to determine a target code text to be imported in response to detecting a user's selection operation on at least one code information; and
[0045] An insertion module, configured to insert the target information in the target code text into the import location characterized by the import location information based on the target storage path.
[0046] A third aspect of the present disclosure provides an electronic device, including: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the above-mentioned code text import method.
[0047] A fourth aspect of the present disclosure further provides a computer-readable storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor is caused to execute the above-mentioned code text import method.
[0048] A fifth aspect of the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the above-mentioned code text import method is implemented.
[0049] In an embodiment of the present disclosure, by displaying the code information of at least one code text in a database; in response to detecting a selection operation of a user for at least one code information, determining a target code text to be imported, decoupling the code information of the at least one displayed code text from the local configuration and from the input keywords, thereby realizing decoupling the selection operation of the target code text from the local terminal device and achieving cross-device and cross-person selection of target code text information. Therefore, the embodiments of the present disclosure do not require pre-configuring code texts on a local device, and different users can use different computer devices to complete code text import in real time through browsing and selection operations, simplifying the code text import process, improving the code text import efficiency, reducing the development duration, and improving the development efficiency.
[0050] In addition, in an embodiment of the present disclosure, by inserting the target information in the target code text into the import location represented by the import location information based on the target storage path, all the target information in the target code text can be imported into the current edited file based on one import operation. In a multi-information import scenario, it overcomes the technical problem in the related art that the code text import fails due to the failure of keyword triggering or the low efficiency of manual coding import when the code import cannot be performed through keyword triggering operations, and achieves the technical effect of improving the code text import efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above-mentioned content and other objects, features and advantages of the present disclosure will become clearer. In the drawings:
[0052] Figure 1 Schematically shows an application scenario of the code text import method according to an embodiment of the present disclosure;
[0053] Figure 2 Schematically shows a flowchart of the code text import method according to an embodiment of the present disclosure;
[0054] Figure 3 A data flow diagram schematically showing a code text import method according to an embodiment of the present disclosure;
[0055] Figure 4A A schematic diagram schematically showing a display page according to a first embodiment of the present disclosure;
[0056] Figure 4B A schematic diagram schematically showing a display page according to a second embodiment of the present disclosure;
[0057] Figure 4C A schematic diagram schematically showing a display page according to a third embodiment of the present disclosure;
[0058] Figure 5A A schematic diagram schematically showing a code text import scenario diagram according to a specific embodiment of the present disclosure;
[0059] Figure 5B A schematic diagram schematically showing a code text import scenario diagram according to another specific embodiment of the present disclosure;
[0060] Figure 6 A block diagram schematically showing the structure of a code text import device according to an embodiment of the present disclosure; and
[0061] Figure 7 A block diagram schematically showing an electronic device suitable for a code text import method according to an embodiment of the present disclosure. Detailed implementation manners
[0062] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is obvious that one or more embodiments can be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts of the present disclosure.
[0063] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0064] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0065] In the case of using expressions such as "at least one of A, B, and C", generally, it should be interpreted according to the meaning that a person skilled in the art usually understands this expression (for example, "a system having at least one of A, B, and C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0066] In the technical solution of the present invention, the user information involved (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties. Moreover, for the processing of relevant data such as collection, storage, use, processing, transmission, provision, disclosure, and application, etc., all comply with the relevant laws, regulations, and standards of the relevant countries and regions, adopt necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0067] In a development scenario, developers input code text for implementing business functions through an interaction window. For example, code text for building a shopping platform, code text for maintaining a product details page, modules for allocating warehouse storage tasks, etc. Due to the coding logic limitations of computer programming languages, there are fixed code segments for implementing fixed functions in the code text. For example, loop statements, judgment statements, execution functions for core business functions, etc.
[0068] In the related art, it is supported to trigger fixed code segments by inputting keywords. For example, after inputting "for", multiple code segments containing the "for" string are triggered, such as for loop functions, forin loop functions, formdata functions, etc. However, the code segments obtained by the above triggering operations need to be pre-configured locally on the computer device. For example, when only the for loop function is equipped locally on the computer device, since inputting "for" can only trigger the for loop function and cannot trigger the forin loop function, formdata function, etc., every time the formdata function is used, developers need to manually write the formdata function, resulting in a large amount of repetitive work, a high error rate, and low development efficiency. In addition, software, projects, etc. developed generally rely on other project frameworks, projects, functions, modules, etc. In the related art, the method of manually coding and writing code dependencies also causes the technical problem of low development efficiency.
[0069] To at least partially solve the above technical problems, embodiments of the present disclosure provide a method for importing code text, including: in response to detecting an import operation by a user on a code editing page, determining import location information and a target storage path of a currently edited file, where the code in the currently edited file is edited through an interactive operation on the code editing interface, and the import location information represents the import location within the code editing page; presenting code information of at least one code text in a database;
[0070] in response to detecting a selection operation by the user on at least one code information, determining a target code text to be imported; and inserting target information in the target code text into the import location represented by the import location information based on the target storage path.
[0071] Figure 1 FIG. schematically shows an application scenario of the code text import method according to an embodiment of the present disclosure.
[0072] As Figure 1 shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0073] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0074] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0075] For example, the user may operate on the display screen of the first terminal device 101, the second terminal device 102, or the third terminal device 103 to input code text.
[0076] Server 105 may be a server that provides various services. For example, it can be a background management server (merely an example) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server can analyze and process data such as user requests received, and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0077] It should be noted that the code text import method provided by the embodiments of the present disclosure can generally be executed by one of the first terminal device 101, the second terminal device 102, and the third terminal device 103. Correspondingly, the code text import device provided by the embodiments of the present disclosure can generally be set in one of the first terminal device 101, the second terminal device 102, and the third terminal device 103.
[0078] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in
[0079] are merely illustrative. According to actual needs, there can be any number of terminal devices, networks, and servers.
[0080] Based on the Figure 1 scenario described below, the code text import method of the disclosed embodiments will be described in detail through the following drawings.
[0081] Figure 2 Schematically shows a flowchart of the code text import method according to an embodiment of the present disclosure.
[0082] As Figure 2 shown, the method 200 includes operations S210 to S240.
[0083] In operation S210, in response to detecting a user's import operation on the code editing page, determine the import location information and the target storage path of the current edited file, where the code in the current edited file is edited through an interaction operation on the code editing interface, and the import location information represents the import location within the code editing page.
[0084] According to an embodiment of the present disclosure, the code editing page includes the editing pages of multiple code editing software, and supports the user to input code text through the code editing page. For example, the code editing page can be the editing page of IDE editors such as VsCode, Sublime, Atom, etc.
[0085] According to an embodiment of the present disclosure, the current edited file is the file to which the code text content currently edited by the user on the code editing page belongs. The target storage path represents the storage address of the current edited file on the computer local.
[0086] According to an embodiment of the present disclosure, the user can perform an editing operation on the code editing page and import code text at a preset import location within the code editing page. The code text is used to implement a predetermined coding logic, implement a business function, or record fixed coding information, and can be a code template with a high usage rate, including fixed declaration content, modifiable predefined templates, etc., such as the copyright statement in the file header, the templates of for and while loops. The code text is also referred to as code snippets.
[0087] According to an embodiment of the present disclosure, the user's import operation on the code editing page includes: a click operation on a target control, a drag operation, a double-click operation of a control device such as a mouse, etc.
[0088] In operation S220, display the code information of at least one code text in the database.
[0089] According to an embodiment of the present disclosure, the database includes the code information of one or more pre-configured code texts. The database can be the database of a cloud server. After detecting the user's import operation on the code editing page, communicate with the cloud server to obtain the code information of at least one code text in the database, and display the code information of at least one code text through a display window.
[0090] According to an embodiment of the present disclosure, new code texts and their code information can be periodically entered into the cloud server; or in response to the user's operation in the code snippet entry system, new code texts and their code information are entered.
[0091] For example, the user logs in to the code snippet entry system and enters the type to which the code text belongs through a selection operation, that is, the code type. The code type includes but is not limited to: front-end, back-end, UI, basic logic, pure function, API call, etc. The user can also enter the code language type through a selection operation. The code language type includes but is not limited to: HyperText Markup Language (HTML), Cascading Style Sheets (CSS), Java, JavaScript, Java, and C++, etc. After entering the code type and code language type through a selection operation, the name, function, and detailed description of the entered code text can also be entered into the system by entering a simple identifier; optionally, the import logic code of external dependencies such as packages / libraries that the code text must introduce can also be entered into the system through an input operation. After entering the source code and related information of the code text into the code snippet entry system, a request to store the type, name, description, dependencies, and code snippet in the database is initiated through a save operation, realizing the entry of the new code text and its code information.
[0092] According to an embodiment of the present disclosure, at least one code text can be all the code texts in the database, that is, the full amount of code texts. When displaying the code information of at least one code text, it can be displayed through a display strategy, and the predetermined display strategy can be determined according to actual needs. For example, arranged in alphabetical order.
[0093] In operation S230, in response to detecting a selection operation by the user for at least one code information, the target code text to be imported is determined.
[0094] According to an embodiment of the present disclosure, the user can view the code information of at least one code text through a display page and perform a selection operation on the above code information to determine the target code text to be imported.
[0095] According to an embodiment of the present disclosure, the target code text can be one code text selected by the user, or multiple code texts.
[0096] For example, one code text can be selected from the display page through a click operation; or, one or more code texts can be selected from the display page through a region selection operation; or, one or more code texts can be selected through a name / keyword input operation, and then one code text can be selected through a click operation.
[0097] In operation S240, based on the target storage path, the target information in the target code text is inserted into the import location represented by the import location information.
[0098] According to an embodiment of the present disclosure, the target information represents code text information intercepted from the source code of the target code text. The target information may include at least one line of code for implementing the target logical function and / or data on which the target code text depends.
[0099] According to an embodiment of the present disclosure, based on the target storage path of the current edited file, the code text in the current edited file can be determined, and the code text is consistent with the code displayed on the code editing page.
[0100] According to an embodiment of the present disclosure, after determining the target code text, based on the target storage path of the current edited file, the code text in the current edited file is determined; at the same time, according to the keyword of the intercepted information, the target information is extracted from the source code of the target code text; then, the target information is inserted at the import position of the code text in the current edited file, and the updated current edited file can be obtained to complete the import operation of the target information.
[0101] In an embodiment of the present disclosure, by displaying the code information of at least one code text in the database; in response to detecting a selection operation of the user for at least one code information, the target code text to be imported is determined, and the code information of the at least one displayed code text is decoupled from the local configuration and decoupled from the input keyword, thereby realizing the decoupling of the selection operation of the target code text from the local terminal device and realizing the selection of the target code text information across devices and across personnel. Therefore, the embodiments of the present disclosure do not need to pre-configure the code text on the local device, and different users can use different computer devices to complete the code text import in real time through browsing and selection operations, simplifying the code text import process, improving the code text import efficiency, reducing the development duration, and improving the development efficiency.
[0102] In addition, in an embodiment of the present disclosure, by inserting the target information in the target code text into the import position represented by the import position information based on the target storage path, all the target information in the target code text can be imported into the current edited file based on one import operation. In the multi-information import scenario, it overcomes the technical problem of low manual coding import efficiency when the code text import fails due to the failure of keyword triggering or when the code cannot be imported through the keyword triggering operation in the related art, and realizes the technical effect of improving the code text import efficiency.
[0103] Figure 3 A data flow diagram of the code text import method according to an embodiment of the present disclosure is schematically shown.
[0104] As Figure 3As shown, in the code text import method 300 of the embodiments of the present disclosure, code information of at least one code text can be obtained from the database 301, and the code information of the at least one code text is rendered and the code information 302 of the code text is displayed on the display page. The user determines the target code text 303 through a selection operation on the code information of the at least one code text on the display page.
[0105] According to the embodiments of the present disclosure, code information of all code texts in the database 301 can be obtained, or code information of one or more code texts can be obtained from the database 301 according to other selection strategies such as usage frequency.
[0106] While displaying the code information 302 of the code text, import location information 305 can also be obtained according to the user's operation on the code editing page 304, and the target storage path 306 of the current edited file edited through the code editing page 304. The code text 307 in the current edited file can be determined through the target storage path 306, and the code text 307 in the current edited file is consistent with the code displayed on the code editing page 304.
[0107] After determining the target code text 303, the import location information 305, and the code text 307 in the current edited file, the target information extracted from the target code text 303 can be inserted into the code text 307 in the current edited file according to the import location information 305 to obtain the updated current edited file 308.
[0108] According to the embodiments of the present disclosure, in response to detecting the user's import operation on the code editing page, while determining the import location information and the target storage path of the current edited file, a display page can be newly created and the HyperText Markup Language (HTML) page code for displaying the above display page on the front end can be obtained. When the HTML page code is loaded, the JavaScript script in the HTML page code sends a page request to the database for obtaining code information. Rendering the page module based on the response data of the page request can implement displaying the code information of at least one code text in the database.
[0109] According to the embodiments of the present disclosure, the code information includes code text content, code type, and code language type. The code text content can be understood as the source code of the code text.
[0110] According to an embodiment of the present disclosure, the code information of at least one code text in the display database includes: displaying the code type and code language type of at least one code text through a first display window; displaying the code text content of at least one code text through a second display window; wherein, the first display window and the second display window are set within the same display page.
[0111] According to an embodiment of the present disclosure, the code type and code language type can be displayed in partitions in the first display window. For example, at least one code type is displayed on the left side of the first display window, and at least one code language type is displayed on the right side of the first display window; or, the code type and code language type of the same code text are displayed in each row display column of the first display window, such as "basic logic - Java", "backend - CSS", etc.
[0112] According to an embodiment of the present disclosure, the first display window and the second display window can be different regions obtained by dividing the display page according to the positional relationship; or, it can also refer to different styles of display regions obtained by using different rendering parameters.
[0113] According to an embodiment of the present disclosure, after detecting the import operation of the user on the code editing page, the code information of at least one code text can be displayed on the display page without the user inputting keywords.
[0114] According to an embodiment of the present disclosure, after displaying the code text content, code type, and code language type within the display page, the user can browse all the code text content, code type, and code language type within the display page by dragging the scroll bar within the display page. During the process of browsing the display page, the user can determine the target code text by clicking on the code text content, code type, and / or code language type.
[0115] For example, during the process of browsing the display page, the user clicks on the code text content and operates the import control to select the target code text.
[0116] Figure 4A A schematic diagram of a display page according to the first embodiment of the present disclosure is schematically shown.
[0117] As Figure 4A shown, the display page 400A of the first embodiment includes a first display window 401 and a second display window 402. The first display window 401 includes a first region 4011 and a second region 4022, and the second display window 402 includes a third region 4021.
[0118] The first area 4011 is used to display code types, such as "Code Type 1, Code Type 2, Code Type 3, Code Type 4...", the second area 4012 is used to display code language types, such as "Code Language Type 1, Code Language Type 2, Code Language Type 3...", and the third area 4021 is used to display code text content, such as "Code Text Content 1, Code Text Content 2, Code Text Content 3, Code Text Content 4...".
[0119] In an embodiment of the present disclosure, by displaying the code information of all code texts in the database and through the interaction operation between the user and the device, it is possible to browse all code information and automatically import code texts without inputting keywords, avoiding the technical problem of low manual coding import efficiency when the code text import fails due to the failure of keyword triggering or when the code import cannot be triggered by keyword operations, and improving the code import efficiency.
[0120] According to an embodiment of the present disclosure, before displaying the code type and code language type of at least one code text through the first display window, it further includes: performing a deduplication operation on the code type and code language type.
[0121] According to another specific embodiment of the present disclosure, after displaying the code text content, code type, and code language type on the display page, the user can also perform a selection operation on the display page to update the display content of the display page.
[0122] According to another specific embodiment of the present disclosure, the code text import method further includes: in response to detecting a filtering operation by the user on the code type and code language type in the display page, determining the filtered code type and the filtered code language type; determining the code text content that matches the filtered code type and the filtered code language type; displaying the filtered code type and the filtered code language type through the first display window; and displaying the code text content that matches the filtered code type and the filtered code language type through the second display window.
[0123] According to an embodiment of the present disclosure, the filtering operation on the code type and code language type in the display page can be a click operation on the code type and code language type in the first display window to select at least one code type and / or at least one code language type from the display page; or, at least one code type and / or at least one code language type can be selected from the display page through a selection operation in the area of the first display window to obtain the filtered code type and the filtered code language type.
[0124] According to an embodiment of the present disclosure, since each code text includes code text content, code type, and code language type, after the filtered code type and the filtered code language type are determined in the first display window, the code text content displayed in the second display window will also change adaptively. In the updated display page, the first display window displays the filtered code type and the filtered code language type, and the second display window adaptively displays the code text content that matches the filtered code type and the filtered code language type.
[0125] According to an embodiment of the present disclosure, the selected code text can be determined based on the correspondence between the code type, the code language type, and the code text, and then the selected code text content can be determined based on the correspondence between the code text and the code text content.
[0126] According to an embodiment of the present disclosure, each code text in the database can be stored according to a predetermined storage structure, and based on the above storage structure, the correspondence between the code text and the code type, the code language type, and the code text content can be determined.
[0127] For example, the storage structure can be: code type type-1111, code language type codetype-222, name name-XX, description desc-YYY, code dependency information depend-XY, code text content code-xxxxy.
[0128] Figure 4B A schematic diagram of a display page according to a second embodiment of the present disclosure is schematically shown.
[0129] As Figure 4B shown, the user can perform a filtering operation on the code type and the code language type in the display page 400A of the first embodiment, and the updated display page is the display page 400B of the second embodiment.
[0130] The display page 400B of the second embodiment includes a first display window 403 and a second display window 404. The first display window 403 includes a first area 4031 and a second area 4032, and the second display window 404 includes a third area 4041. Among them, the functions of the first display window 403, the first area 4031, and the second area 4032 are similar to those of the first display window 401, the first area 4011, and the second area 4012 in the display page 400A, and the functions of the second display window 404 and the third area 4041 are similar to those of the second display window 402 and the third area 4021 in the display page 400A, which will not be elaborated here.
[0131] For example, the code types selected by the user are code type 1 and code type 2, and the code language types selected are code language type 1 and code language type 2. Accordingly, the first area 4031 of the display page 400B of the second embodiment displays the updated code types, the second area 4032 displays the updated code language types, and the third area 4041 adaptively displays the code text content that matches code type 1, code type 2, code language type 1, and code language type 2, such as "code text content 11, code text content 21, code text content 22".
[0132] According to an embodiment of the present disclosure, after displaying the code text content, code types, and code language types on the display page, the user can also perform input operations on the display page to complete preliminary filtering operations on the code text content, code types, and code language types, and update the display content of the display page.
[0133] In an embodiment of the present disclosure, since the amount of data of the code text displayed on the display page is large, there will be a problem of a large amount of reading when determining the target code text by browsing. Therefore, the embodiments of the present disclosure update the display page content through the selection operations of the code types and code language types, which can reduce the amount of data on the display page and help the user determine the target code text more quickly.
[0134] According to another specific embodiment of the present disclosure, the display page further includes a search box; the code text import method further includes: detecting the text information input by the user through the search box, where the text information includes the name or description information of the code text; determining the code text content that matches the text information; and displaying the code text content that matches the text information through a second display window.
[0135] According to an embodiment of the present disclosure, the code information of the code text in the database can be used to match the input text information to determine the code text content that matches the text information. Among them, the matching operation can be performed through technologies such as text matching models, which will not be elaborated here.
[0136] According to an embodiment of the present disclosure, while displaying the code text content that matches the text information through the second display window, the code types and code language types that match the text information are displayed through the first display window.
[0137] According to an embodiment of the present disclosure, when displaying the code text content that matches the text information through the second display window, the first display window can also adaptively display the code types and code language types that match the code text content.
[0138] Figure 4C A schematic diagram of a display page according to a third embodiment of the present disclosure is schematically shown.
[0139] As Figure 4C shown, the display page 400C of the third embodiment includes a first display window 405 and a second display window 406. The first display window 405 includes a first area 4051, a second area 4052, and a search box 4053. The second display window 406 includes a third area 4061. The functions of the above display windows or areas are similar to those of the display windows or areas in the display page 400A, and will not be elaborated here. Through the search box 4053 in the display page 400C, it is used to update the display content of the display page by searching.
[0140] For example, the user can enter text information, such as "interface call function", in the search box 4053. The code text content matching "interface call function" is "code text content 11". Thus, "code text content 11" is displayed in the third area 4061, "code type 1" matching "interface call function" is displayed in the first area 4051, and "code language type 1" matching "interface call function" is displayed in the second area 4052.
[0141] In the embodiments of the present disclosure, by selecting the code text displayed on the display page based on the text information input through the search box and updating the display page content, the data volume of the display page can be reduced, which helps the user quickly determine the target code text.
[0142] According to the embodiments of the present disclosure, in response to detecting a selection operation of the user for at least one piece of code information, determining the target code text to be imported includes: in response to detecting a selection operation of the user for the code text content in the second display window, determining the target code text to be imported.
[0143] According to the embodiments of the present disclosure, the selection operation for the code text content can be a click operation, a selection operation, etc. on the code text content.
[0144] According to the embodiments of the present disclosure, the target information includes a first field value of a first field, and the first field value includes at least one line of code for implementing the target logical function; based on the target storage path, inserting the target information in the target code text into the import position characterized by the import position information includes: parsing out the first field value from the target code text according to the first field; determining the first code text in the current edited file according to the target storage path; and inserting the first field value into the first code text according to the import position.
[0145] According to the embodiments of the present disclosure, the code information of the code text can be stored in the database in the form of field name - field value, and the first field can be a field for characterizing the code text content.
[0146] For example, for "code-xxxxy", the field name of the first field is "code", which represents the code text content, and the value of the first field is "xxxxy", that is, the code text content or the source code of the code text.
[0147] According to an embodiment of the present disclosure, parsing the value of the first field from the target code text according to the first field includes: parsing the value of the first field from the code information of the target code text according to the field name of the first field.
[0148] According to an embodiment of the present disclosure, the first code text represents the file content in the currently edited file, which is consistent with the code in the code editing page. At the import position represented by the import position information in the first code text, the parsed value of the first field is inserted to update the file content of the currently edited file and insert the value of the first field in real time in the code editing page.
[0149] In an embodiment of the present disclosure, the code text is directly obtained according to the storage address of the currently edited file, and the value of the first field is inserted into the code text obtained at the backend and then the insertion result is displayed on the front-end page to ensure the accuracy of the inserted content.
[0150] According to an embodiment of the present disclosure, inserting the value of the first field into the first code text according to the import position information includes: disassembling the first code text based on the line break character to obtain the second code text in the form of an array; determining the line position and column position to be inserted in the second code text according to the import position information; and inserting the value of the first field into the second code text according to the line position and column position.
[0151] According to an embodiment of the present disclosure, due to the requirements of the coding language and the general coding requirements of developers, multiple coding contents are usually separated by line breaks in the front-end code editing page. For example, the coding form of the for loop function is: for(expression 1; expression 2; expression 3){statement block}, where "{ " and the statement block are on two lines, and "}" is on a separate line. The statement block may include multiple execution operations, and each execution operation occupies a separate line. For example, the two execution operations "i = i + 1" and "sum += i" are on two lines.
[0152] However, in the backend storage process, considering the limitation of the storage space, all codes are generally stored in the form of strings, and the line breaks displayed on the front-end code editing page are also replaced by line break characters. In addition, since the import position information represents the import position in the code editing page, it is difficult to correspond the import position information with the position in the obtained first code text. Therefore, after obtaining the first code text through the target storage path, the first code text is disassembled based on the line break character to obtain the second code text in the form of an array.
[0153] According to an embodiment of the present disclosure, the imported location information represents the line position and column position to be inserted in the code editing page. After disassembling the first code text based on the line break, the second code text in the form of an array is consistent with the code form displayed on the front-end code editing page. Therefore, according to the imported location information, the line position and column position to be inserted can be determined in the second code text.
[0154] According to an embodiment of the present disclosure, after determining the line position and column position of the code, the first field value can be inserted into the line position and column position in the second code text to complete the insertion operation.
[0155] For example, the number of rows at the imported location A is D and the number of columns is E. Then, in the second code text in the form of an array, the field value of the code field is inserted at the position where the number of rows is D - 1 and the number of columns is E.
[0156] Figure 5A A code text import scenario diagram according to a specific embodiment of the present disclosure is schematically shown.
[0157] As Figure 5A shown, the scenario 500A for inserting the first field value includes the code editing page 501 before insertion and the code editing page 502 after insertion.
[0158] In the code editing page 501 before insertion, the user can make the cursor 5011 stop at the imported location in the code editing page 501 before insertion by operating the mouse or touch screen, etc. After executing the code text import method of the embodiment of the present disclosure, the code editing page 502 after insertion will insert the first field value 5021 at the imported location, such as "Function:{xxx,xxxxxxxxxxxx,...}".
[0159] According to an embodiment of the present disclosure, wherein the target information further includes the second field value of the second field, and the second field value is used to characterize the data relied on by the target code text; the method further includes: parsing out the second field value from the target code text according to the second field; and inserting the second field value before the first data in the first code text.
[0160] According to an embodiment of the present disclosure, the second field can characterize code dependency information. The code dependency information includes the source code of the introduction logic code such as the data packets and / or database libraries that must be introduced in the code text.
[0161] For example, if the target code text depends on the external Spring framework, the code dependency information of the target code text includes the source code for introducing the external Spring framework.
[0162] According to an embodiment of the present disclosure, the operation of parsing out the second field value is similar to the operation of parsing out the first field value, and will not be elaborated here.
[0163] According to an embodiment of the present disclosure, the parsing operations of the first field value and the second field value can be performed simultaneously, and the operations of inserting the first field value and inserting the second field value can also be carried out simultaneously. That is, during one update of the current edited file, both the first field value and the second field value are inserted into the current edited file. In addition, the insertion position of the second field value can also be other positions, which can be specifically determined according to actual requirements.
[0164] Figure 5B A scenario diagram of code text import according to another specific embodiment of the present disclosure is schematically shown.
[0165] As Figure 5B shown, the scenario 500B of simultaneously inserting the first field value and the second field value includes the code editing page 503 before insertion and the code editing page 504 after insertion. The code editing page 503 before insertion is similar to the code editing page 501 before insertion in Figure 5A and will not be elaborated here. After executing the code text import method of the embodiment of the present disclosure, the code editing page 504 after insertion will insert the first field value 5041, such as "Function:{xxx,xxxxxxxxxxxx,...}", at the import position. At the same time, the code editing page 504 after insertion will also insert the second field value 5042 "Code Dependency" before the first line of data "xxx".
[0166] According to an embodiment of the present disclosure, the target information may further include a third field value of a third field, and the third field represents other information required for the encoding process. Similar to the operation type of inserting the second field value, the third field value can be inserted at the default insertion position of the third field.
[0167] In the embodiment of the present disclosure, through one selection operation by the user for importing the first field value, the first field value can be imported to the specified position, and at the same time, the code dependency information can be imported to the default position, realizing the import of multiple target information into the current edited file based on one import operation, overcoming the technical problem in the related art that the code text import fails due to the failure of keyword triggering or the low efficiency of manual coding import when the code import cannot be performed through keyword triggering operations, and achieving the technical effect of improving the code text import efficiency.
[0168] According to an embodiment of the present disclosure, after performing the insertion operation, the code text import method further includes: based on the storage path, using the third code text after performing the insertion operation to overwrite the code in the current edited file.
[0169] According to an embodiment of the present disclosure, performing an insertion operation includes an operation of inserting only the first field value into the currently edited file, and also includes an operation of inserting the first field value, the second field value, and / or the third field value into the currently edited file simultaneously.
[0170] According to an embodiment of the present disclosure, the second code text is the code text before performing the insertion operation, and the third code text is the code text after performing the insertion operation. After performing the insertion operation, the third code text after the insertion operation is re - concatenated with line breaks, and the form of the fourth code text after concatenation is the same as the form of the first code text. Then, the fourth code text is overwritten and written into the file corresponding to the target storage path to complete the code text import.
[0171] The code text import operation of the embodiments of the present disclosure can be implemented in the form of a plug - in tool. Hereinafter, taking the plug - in tool as an example, the import operation of the above - mentioned code text will be described. Before performing the above - mentioned code text import method, the user can enter the IDE editor, install the "Code Import Tool" plug - in and enable the plug - in. The plug - in will append an item of "Code Import" to the right - click menu of the IDE editor.
[0172] When performing the above - mentioned code text import method, the user can open any code file through the IDE editor, move the cursor to the place where the code needs to be inserted, right - click to evoke the menu, select and click the "Code Import" item, record the position information of the current cursor as A, and at the same time record the storage path of the current file as B. After the "Code Import Tool" plug - in detects that the "Code Import" item in the right - click menu is clicked, a new IDE window is created and the code snippet browsing HTML page code integrated in the plug - in is loaded. After the IDE window loads the HTML page, the JavaScript script in the HTML page will initiate two requests: one is to obtain the distinct values of all code types type and code language types codeType in the database, and the other is a paging request for the source code in the database. Based on the response data of these two requests, the filtering condition module and the list module are rendered and displayed in the newly created IDE window.
[0173] In the newly created IDE window, the user can select the specified code type type and code language type codeType for filtering and re - render the code list; in addition, the user can filter the code by searching keywords such as name, desc, etc., and select the code to be imported after filtering and browsing. After selecting the code to be imported, click the "Confirm Import" button, obtain the code dependency depend field and the code text content code field in the data corresponding to the code snippet, and pass the content of the depend and code fields to the "Code Import Tool" plug - in through the acquireVsCodeApi().postMessage method.
[0174] After the "Code Import Tool" plugin receives the message passed from the HTML page, it stores the content of the depend and code fields, obtains the text content in the file corresponding to storage path B, and disassembles the text content according to the line break character to obtain array C. It obtains the line number D and column number E at the cursor position A, then inserts the content of the code field at the column number E in the data at the position of line number D minus 1 in array C. Then, it inserts the content of the depend field before the first data in array C. Finally, it reassembles array C into text content with line break characters and overwrites and writes it to the file corresponding to storage path B to complete the code insertion operation.
[0175] The code insertion methods of related technologies have at least the following technical problems: The inserted code is implemented through local configuration operations, is non-persistent, and does not support sharing across computer devices and personnel; it only supports keyword-triggered code texts and does not support searching and full-scale browsing; the code and code dependencies do not support splitting, and manual copying of the dependent part of the code to the top of the code file is required.
[0176] In the embodiments of the present disclosure, by persistently storing the code and code dependencies, different computer devices and different personnel can browse and search for the required code snippets in the code editing pages such as IDEs and import them to the cursor position and the top of the corresponding file, improving the efficiency and flexibility of code import and expanding the code import methods.
[0177] Figure 6 A structural block diagram of a code text import device according to an embodiment of the present disclosure is schematically shown.
[0178] As Figure 6 shown, the code text import device 600 of this embodiment includes a first determination module 610, a display module 620, a second determination module 630, and an insertion module 640.
[0179] The first determination module 610 is configured to determine the import position information and the target storage path of the currently edited file in response to detecting an import operation by the user in the code editing page. Among them, the code in the currently edited file is edited through interactive operations in the code editing interface, and the import position information represents the import position in the code editing page.
[0180] The display module 620 is configured to display the code information of at least one code text in the database.
[0181] The second determination module 630 is configured to determine the target code text to be imported in response to detecting a selection operation by the user for at least one code information.
[0182] An insertion module 640 is configured to insert target information in a target code text into an import location characterized by import location information based on a target storage path.
[0183] According to an embodiment of the present disclosure, the code information includes code text content, code type, and code language type.
[0184] According to an embodiment of the present disclosure, the display module 620 includes a first display unit and a second display unit.
[0185] The first display unit is configured to display the code type and the code language type of at least one code text through a first display window.
[0186] The second display unit is configured to display the code text content of at least one code text through a second display window. Wherein, the first display window and the second display window are arranged within the same display page.
[0187] According to an embodiment of the present disclosure, the display module 620 further includes a first filtering unit, a second filtering unit, a third display unit, and a fourth display unit.
[0188] The first filtering unit is configured to determine a filtered code type and a filtered code language type in response to detecting a filtering operation by a user on the code type and the code language type in the display page.
[0189] The second filtering unit is configured to determine code text content that matches the filtered code type and the filtered code language type.
[0190] The third display unit is configured to display the filtered code type and the filtered code language type through the first display window.
[0191] The fourth display unit is configured to display code text content that matches the filtered code type and the filtered code language type through the second display window.
[0192] According to an embodiment of the present disclosure, the display module 620 further includes a detection unit, a matching unit, and a fifth display unit.
[0193] The detection unit is configured to detect text information input by a user through a search box, where the text information includes the name or description information of a code text.
[0194] The matching unit is configured to determine code text content that matches the text information.
[0195] The fifth display unit is configured to display code text content that matches the text information through the second display window.
[0196] According to an embodiment of the present disclosure, the second determination module 630 includes a first determination unit, configured to determine a target code text to be imported in response to detecting a selection operation of the user on the code text content in the second display window.
[0197] According to an embodiment of the present disclosure, the insertion module 640 includes a first parsing unit, a second determination unit, and a first insertion unit. The target information includes a first field value of a first field, and the first field value includes at least one line of code for implementing a target logical function.
[0198] The first parsing unit is configured to parse out the first field value from the target code text according to the first field.
[0199] The second determination unit is configured to determine a first code text in the current edited file according to the target storage path.
[0200] The first insertion unit is configured to insert the first field value into the first code text according to the import position information.
[0201] According to an embodiment of the present disclosure, the second determination unit includes a disassembling unit, a determination subunit, and an insertion subunit.
[0202] The disassembling unit is configured to disassemble the first code text based on line breaks to obtain a second code text in an array form.
[0203] The determination subunit is configured to determine a line position and a column position to be inserted in the second code text according to the import position information.
[0204] The insertion subunit is configured to insert the first field value into the second code text according to the line position and the column position.
[0205] According to an embodiment of the present disclosure, the target information further includes a second field value of a second field, and the second field value is used to characterize data on which the target code text depends.
[0206] According to an embodiment of the present disclosure, the insertion module 640 further includes a second parsing unit and a second insertion unit.
[0207] The second parsing unit is configured to parse out the second field value from the target code text according to the second field.
[0208] The second insertion unit is configured to insert the second field value before the first data in the first code text.
[0209] According to an embodiment of the present disclosure, the code text import device 600 further includes an overwriting module, configured to overwrite the code in the current edited file with the third code text after performing the insertion operation based on the storage path.
[0210] According to an embodiment of the present disclosure, any of the first determination module 610, the display module 620, the second determination module 630, and the insertion module 640 may be combined and implemented in one module, or any one of them may be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules may be combined with at least part of the functions of other modules and implemented in one module.
[0211] According to an embodiment of the present disclosure, at least one of the first determination module 610, the display module 620, the second determination module 630, and the insertion module 640 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging circuits, etc., implemented by hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, at least one of the first determination module 610, the display module 620, the second determination module 630, and the insertion module 640 may be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions may be executed.
[0212] It should be noted that the device part in the embodiment of the present disclosure corresponds to the method part in the embodiment of the present disclosure. For the description of the device part, please refer to the method part specifically, and details are not described herein again.
[0213] Figure 7 A block diagram of an electronic device suitable for the code text import method according to an embodiment of the present disclosure is schematically shown.
[0214] As Figure 7 shown, the electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage section 708 into a random access memory (RAM) 703. The processor 701 may include, for example, a general microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application specific integrated circuit (ASIC)), etc. The processor 701 may also include on-board memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0215] In the RAM 703, various programs and data required for the operation of the electronic device 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. The processor 701 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 702 and / or the RAM 703. It should be noted that the programs may also be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 may also perform various operations of the method flow according to the embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0216] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, and the input / output (I / O) interface 705 is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the input / output I / O interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read from it can be installed into the storage portion 708 as needed.
[0217] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.
[0218] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, device, or apparatus. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include one or more memories other than the above-described ROM 702 and / or RAM 703 and / or ROM 702 and RAM 703.
[0219] An embodiment of the present disclosure also includes a computer program product, which includes a computer program that contains program code for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program code is used to enable the computer system to implement the above-mentioned method provided by the embodiment of the present disclosure.
[0220] When the computer program is executed by the processor 701, it executes the above-mentioned functions defined in the system / apparatus of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described system, apparatus, module, unit, etc. can be implemented by computer program modules.
[0221] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and be downloaded and installed through the communication part 709, and / or be installed from the removable medium 711. The program code included in the computer program can be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0222] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or be installed from the removable medium 711. When the computer program is executed by the processor 701, it executes the above-mentioned functions defined in the system of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described system, device, apparatus, module, unit, etc. can be implemented by computer program modules.
[0223] In accordance with embodiments of the present disclosure, program code for executing the computer programs provided by the embodiments of the present disclosure may be written in any combination of one or more programming languages. Specifically, these computing programs may be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, such as Java, C++, Python, the "C" language, or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0224] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0225] Those skilled in the art can understand that the features recited in the various embodiments and / or claims of the present disclosure may be combined or combined in various ways, even if such combinations or combinations are not explicitly recited in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recited in the various embodiments and / or claims of the present disclosure may be combined and combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0226] The specific embodiments described above further elaborate on the purpose, technical solutions, and beneficial effects of the present disclosure. It should be understood that the above are only specific embodiments of the present disclosure and are not used to limit the present disclosure. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A method for importing code text, comprising: responding to detecting an import operation by a user on a code editing page, determining import location information and a target storage path of a currently edited file, wherein the code in the currently edited file is edited through an interaction operation on the code editing interface, and the import location information represents the import location within the code editing page; displaying code information of at least one code text in a database; responding to detecting a selection operation by the user on at least one piece of the code information, determining a target code text to be imported; and based on the target storage path, inserting target information in the target code text into the import location represented by the import location information.
2. The method according to claim 1, wherein, the code information includes code text content, code type, and code language type; the displaying code information of at least one code text in the database includes: displaying the code type and code language type of at least one code text through a first display window; displaying the code text content of at least one code text through a second display window; wherein the first display window and the second display window are set within the same display page.
3. The method according to claim 2, further comprising: responding to detecting a filtering operation by the user on the code type and the code language type in the display page, determining a filtered code type and a filtered code language type; determining code text content matching the filtered code type and the filtered code language type; displaying the filtered code type and the filtered code language type through the first display window; and displaying code text content matching the filtered code type and the filtered code language type through the second display window.
4. The method according to claim 2, wherein, the display page further includes a search box; the method further includes: detecting text information input by the user through the search box, wherein the text information includes the name or description information of the code text; determining code text content matching the text information; and displaying code text content matching the text information through the second display window.
5. The method according to any one of claims 2 to 4, wherein, the responding to detecting a selection operation by the user on at least one piece of the code information, determining a target code text to be imported, includes: responding to detecting a selection operation by the user on the code text content in the second display window, determining a target code text to be imported.
6. The method according to claim 1, wherein, the target information includes a first field value of a first field, and the first field value includes at least one line of code for implementing a target logical function; the inserting target information in the target code text into the import location represented by the import location information based on the target storage path includes: parsing out the first field value from the target code text according to the first field; Determine the first code text in the current edited file according to the target storage path; and Insert the first field value into the first code text according to the import location information.
7. The method according to claim 6, wherein the inserting the first field value into the first code text according to the import location information includes:[[]]END]] Decompose the first code text based on line breaks to obtain the second code text in array form; Determine the line position and column position to be inserted in the second code text according to the import location information; and Insert the first field value into the second code text according to the line position and the column position.
8. The method according to claim 6, wherein the target information further includes a second field value of a second field, and the second field value is used to characterize the data on which the target code text depends; the method further includes:[[]]END]] Parse out the second field value from the target code text according to the second field; and Insert the second field value before the first data in the first code text.
9. The method according to any one of claims 6 to 8, after performing the insertion operation, further includes:[[]]END]] Based on the storage path, overwrite the code in the current edited file with the third code text after performing the insertion operation.
10. A code text import device, including:[[]]END]] A first determination module, configured to determine import location information and a target storage path of the current edited file in response to detecting an import operation of a user on a code editing page, wherein the code in the current edited file is edited through an interaction operation on the code editing interface, and the import location information represents an import location within the code editing page; A display module, configured to display code information of at least one code text in a database; A second determination module, configured to determine a target code text to be imported in response to detecting a selection operation of the user for at least one of the code information; and An insertion module, configured to insert the target information in the target code text into the import location represented by the import location information based on the target storage path.
11. An electronic device, including:[[]]END]] One or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 9.
13. A computer program product, including a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.