An encoding assisting method, device, apparatus and storage medium
By acquiring and parsing code snippets from the bootstrap file within the IDE, displaying and responding to user selections, the problem of large code volumes and complex operations in program development is solved, improving coding efficiency and ease of use for beginners.
Patent Information
- Application Number
- CN202111328093.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-10
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2041-11-10
AI Technical Summary
In the process of program development, existing technologies require a large number of people to work together to write code. Copying and pasting code increases the workload, and beginners or developers who are not familiar with IDEs have difficulty operating them, resulting in low coding efficiency, high error rate, and a lack of flexibility and guidance.
This paper provides a coding assistance method that obtains a structured bootstrap file, parses code snippets, and displays titles, code text, and components on the IDE interface. It also responds to user selections to display the corresponding code, thus simplifying the operation process.
Reduce developers' workload, lower the possibility of coding errors, improve coding efficiency, and provide guidance, especially for beginners or users unfamiliar with IDEs, to avoid wasting time and simplify operation complexity.
Smart Images

Figure CN114020257B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and in particular, to an encoding assisting method, device, equipment and storage medium. BACKGROUND
[0002] With the rapid development of the Internet, the network has gradually become an indispensable aid for people, and brings great convenience to people's work and life through the network. Various application tools relying on the Internet are used by people, especially the integrated development environment (IDE), which can realize the display of programs on the computer, integrates code writing function, analysis function, compilation function and debugging function, and makes program development more convenient, fast and efficient.
[0003] At present, a large amount of code needs to be written in the program development process. Even for the way of adding business logic related code in combination with the existing program framework, the amount of code writing is also very large, and it often needs the cooperation of a large number of personnel to complete. In the actual code writing process, the developer will mostly copy and paste the code written in the past to reduce the coding workload. However, this way requires the developer to find the relevant code himself or have a corresponding code reserve, which increases the workload of the developer and the program development time. In addition, for beginners or developers unfamiliar with the IDE, they may not know how to operate after entering the IDE, which wastes time and affects the coding speed. This coding method is complicated to operate, has high code writing cost, high possibility of error, lacks flexibility and guidance, and has low program development efficiency due to large workload. SUMMARY
[0004] The present disclosure provides at least an encoding assisting method, device, equipment and storage medium.
[0005] The present disclosure provides an encoding assisting method applied to an integrated development environment (IDE), which comprises the following steps:
[0006] Obtaining a guide file, wherein the guide file is a structured text file format;
[0007] Obtaining at least one code segment from the guide file, wherein each code segment comprises a title, a code body and a code component;
[0008] Displaying the at least one title obtained by parsing on a user development interface of the IDE;
[0009] In response to a selection of a target title among the at least one title by a user, the target title and a code body and a code component corresponding to the target title are displayed in a code editing window in a user development interface of the IDE.
[0010] In an alternative implementation, the obtaining the bootstrap file comprises:
[0011] The bootstrap file is obtained when the IDE is started.
[0012] In response to an adding operation of the bootstrap file by the user during the coding by the user using the IDE, the bootstrap file is obtained.
[0013] In an alternative implementation, the obtaining the bootstrap file comprises:
[0014] It is detected whether a bootstrap file is pre-added in the IDE.
[0015] If yes, the bootstrap file is obtained.
[0016] If no, a prompt message is displayed to the user for adding and / or editing the bootstrap file according to the prompt message, and the bootstrap file edited by the user or generated according to a preset bootstrap file template selected by the user is obtained, and the obtained bootstrap file is added to the IDE.
[0017] In an alternative implementation, the at least one code snippet is parsed from the bootstrap file, and each code snippet comprises a title, a code body and a code component, which comprises:
[0018] The bootstrap file is parsed to generate an abstract syntax tree of the bootstrap file.
[0019] The at least one code snippet is extracted by traversing the abstract syntax tree, and each code snippet comprises a title, a code body and a code component.
[0020] In an alternative implementation, the at least one title parsed is displayed on the user development interface of the IDE, which comprises:
[0021] A title control corresponding to each title is generated based on the at least one title parsed.
[0022] The at least one title control generated is displayed on the user development interface of the IDE.
[0023] In an alternative implementation, the target title is determined by:
[0024] determine a target title corresponding to a target title control among the at least one title control based on a triggering operation of the user on the target title control.
[0025] In an optional implementation, after the target title and the code body and the code component corresponding to the target title are displayed in the code editing window in the user development interface in response to the selection of the target title among the at least one title by the user, the method comprises:
[0026] In response to a running operation of the user, a current code snippet in the code editing window is obtained;
[0027] The current code snippet is run, and a running result is displayed in a code running window in the user development interface.
[0028] In an optional implementation, the current code snippet comprises:
[0029] the target title and the code body and the code component corresponding to the target title; or
[0030] the target title and the code body and the code component corresponding to the target title, and an original code snippet in the code editing window.
[0031] In an optional implementation, the running of the current code snippet and the display of the running result in the code running window in the user development interface comprises:
[0032] determining a current code body and a current code component included in the current code snippet;
[0033] based on the current code body and the current code component, calling the current code component to execute the current code body, and displaying a running result in a code running window in the user development interface.
[0034] The embodiments of the present disclosure further provide an encoding assistance device, which is in communication connection with an integrated development environment (IDE), and comprises:
[0035] an obtaining module, configured to obtain a bootstrap file, wherein the bootstrap file is in a structured text file format;
[0036] a parsing module, configured to parse at least one code snippet from the bootstrap file, each code snippet comprising a title, a code body and a code component;
[0037] a display module, configured to display at least one title parsed from the bootstrap file on a user development interface of the IDE;
[0038] The display module is configured to display the target title and the code body and the code component corresponding to the target title in a code editing window in the user development interface in response to a selection of the target title by the user from the at least one title.
[0039] In an optional implementation, the acquisition module is specifically configured to:
[0040] acquire a bootstrap file when the IDE is started;
[0041] and / or, in response to an addition operation of the bootstrap file by the user during the coding by the user using the IDE, acquire the bootstrap file.
[0042] In an optional implementation, the acquisition module is specifically configured to:
[0043] detect whether a bootstrap file is pre-added in the IDE;
[0044] if yes, acquire the bootstrap file;
[0045] if no, display prompt information to the user, so that the user adds and / or edits the bootstrap file according to the prompt information, acquire the bootstrap file edited by the user or generated according to a preset bootstrap file template selected by the user, and add the acquired bootstrap file to the IDE.
[0046] In an optional implementation, the analysis module is specifically configured to:
[0047] analyze the bootstrap file to generate an abstract syntax tree of the bootstrap file;
[0048] traverse the abstract syntax tree to extract at least one code snippet, each code snippet including a title, a code body and a code component.
[0049] In an optional implementation, the display module is specifically configured to:
[0050] generate a title control corresponding to each title based on the at least one title obtained by analysis;
[0051] display the at least one generated title control on a user development interface of the IDE.
[0052] In an optional implementation, the display module determines the target title by:
[0053] determining a target title corresponding to a target title control based on a triggering operation of the target title control by the user from the at least one title control.
[0054] In an optional implementation, the apparatus further comprises a running module, configured to:
[0055] In response to a running operation of the user, acquire a current code snippet in the code editing window;
[0056] Run the current code snippet, and display a running result in a code running window in the user development interface.
[0057] In an optional implementation, the current code snippet comprises:
[0058] the target title, and a code body and a code component corresponding to the target title; or
[0059] the target title, and a code body and a code component corresponding to the target title, and an original code snippet in the code editing window.
[0060] In an optional implementation, when the running module is configured to run the current code snippet and display a running result in a code running window in the user development interface, the running module is specifically configured to:
[0061] determine a current code body and a current code component included in the current code snippet;
[0062] based on the current code body and the current code component, invoke the current code component to execute the current code body, and display a running result in a code running window in the user development interface.
[0063] The disclosure further provides an electronic device, comprising a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, and the machine readable instructions are executed by the processor to perform the steps of the above-mentioned coding assistance method.
[0064] The disclosure further provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to perform the steps of the above-mentioned coding assistance method.
[0065] The coding auxiliary method, device, equipment and storage medium provided by the embodiments of the present disclosure can be applied to an integrated development environment (IDE), a boot file can be acquired, the boot file is a structured text file format, then at least one code segment is parsed from the boot file, each code segment includes a title, code body and code component, at least one title parsed can be displayed on a user development interface of the IDE, so that the target title in the at least one title can be selected by a user, and the target title, the code body corresponding to the target title and the code component corresponding to the target title can be displayed in a code editing window of the user development interface.
[0066] In this way, the boot file can be flexibly used in the coding process, and the code does not need to be copied through other ways, but directly uses the boot file, thereby effectively reducing the workload of the developer, simplifying the complexity of the coding operation, reducing the possibility of coding errors, and improving the coding efficiency.
[0067] Further, for the case that a beginner or a developer unfamiliar with the integrated development environment (IDE) may not know how to operate after entering the IDE, the user using the IDE can also be guided, thereby avoiding invalid time waste, improving the coding speed, and reducing the coding difficulty caused by the beginners or the unfamiliarity.
[0068] In order to make the above objectives, characteristics and advantages of the present disclosure more apparent, the following preferred embodiments are specifically described below, and the accompanying drawings are described in detail as follows. BRIEF DESCRIPTION OF DRAWINGS
[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments. The drawings herein are incorporated into the description and form a part of the description, which show the embodiments consistent with the present disclosure, and are used to illustrate the technical solutions of the present disclosure together with the description. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be regarded as a limitation on the scope, and other related drawings can also be obtained by those skilled in the art without creative labor.
[0070] Figure 1 An application scenario diagram provided by the embodiments of the present disclosure is shown;
[0071] Figure 2 A flowchart of a coding auxiliary method provided by the embodiments of the present disclosure is shown;
[0072] Figure 3 A flowchart of another coding auxiliary method provided by the embodiments of the present disclosure is shown;
[0073] Figure 4Fig. 1 shows a code running schematic diagram provided by an embodiment of the present disclosure;
[0074] Figure 5 Fig. 2 shows another code running schematic diagram provided by an embodiment of the present disclosure;
[0075] Figure 6 Fig. 3 shows a third code running schematic diagram provided by an embodiment of the present disclosure;
[0076] Figure 7 Fig. 4 shows a flowchart of another coding auxiliary method provided by an embodiment of the present disclosure;
[0077] Figure 8 Fig. 5 shows a schematic diagram of a coding auxiliary device provided by an embodiment of the present disclosure;
[0078] Figure 9 Fig. 6 shows a schematic diagram of another coding auxiliary device provided by an embodiment of the present disclosure;
[0079] Figure 10 Fig. 7 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0080] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the following will be combined with the accompanying drawings for the embodiments of the present disclosure to make a clear and complete description of the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed present disclosure, but only represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present disclosure.
[0081] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0082] The term “and / or” herein only describes an association relationship, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the term “at least one” herein means any one of multiple or any combination of at least two of multiple, for example, including at least one of A, B and C can mean including any one or more elements selected from the set consisting of A, B and C.
[0083] It is found through research that at present, a large amount of code needs to be written in the program development process, even if it is for the way of adding only business logic related code in combination with the existing program framework, the amount of code writing is also very large, and often needs the cooperation of a large number of personnel to complete, and in the actual code writing process, the developers will mostly copy and paste the code written in the past to reduce the coding workload, but this way, the developers need to find the relevant code themselves or have a corresponding code reserve, which increases the workload of the developers and increases the program development time. In addition, for beginners or developers unfamiliar with IDE, they may not know how to operate after entering the IDE, which wastes time and affects coding speed. This coding method is complicated to operate, has high code writing cost, high possibility of error, lacks flexibility and guidance, and has low program development efficiency due to large workload.
[0084] Based on the above research, the present disclosure provides an encoding assistance method that can be applied to an integrated development environment (IDE). The method can obtain a guide file, which is a structured text file format, and then parse at least one code snippet from the guide file. Each code snippet includes a title, a code body, and a code component. The method can display at least one parsed title on a user development interface of the IDE. In response to a user selecting a target title from the at least one title, the method can display the target title, the code body corresponding to the target title, and the code component corresponding to the target title in a code editing window on the user development interface. This way, the guide file can be flexibly utilized during coding to effectively reduce the workload of developers, simplify the complexity of coding operations, reduce the likelihood of coding errors, and improve coding efficiency.
[0085] To facilitate understanding of the present embodiment, first, a coding assistance method disclosed by the present embodiment is described in detail. The execution subject of the coding assistance method provided by the present embodiment is generally a computer device with certain computing power, which may, for example, include a terminal device, a server, or other processing devices. In some possible implementation manners, the coding assistance method can be implemented by a processor invoking computer readable instructions stored in a memory.
[0086] Please refer to Figure 1 , Figure 1 An application scenario diagram is provided for the present embodiment. As shown in Figure 1As shown in the foregoing, in the development process, a plurality of management containers can be generated in a server with an integrated development environment (IDE) for managing resources, processes, files, etc. within the IDE. Further, when a user writes code at a terminal, the user can apply a user development interface of the integrated development environment (IDE) to write and run the code. It should be noted that the user development interface can be a part of the integrated development environment (IDE) presented at the front end, i.e., the integrated development environment (IDE) includes the user development interface, and the user development interface can correspond to display files in the plurality of management containers, i.e., the user development interface can display files stored in the IDE so that the user can view the written code and code running results.
[0087] Further, for the integrated development environment (IDE), there are two forms of online and local, for the online integrated development environment (IDE), files can be obtained from the management containers in the database in the cloud to be displayed on the user development interface in the form of a webpage; for the local integrated development environment (IDE), a server in communication connection with a terminal where the IDE is located can be determined first, and then files can be obtained from the management containers of the server to be displayed in the form of a user development interface in the application software installed in the user terminal.
[0088] Please refer to Figure 2 , Figure 2 A flowchart of an encoding assistance method provided by the embodiments of the present disclosure. As shown in Figure 2 The encoding assistance method provided by the embodiments of the present disclosure includes:
[0089] S201: Obtain a guide file, wherein the guide file is in a structured text file format.
[0090] In this step, the guide file can be obtained from a database of an integrated development environment (IDE).
[0091] The guide file can be a code snippet with actual business logic, for example, can be a complete and logically rigorous code snippet, can be a fragmented code snippet capable of implementing a certain function, etc., or can be a code structure reflecting coding logic. Further, based on the code snippet with actual business logic, the user can directly use it to realize code reuse and reduce the workload of writing code, and based on the code structure reflecting coding logic, the user can be shown the architecture of the code to facilitate beginners or users unfamiliar with coding to quickly understand the structure of the code and improve the coding speed.
[0092] In addition, in order to facilitate and expedite coding, the guide file can be classified based on the functions that can be realized by the code snippets included in the guide file, thereby facilitating users to quickly select the appropriate guide file according to their own coding needs.
[0093] It can be understood that the size of the guide file can be different when the content included in the code snippet is different.
[0094] In order to facilitate reading and writing of the code, the guide file can be in markdown format. When writing a file in markdown format, no special paragraph format is specified, only the code needs to be directly inputted, the logical and structural rigor of the code is not high, and the file can be edited across platforms and used across environments, which is suitable for use in the coding process.
[0095] Specifically, the guide file includes:
[0096] When starting the IDE, the guide file is acquired.
[0097] And / or, in the process of coding by the user using the IDE, the guide file is acquired in response to the addition operation of the user for the guide file.
[0098] In this step, the timing of acquiring the guide file can be when the user opens the IDE, or in response to the addition operation of the user for the guide file when the user uses the IDE to code.
[0099] S202: At least one code snippet is parsed from the guide file, and each code snippet includes a title, a code body and a code component.
[0100] In this step, after the guide file is acquired, the guide file can be parsed to obtain at least one code snippet from the guide file, and each code snippet includes a title, a code body and a code component.
[0101] In the process of parsing the above guide file, it can be detected whether the title exists in the guide file, and the title, the code body and the code component corresponding to the title are acquired when the title is detected.
[0102] Further, in the case that the guide file includes multiple code segments, all titles can be acquired first, and then the code body and the code component corresponding to each title can be acquired in sequence. Alternatively, one title can be acquired, and then the code body and the code component corresponding to the title can be acquired, and then another title can be acquired, and so on, until all titles are acquired.
[0103] The code body represents code or a source program, i.e., a text file generated in response to a human input operation.
[0104] The code component can include an executor for executing the code body, and can also include an execution language mode of the code body, and the like.
[0105] For example, a code segment including a title "a", a code body "print(“message”)", and a code component "python" is parsed from a guide file.
[0106] S203: Displaying the parsed at least one title on a user development interface of the IDE.
[0107] In the case that at least one title is parsed from the guide file, the at least one title can be displayed on the user development interface of the IDE for user selection.
[0108] In order to facilitate user selection of the title, the title can be displayed in the form of a control on the user development interface of the IDE.
[0109] S204: In response to user selection of a target title from the at least one title, displaying the target title and the code body and the code component corresponding to the target title in a code editing window in the user development interface.
[0110] In the case that user selection of a target title from the at least one title is detected, the code body and the code component corresponding to the target title are determined in response to the selection of the target title, so that the target title and the code body and the code component corresponding to the target title are displayed in a code editing window in the user development interface.
[0111] For example, in the case that the user selects the title "a", the title "a" and the code body "print(“message”)" and the code component "python" corresponding to the title "a" are displayed in the code editing window in the user development interface.
[0112] The coding auxiliary method provided by the embodiments of the present disclosure can be applied to an integrated development environment (IDE), a guide file can be acquired, the guide file is in a structured text file format, at least one code segment is parsed from the guide file, each code segment includes a title, code body and code components, at least one title parsed can be displayed on a user development interface of the IDE, so that the target title and the code body and the code components corresponding to the target title can be displayed in a code editing window in the user development interface in response to a selection of the target title from the at least one title by a user, so that the guide file can be flexibly used in the coding process, and the code does not need to be copied through other ways, the guide file is directly used, the workload of a developer is effectively reduced, the complexity of the coding operation is simplified, the possibility of coding errors is reduced, and the coding efficiency is improved. In addition, for beginners or developers who are not familiar with the IDE, the user using the IDE can be guided in the case that the user is not sure how to operate after entering the IDE, invalid time waste is avoided, the coding speed is improved, and coding difficulties caused by beginners or unfamiliarity are reduced.
[0113] Please refer to Figure 3 , Figure 3 The flowchart of another coding auxiliary method provided by the embodiments of the present disclosure is shown in FIG. 3. Figure 3 The coding auxiliary method provided by the embodiments of the present disclosure includes the following steps.
[0114] S301: A guide file is acquired, wherein the guide file is in a structured text file format.
[0115] S302: At least one code segment is parsed from the guide file, each code segment includes a title, code body and code components.
[0116] S303: At least one title parsed is displayed on a user development interface of the IDE.
[0117] S304: In response to a selection of a target title from the at least one title by a user, the target title and the code body and the code components corresponding to the target title are displayed in a code editing window in the user development interface.
[0118] The descriptions of steps S301 to S304 can refer to the descriptions of steps S201 to S204, and the same technical effects and the same technical problems can be achieved, and details are not repeated here.
[0119] S305: In response to a running operation of a user, a current code segment in the code editing window is acquired.
[0120] In this step, in the case that it is detected that the user applies a running operation on the code editing window in the development interface, the code in the code editing window can be run in response to the running operation of the user. To this end, a current code snippet in the code editing window can be acquired for subsequent running processing of the current code snippet.
[0121] S306: Run the current code snippet and display the running result of the current code snippet in a code running window in the user development interface.
[0122] In this step, in the case that the current code snippet in the code editing window is determined, the current code snippet can be run, and the running result of the current code snippet is displayed in a code running window in the user development interface, so as to facilitate the user to view the running result.
[0123] Next, the present embodiment will be further described in combination with some specific implementations.
[0124] In some possible implementations, the acquiring the bootstrap file comprises:
[0125] Detecting whether a bootstrap file is pre-added in the IDE;
[0126] If yes, acquiring the bootstrap file;
[0127] If no, presenting prompt information to the user, so that the user adds and / or edits the bootstrap file according to the prompt information, acquiring the bootstrap file edited by the user or the bootstrap file generated according to a preset bootstrap file template selected by the user, and adding the acquired bootstrap file to the IDE.
[0128] In this step, the IDE can be detected first to detect whether a pre-added bootstrap file exists. If it is detected that the pre-added bootstrap file exists, the bootstrap file is acquired. If it is not detected that the pre-added bootstrap file exists, prompt information can be presented to the user to prompt that no bootstrap file exists in the current IDE and needs to be added and / or edited by the user. Based on the prompt information, the user can add and / or edit the bootstrap file according to the prompt information, and then acquire the bootstrap file edited by the user or the bootstrap file generated according to a preset bootstrap file template selected by the user, and add the acquired bootstrap file to the IDE.
[0129] The preset bootstrap file template can be a default bootstrap file template provided by the IDE, or the bootstrap file added by the user can be used as the preset bootstrap file template, which can be edited again according to the operation of the user in subsequent use.
[0130] In some possible implementation manners, the at least one code snippet parsed from the guide file includes a title, a code body and a code component, and the title includes:
[0131] The guide file is parsed to generate an abstract syntax tree of the guide file;
[0132] The abstract syntax tree is traversed to extract the at least one code snippet, each code snippet including a title, a code body and a code component.
[0133] In this step, the guide file can be parsed to generate an abstract syntax tree of the guide file, and the abstract syntax tree is traversed to extract the at least one code snippet from the abstract syntax tree, each code snippet including a title, a code body and a code component.
[0134] In the process of extracting the at least one code snippet from the abstract syntax tree, the title can be detected first, and the title, the code body and the code component corresponding to the title are extracted in the case that the title is detected.
[0135] Further, in the case that the guide file includes a plurality of code snippets, based on the structure of the abstract syntax tree, the titles can be extracted first, and then the code body and the code component corresponding to each title are extracted in sequence, or one title is extracted, and then the code body and the code component corresponding to the title are extracted along the branch where the title is located, and then another title is extracted, and so on, until all the titles are extracted.
[0136] In some possible implementation manners, the at least one title parsed is displayed on a user development interface of the IDE, including:
[0137] Based on the at least one title parsed, a title control corresponding to each title is generated;
[0138] The at least one generated title control is displayed on the user development interface of the IDE.
[0139] In the case that the at least one title is parsed from the guide file, based on the at least one title parsed, a title control corresponding to each title can be generated first, and then the at least one generated title control is displayed on the user development interface of the IDE.
[0140] The title control can be in a shape of a circle, a triangle, a rectangle, or other shapes, which are not limited herein. In addition, the position of the title control in the user development interface can be at the lower right corner, the lower left corner, the middle, or other positions, which are not limited herein.
[0141] In some possible implementation, the target title is determined by the following steps:
[0142] Based on the triggering operation of the user on the target title control in the at least one title control, the target title corresponding to the target title control is determined.
[0143] In this step, after detecting the triggering operation of the user on a title control in the at least one title control, the triggered title control can be determined as the target title control based on the triggering operation on the title control, so that the target title corresponding to the target title control can be determined.
[0144] In some possible implementation, the current code snippet includes:
[0145] the target title, the code body corresponding to the target title, and the code component corresponding to the target title; or
[0146] the target title, the code body corresponding to the target title, and the code component corresponding to the target title, and the original code snippet in the code editing window.
[0147] In this step, when detecting the running operation of the user on the code editing window in the development interface, the code in the code editing window can be run in response to the running operation of the user. For this purpose, the current code snippet in the code editing window can be acquired first. When there is no original code snippet in the code editing window, the current code snippet includes the target title, the code body corresponding to the target title, and the code component corresponding to the target title. When there is an original code snippet in the code editing window, the current code snippet includes the target title, the code body corresponding to the target title, and the code component corresponding to the target title, and the original code snippet in the code editing window.
[0148] In some possible implementation, the running of the current code snippet includes:
[0149] determining the current code body and the current code component included in the current code snippet;
[0150] based on the current code body and the current code component, invoking the current code component to execute the current code body, and displaying the running result in the code running window in the user development interface.
[0151] In this step, in the case that a running operation of a user on a current code snippet in the code editing window is detected, the current code body and the current code component included in the current code snippet can be determined first, and then the current code component can be invoked to execute the current code body based on the current code body and the current code component, so as to obtain a running result of running the current code snippet, thereby the running result can be displayed in the code running window in the user development interface, and the user can view the running result.
[0152] For example, refer to Figures 4 to 6 , Figures 4 to 6 is a code running schematic diagram. As shown in Figure 4 , on a user development interface of an integrated development environment (IDE), a menu window 410, a file name display window 420, a code editing window 430, a code running window 440, and an interactive dialog box 450 are included, and based on the dialog box 450, it is prompted that a user can apply a guide file. In the case that a user selects a control corresponding to “generate file”, as shown in Figure 5 , a guide file with a name of “GUIDE” in a markdown format is obtained, the name and format of the guide file are displayed in the file name display window 420, and a code snippet parsed from the guide file is displayed in the code editing window 430, and at this time, based on the dialog box 450, it is prompted that a user can select a part of the code snippet for running. In the case that a user selects a control corresponding to “initialize project”, as shown in Figure 6 , a running result of code corresponding to the “initialize project” title is displayed in the code running window 440.
[0153] In some possible implementation manners, after the current code snippet is run and the running result is displayed, the guide file can be modified in response to a modification operation of a user, thereby a new guide file can be generated, and the above process can be repeated to obtain a new running result for the new guide file.
[0154] For example, refer to Figure 7 , Figure 7 is a flowchart of another coding assistance method provided by an embodiment of the present disclosure. As shown in Figure 7In the above method of the specific embodiment, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined according to its function and possible inherent logic.
[0155] The coding assistance method provided in the embodiments of the present disclosure can obtain a guide file, wherein the guide file is a structured text file format, and then at least one code segment is parsed from the guide file. Each code segment includes a title, a code body and a code component. At least one title parsed is displayed on a user development interface of the IDE. In response to a selection of a target title from the at least one title by a user, the target title and the corresponding code body and code component of the target title are displayed in a code editing window of the user development interface. In this way, the guide file can be flexibly used in the coding process without copying the code through other ways. The guide file is directly used to effectively reduce the workload of the developer, simplify the complexity of the coding operation, reduce the possibility of coding errors, and improve the coding efficiency. In addition, for beginners or developers who are not familiar with the IDE, the user using the IDE can be guided after entering the IDE, so as to avoid wasting time, improve the coding speed, and reduce the coding difficulty caused by beginners or unfamiliarity.
[0156] Those skilled in the art can understand that, in the above method of the specific embodiment, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined according to its function and possible inherent logic.
[0157] Based on the same inventive concept, the embodiments of the present disclosure also provide a coding assistance device corresponding to the coding assistance method. Since the principle of solving problems of the device in the embodiments of the present disclosure is similar to the above coding assistance method, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described again.
[0158] Referring to Figure 8 and Figure 9 , Figure 8 FIG. 1 is a schematic diagram of an encoding assistance device according to an embodiment of the present disclosure, Figure 9 FIG. 2 is another schematic diagram of an encoding assistance device according to an embodiment of the present disclosure.
[0159] As Figure 8 shown in FIG. 8, the encoding assistance device 800 according to an embodiment of the present disclosure comprises:
[0160] An acquisition module 810, configured to acquire a guide file, wherein the guide file is in a structured text file format;
[0161] An analysis module 820, configured to analyze at least one code segment from the guide file, each code segment comprising a title, a code body and a code component;
[0162] A display module 830, configured to display at least one title analyzed on a user development interface of an IDE;
[0163] A presentation module 840, configured to present, in response to a selection of a target title from the at least one title by a user, the target title and the code body and the code component corresponding to the target title in a code editing window in the user development interface.
[0164] In an optional implementation, the acquisition module 810 is specifically configured to:
[0165] acquire the guide file when the IDE is started;
[0166] and / or, in response to an addition operation of the guide file by the user during the coding by the user using the IDE, acquire the guide file.
[0167] In an optional implementation, the acquisition module 810 is specifically configured to:
[0168] detect whether a guide file is pre-added in the IDE;
[0169] if yes, acquire the guide file;
[0170] if no, present a prompt information to the user, so that the user adds and / or edits the guide file according to the prompt information, acquire the guide file edited by the user or the guide file generated according to a preset guide file template selected by the user, and add the acquired guide file to the IDE.
[0171] In an optional implementation, the analysis module 820 is specifically configured to:
[0172] parsing the bootstrap file to generate an abstract syntax tree of the bootstrap file;
[0173] traversing the abstract syntax tree to extract at least one code snippet, each code snippet including a title, a code body and a code component.
[0174] In an optional implementation, the display module 830 is specifically configured to:
[0175] generating a title control corresponding to each of the titles based on the at least one parsed title;
[0176] displaying the generated at least one title control on a user development interface of the IDE.
[0177] In an optional implementation, the display module 840 determines the target title by:
[0178] determining the target title corresponding to the target title control based on a triggering operation of the user on the target title control of the at least one title control.
[0179] In an optional implementation, as shown in Figure 9 the apparatus further includes a running module 850, which is configured to:
[0180] in response to a running operation of the user, obtaining a current code snippet in the code editing window;
[0181] running the current code snippet and displaying a running result in a code running window in the user development interface.
[0182] In an optional implementation, the current code snippet includes:
[0183] the target title and the code body and the code component corresponding to the target title; or
[0184] the target title and the code body and the code component corresponding to the target title, and an original code snippet in the code editing window.
[0185] In an optional implementation, when the running module 850 is used to run the current code snippet and display a running result in a code running window in the user development interface, the running module 850 is specifically configured to:
[0186] determining a current code body and a current code component included in the current code snippet;
[0187] Based on the current code body and the current code component, the current code component is invoked to execute the current code body, and a running result is displayed in a code running window in the user development interface.
[0188] The description of the processing flow of each module in the device and the interaction flow between the modules can refer to the related description in the above method embodiments, and will not be described in detail here.
[0189] The coding auxiliary device provided by the embodiments of the present disclosure can be in communication connection with an integrated development environment (IDE), can obtain a bootstrap file, the bootstrap file is in a structured text file format, and then at least one code segment is parsed from the bootstrap file, each code segment includes a title, a code body, and a code component. The at least one title parsed can be displayed on a user development interface of the IDE, so that the target title in the at least one title can be selected by a user, and the target title and the code body and the code component corresponding to the target title can be displayed in a code editing window in the user development interface. In this way, the bootstrap file can be flexibly used in the coding process, and the code does not need to be copied through other ways, but the bootstrap file is directly used, thereby effectively reducing the workload of a developer, simplifying the complexity of the coding operation, reducing the possibility of coding errors, and improving the coding efficiency. In addition, for beginners or developers who are not familiar with the IDE, the user using the IDE can be guided after entering the IDE, so that invalid time waste is avoided, the coding speed is improved, and the coding difficulty caused by beginners or unfamiliarity is reduced.
[0190] Corresponding to the above-mentioned coding auxiliary method, the embodiments of the present disclosure also provide an electronic device 1000, as shown in the figure, which is a schematic diagram of the electronic device 1000 provided by the embodiments of the present disclosure, comprising: Figure 10
[0191] The processor 1010, the memory 1020, and the bus 1030; the memory 1020 is used to store execution instructions, including the memory 1021 and the external memory 1022; the memory 1021 here is also called an internal memory, which is used to temporarily store operation data in the processor 1010 and data exchanged with the external memory 1022 such as a hard disk, the processor 1010 exchanges data with the external memory 1022 through the memory 1021, when the electronic device 1000 is running, the processor 1010 and the memory 1020 communicate through the bus 1030, so that the processor 1010 can execute the steps of the above-mentioned coding auxiliary method.
[0192] The embodiment of the present disclosure further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is run by a processor, steps of the encoding auxiliary method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer readable storage medium.
[0193] The embodiment of the present disclosure further provides a computer program product, and the computer program product includes computer instructions. When the computer instructions are executed by a processor, steps of the encoding auxiliary method described in the above method embodiment can be executed. For details, refer to the above method embodiment, and details are not described herein.
[0194] The computer program product can be specifically implemented by means of hardware, software or a combination thereof. In an optional embodiment, the computer program product is specifically embodied as a computer storage medium, and in another optional embodiment, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) or the like.
[0195] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described apparatus, device and storage medium can refer to the corresponding process in the foregoing method embodiment, and details are not described herein. In several embodiments provided by the present disclosure, it should be understood that the disclosed method, apparatus, device and storage medium can be implemented by other means. The apparatus embodiment described above is only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, devices or units, which can be electrical, mechanical or other forms.
[0196] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on a plurality of network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment.
[0197] In addition, each functional unit in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0198] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a nonvolatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present disclosure essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0199] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, and not to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art who is familiar with the technology in the art can still make modifications or easily think of changes to the technical solutions described in the foregoing embodiments, or make equivalent replacements to some of the technical features; and these modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. An encoding assistance method characterized by, The method applied to an integrated development environment (IDE) comprises: obtaining a guide file, wherein the guide file is in a structured text file format, and the guide file comprises at least one code snippet; obtaining a title from the guide file, and then obtaining code body and code component corresponding to each title, to parse at least one code snippet, wherein each code snippet comprises a title, code body and code component, the code body is a text file representing a source program generated in response to an input operation, and the code component is used to execute the code body; displaying the parsed at least one title on a user development interface of the IDE in the form of at least one title control; in response to a selection of a target title control in the at least one title control by a user, displaying a target title corresponding to the target title control and code body and code component corresponding to the target title in a code editing window in the user development interface.
2. The method of claim 1, wherein, The method comprises: obtaining the guide file when starting the IDE; and / or, in response to an addition operation of the guide file by the user during coding using the IDE, obtaining the guide file.
3. The method of claim 2, wherein, The method comprises: detecting whether a guide file is pre-added in the IDE; if yes, obtaining the guide file; if no, displaying prompt information to the user, so that the user adds and / or edits the guide file according to the prompt information, obtaining the guide file edited by the user or the guide file generated according to a preset guide file template selected by the user, and adding the obtained guide file to the IDE.
4. The method of claim 1, wherein, The method comprises: parsing the guide file to generate an abstract syntax tree of the guide file; traversing the abstract syntax tree to extract at least one code snippet, wherein each code snippet comprises a title, code body and code component.
5. The method of claim 1, wherein, The method comprises: generating a title control corresponding to each title based on the parsed at least one title; displaying the generated at least one title control on the user development interface of the IDE.
6. The method of claim 5, wherein, The target title is determined by: based on a trigger operation of a target title control in the at least one title control by the user, determining a target title corresponding to the target title control.
7. The method of claim 1, wherein, After the step of displaying the target title and code body and code component corresponding to the target title in the code editing window in the user development interface in response to the selection of the target title by the user, the method comprises: in response to a run operation of the user, obtaining a current code snippet in the code editing window; running the current code snippet to display a running result in a code running window in the user development interface.
8. The method of claim 7, wherein, The current code snippet comprises: the target title and code body and code component corresponding to the target title; or The target title and the code text and code component corresponding to the target title, and the original code segment in the code editing window.
9. The method of claim 7, wherein, The running of the current code segment, and the display of the running result in the code running window in the user development interface, include: Determine the current code text and the current code component included in the current code segment; Based on the current code text and the current code component, call the current code component to execute the current code text, and display the running result in the code running window in the user development interface.
10. An encoding aid, characterized in that The device is in communication connection with an integrated development environment (IDE), and the device includes: An acquisition module configured to acquire a bootstrap file, wherein the bootstrap file is in a structured text file format, and the bootstrap file includes at least one code segment; An analysis module configured to acquire a title from the bootstrap file, and then acquire a code text and a code component corresponding to each title, to analyze at least one code segment, each code segment including a title, a code text, and a code component, wherein the code text is a text file representing a source program generated in response to an input operation, and the code component is configured to execute the code text; A display module configured to display at least one title obtained by analysis in the form of at least one title control on a user development interface of the IDE; A presentation module configured to present, in a code editing window in the user development interface, a target title corresponding to a target title control and a code text and a code component corresponding to the target title, in response to a selection of the target title control by a user.
11. An electronic device, comprising: comprise: a processor, a memory, and a bus, the memory storing machine-readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, the machine-readable instructions executed by the processor perform the steps of the coding assistance method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is executed by the processor to perform the steps of the coding assistance method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Document code execution method and device, computer equipment and storage medium
CN111736812A
Generation method, device and system of title control, equipment and medium
CN112068828A
File processing method and device, computer equipment and storage medium
CN112667224A
Code generation method and device, electronic equipment and storage medium
CN113238752A