Methods and apparatus for code editing, and device and storage medium

By presenting interactive components in the code editing interface, users can perform multiple rounds of input operations in the interface, solving the problem of inefficient operation in traditional solutions and achieving a more efficient code editing experience.

WO2025077108A1PCT designated stage Publication Date: 2025-04-17DOUYIN VISION CO LTD

Patent Information

Application Number
PCT/CN2024/083139
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2025-04-17

AI Technical Summary

Technical Problem

During the code editing process, traditional solutions require users to frequently call input boxes during multiple rounds of conversations, resulting in inefficient operation.

Method used

Provided is a method and device that by displaying a code editing interface and presenting interactive components, including input controls, in the interface, the user can perform multiple rounds of input operations to generate response content while maintaining the interactive components displayed.

Benefits of technology

It improves the efficiency of code editing, reduces the user's need to frequently evoke input boxes during multiple rounds of operations, and improves the overall operation experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024083139_17042025_PF_FP_ABST
    Figure CN2024083139_17042025_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure relate to methods and an apparatus for code editing, and a device and a storage medium. A method provided herein comprises: displaying a code editing interface, wherein the code editing interface comprises a code editing area used for editing a code line; on the basis of a received first preset operation, presenting an interaction component in the code editing area, wherein the interaction component comprises an input control; on the basis of a first input acquired via the input control, providing first response content for the first input while maintaining the display of the interaction component; and on the basis of a second input acquired via the input control of the interaction component, providing second response content for the second input, wherein the second response content is generated on the basis of context information associated with the first response content. In this way, the embodiments of the present disclosure can enable a user to perform multiple rounds of code editing operations in a code editing interface, thereby enhancing the efficiency of code editing.
Need to check novelty before this filing date? Find Prior Art

Description

Method, apparatus, device and storage medium for code editing Technical Field

[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, devices, apparatuses, and computer-readable storage media for code editing. Background Art

[0002] With the development of computer technology, various electronic devices can greatly enrich people's daily lives. For example, people can perform operations such as question answering, generating and editing codes based on electronic devices.

[0003] Summary of the Invention

[0004] In a first aspect of the present disclosure, a method for code editing is provided. The method includes: displaying a code editing interface, the code editing interface including a code editing area for editing code lines; presenting an interactive component in the code editing area based on a received first preset operation, the interactive component including an input control; based on a first input obtained via the input control, while maintaining the display of the interactive component, providing first response content to the first input; and based on a second input obtained via the input control of the interactive component, providing second response content to the second input, the second response content being generated based on context information associated with the first response content.

[0005] In a second aspect of the present disclosure, a method for code editing is provided. The method includes: displaying a code editing interface, the code editing interface including a code editing area for editing code lines; presenting an interactive component in the code editing area based on a received first preset operation, the interactive component including an input control; determining a target task corresponding to the natural language input based on natural language input received by the input control; and displaying response content generated based on the natural language input in the code editing area or the interactive component based on the type of the target task.

[0006] In a third aspect of the present disclosure, a device for code editing is provided. The device includes: a display module configured to display a code editing interface, the code editing interface including a code editing area for editing code lines; a presentation module configured to present an interactive component in the code editing area based on a received first preset operation, the interactive component including an input control; a providing module configured to provide first response content to the first input while maintaining display of the interactive component based on a first input obtained via the input control; and a generating module configured to provide second response content to the second input based on a second input obtained via the input control of the interactive component, the second response content being generated based on context information associated with the first response content.

[0007] In a fourth aspect of the present disclosure, a device for code editing is provided. The device includes: a display module configured to display a code editing interface, the code editing interface including a code editing area for editing code lines; a presentation module configured to present an interactive component in the code editing area based on a received first preset operation, the interactive component including an input control; a determination module configured to determine a target task corresponding to the natural language input based on the natural language input obtained by the input control; and a generation module configured to display response content generated based on the natural language input in the code editing area or the interactive component based on the type of the target task.

[0008] In a fifth aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method of the first aspect or the second aspect.

[0009] In a sixth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect or the second aspect.

[0010] In a seventh aspect of the present disclosure, a computer program product is provided, which includes computer-executable instructions, which, when executed by a processor, implement the method according to the first or second aspect of the present disclosure.

[0011] It should be understood that the content described in this summary section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0013] FIG1 shows a schematic diagram of an example environment in which embodiments according to the present disclosure may be implemented;

[0014] 2A to 2K illustrate example interfaces according to some embodiments of the present disclosure;

[0015] FIG3 shows a flowchart of an example code editing process according to some embodiments of the present disclosure;

[0016] FIG4 shows a flowchart of an example code editing process according to some embodiments of the present disclosure;

[0017] FIG5A shows a schematic structural block diagram of an example apparatus for code editing according to some embodiments of the present disclosure;

[0018] FIG5B shows a schematic structural block diagram of an example apparatus for code editing according to some embodiments of the present disclosure; and

[0019] FIG6 illustrates a block diagram of an electronic device capable of implementing various embodiments of the present disclosure. DETAILED DESCRIPTION

[0020] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0021] It should be noted that the titles of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and any type of embodiment may be included under any section / subsection. Furthermore, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or in different sections / subsections.

[0022] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.

[0023] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects shall comply with the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user is aware of and confirms them. Accordingly, when implementing the various embodiments of the present disclosure, the types, scope of use, and usage scenarios of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method may vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.

[0024] If this specification and the solutions in the examples involve the processing of personal information, such processing will be done only with a legitimate basis (such as with the consent of the subject of personal information or as necessary for the performance of a contract) and only within the prescribed or agreed scope. A user's refusal to process personal information other than that required for basic functions will not affect the user's use of basic functions.

[0025] During the code editing process, smart coding can help people understand and edit code more easily. According to traditional solutions, smart coding usually requires users to repeatedly call up the input box during multiple rounds of conversation.

[0026] Embodiments of the present disclosure provide a solution for code editing. According to the solution, a code editing interface can be displayed, the code editing interface including a code editing area for editing code lines; based on a received first preset operation, an interactive component is presented in the code editing area, the interactive component including an input control; based on a first input obtained via the input control, a first response content to the first input is provided while the interactive component remains displayed; and based on a second input obtained via the input control of the interactive component, a second response content to the second input is provided, the second response content being generated based on context information associated with the first response content.

[0027] In this way, the embodiments of the present disclosure can enable the user to perform multiple rounds of code editing operations in the code editing interface, thereby improving the efficiency of code editing.

[0028] Various example implementations of this solution are described in detail below in conjunction with the accompanying drawings.

[0029] Sample Environment

[0030] FIG1 shows a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. As shown in FIG1 , the example environment 100 may include an electronic device 110 .

[0031] In this example environment 100, electronic device 110 may run an application 120 that supports interface interaction. Application 120 may be any suitable type of application for interface interaction, examples of which may include, but are not limited to, code editing applications, applications integrated with an integrated development environment (IDE), or other suitable applications such as a browser. User 140 may interact with application 120 via electronic device 110 and / or its attached devices.

[0032] In the environment 100 of FIG. 1 , if the application 120 is in an active state, the electronic device 110 may present an interface 150 for supporting interface interaction through the application 120 .

[0033] In some embodiments, the electronic device 110 communicates with the server 130 to enable the provision of services for the application 120. The electronic device 110 can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a handheld computer, a portable game terminal, a VR / AR device, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the electronic device 110 can also support any type of interface for the user (such as a "wearable" circuit, etc.).

[0034] The server 130 may be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. For example, the server 130 may include a computing system / server such as a mainframe, an edge computing node, a computing device in a cloud environment, and the like. The server 130 may provide background services for the application 120 that supports virtual scenes in the electronic device 110.

[0035] A communication connection may be established between the server 130 and the electronic device 110. The communication connection may be established in a wired or wireless manner. The communication connection may include, but is not limited to, a Bluetooth connection, a mobile network connection, a Universal Serial Bus (USB) connection, a Wireless Fidelity (WiFi) connection, etc., and the embodiments of the present disclosure are not limited in this respect. In the embodiments of the present disclosure, the server 130 and the electronic device 110 may implement signaling interaction through the communication connection between the two.

[0036] It should be understood that the structure and function of the various elements in the environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of the present disclosure.

[0037] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.

[0038] Example Interaction

[0039] The following will describe an example code editing process according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0040] 2A to 2K illustrate example code editing interfaces 200A to 200K according to some embodiments of the present disclosure. Interfaces 200A to 200K may be provided by the electronic device 110 shown in FIG1 . An integrated development environment (IDE) deployed in the electronic device 110 may provide such a code editing interface.

[0041] In some embodiments, IDE can provide a code editing area for editing code for the user.For example, the user can enter code lines in the code editing area by inputting or the like.

[0042] In some embodiments, to improve code editing efficiency, the IDE may present an interactive component 210 as shown in FIG2A in the code editing area based on a user's preset operation. Such an interactive component 210 may, for example, support receiving user input information and performing corresponding processing actions, such as code generation, code annotation, code modification, etc.

[0043] As an example, the user can invoke the interactive component 210 through a preset operation (e.g., a shortcut key, a floating window button, etc.). In addition, the user can also invoke the interactive component 210 from a blank space or after selecting code content. This disclosure is not intended to limit the invocation form of the interactive component.

[0044] 2A , the interaction component 210 may include an input control 211 for receiving user input 212. As an example, the input control 211 may receive any appropriate content input by the user, such as natural language content or preset instructions supported by the IDE.

[0045] Taking FIG. 2A as an example, the user may input natural language content through the input control 211 , for example, “help me write addition and subtraction functions.”

[0046] In some embodiments, the IDE also displays a reminder message 214, for example, to prompt the user to display the preset instructions supported by the IDE by entering " / ". In some embodiments, such preset instructions can be associated with a preset model prompt. For example, the user can enter " / " in the input control 210 and select the preset instruction " / explain". Subsequently, the user can continue to enter the complete content " / explain XXXX" in the input control 210, which may indicate that the user hopes that the IDE can explain "XXXX". Accordingly, the IDE can generate a prompt item corresponding to the input content according to the preset prompt item construction method.

[0047] In some embodiments, such a preset instruction can be associated with a preset function of the IDE. For example, a user can enter " / " in input control 210 and select the preset instruction " / clear", which can indicate that the user wishes the IDE to clear the current session. Such a preset function can be executed without invoking a model.

[0048] Additionally, as shown in FIG. 2A , the interaction component may further include, for example, reminder information 216 to indicate that the user can use the up and down arrow keys to view historical input messages of the interaction component 210 .

[0049] Furthermore, after receiving a send operation for input content 212 (e.g., generated code), electronic device 110 may present interface 200B as shown in FIG2B . As shown in FIG2B , the IDE may continue to display interactive component 210 and may provide response content 225 generated based on input content 212 in the code editing area. Such response content 225 may, for example, include a code snippet generated based on input content 212.

[0050] As shown in FIG. 2B , while the response content 225 is being provided, the interaction component 210 can display the input content 212 and reference content 221 for generating the response content 225 .

[0051] Additionally, the interaction component 210 may further provide an input control 211 to support the user to continue to utilize the input control 211 to interact with the interaction component 210 , thereby achieving multiple rounds of dialogue interaction.

[0052] Additionally, the IDE may also provide one or more feedback controls 223 regarding the response content 225 in the interaction component 210. For example, the user may accept the generated code snippet by clicking an "Accept" button. Alternatively, the user may reject the generated code snippet by clicking a "Reject" button, causing the IDE to stop displaying the code snippet.

[0053] As another example, the user may also click the "Regenerate" button to trigger the IDE to regenerate a new code snippet based on the input content 212. Alternatively, the user may also click the "Like" button or the "Dislike" button (not shown) to provide feedback on the generated code snippet.

[0054] Alternatively or additionally, the IDE may further provide, in association with the response content 225 , one or more controls 226 for accepting or rejecting the response content 225 , or a control for switching contexts (not shown).

[0055] In some embodiments, when the response content 225 includes target editing content in the code editing area, the IDE can provide a control for accepting or rejecting the target editing content (e.g., control 223) in the interactive component 210, or can provide a control for accepting or rejecting the target editing content (e.g., control 226) in association with the target editing content.

[0056] For example, such target editing content may include inserting new code content, modifying code content, deleting code content, and the like.

[0057] 2C , the IDE may obtain user input content 230 via the input control 211 . Furthermore, as shown in FIG2D , the IDE may generate response content 240 for the input content 230 in the interaction component 210 .

[0058] In some embodiments, the generation of response content 240 can be based on the context associated with the previous round of dialogue. Taking Figure 2D as an example, although input content 230 does not indicate the scope of the code snippet that needs to be explained, the IDE can determine that the code snippet that needs to be explained is the code snippet contained in response content 225 based on the context associated with response content 225.

[0059] In some embodiments, the IDE may further provide an entry 244 in the interaction component 210 to support viewing interaction messages in the conversation window. An example of viewing interaction messages in the conversation window will be described below with reference to FIG. 2K and will not be described in detail here.

[0060] In some embodiments, response content 225 and response content 240 can be generated by a virtual object (e.g., a digital assistant implemented based on a model). Accordingly, input content 212 and input content 230 can correspond to multiple rounds of input in the same conversation between the user and the virtual object. Thus, when the virtual object processes input content 230, it can obtain historical context information from the conversation, thereby achieving context inheritance.

[0061] For example, when the input content 212 also indicates the selection of a specific code snippet in the code editing area, the virtual object can obtain context information associated with the specific code snippet when processing the input content 230, thereby improving the accuracy of code processing.

[0062] In this way, embodiments of the present disclosure can support users in implementing multi-round dialogues supporting context inheritance by calling interactive components in a code editing area, thereby improving the efficiency of code editing.

[0063] As an example, the response content 240 may include explanatory content regarding the code snippet in the response content 225. In some embodiments, the IDE may also provide one or more controls 242 in association with the response content 240.

[0064] As an example, such a control 242 may be generated based on the type of the response content 240. For example, when the response content 240 includes text content, such a control 242 may support copying such text content, or inserting the corresponding text content into a designated area.

[0065] In another example, when the response content 240 includes executable code, such a control 242 may also be used to run such executable code.

[0066] 2B and 2D , the IDE may also determine whether to display the response content 225 or 240 in the code editing area or in the interactive component 210 based on the type of the response content 225 or 240 .

[0067] In some embodiments, if the response content is code generation content for the input content, code editing content for the input content, code comment content for the input content, or code repair content for the input content, the IDE can provide such response content in the code editing area.

[0068] In some embodiments, if the response content is an explanation of the input content, the IDE may display the response content in the interactive component 210. For example, if the input content includes a question that the user desires to know, and the response content is an answer to the question input by the user, the IDE may display the answer in the interactive component 210.

[0069] In some embodiments, as mentioned above, the IDE may support the user to input natural language content in the input control of the interactive component without requiring the user to specify the task that the IDE needs to perform.

[0070] In some embodiments, the IDE can determine a target task corresponding to the natural language input based on the natural language input obtained in the input control. Taking Figure 2E as an example, for the natural language content 250 input by the user, the IDE can, for example, determine the editing intent corresponding to the natural language content 250.

[0071] In some embodiments, the IDE may, for example, determine a target task corresponding to the natural language content 250 from a set of preset tasks. As an example, such a set of preset tasks may include, but is not limited to, one or more of the following: a first task for generating interpretation content for natural language input; a second task for generating code generation content for natural language input; a third task for generating code editing content for natural language input; a fourth task for generating code annotation content for natural language input; and a fifth task for generating code repair content for natural language input.

[0072] In some embodiments, the IDE may utilize a task identification model to determine the target task corresponding to the natural language content 250. Such a task identification model may include a dedicated task classification model, or may be implemented by a general language model.

[0073] As an example, the IDE may provide the natural language content 250 and / or associated context information to the task identification model, so that the task identification model can determine the editing intention corresponding to the natural language content 250 , that is, the target task.

[0074] In this way, the embodiments of the present disclosure do not require the user to explicitly specify the tasks that the IDE is expected to perform, and can support the user to express code editing needs through unified natural language input, thereby achieving more unified interaction.

[0075] Further, with continued reference to FIG. 2E and FIG. 2F , after receiving the natural language content 250 , the IDE may present an interface 200F as shown in FIG. 2F .

[0076] 2F , interface 200F may include, but is not limited to, natural language content 250, referenced materials, and the processing state of the IDE, i.e., whether the IDE is in a thinking state or a generating state 260. Furthermore, the IDE may stop processing the natural language content 250 based on a preset operation.

[0077] 2E and 2F , after the user sends the natural language content 250, the IDE may determine the target task corresponding to the natural language content 250. For example, the IDE may present indication information 260 to indicate that the IDE is determining the corresponding task.

[0078] In some examples, the user can also control the IDE to stop determining the target task and terminate the processing of the natural language content 250 through the control 262 , for example.

[0079] In some examples, depending on the type of target task, the IDE can use different modes to provide response content corresponding to the target task. As shown in Figure 2G, when the user selects code snippet 270 and enters natural language content 271, the IDE can determine that natural language content 271 corresponds to the first task of generating interpretation content for the natural language input.

[0080] Accordingly, the IDE can provide corresponding response content within the interactive component 210. Such response content may include, but is not limited to, text content 273 or code content 274. As discussed above, the IDE can also provide one or more controls 275 associated with the response content to support corresponding functions such as copy, insert, and run.

[0081] In some embodiments, as shown in Figure 2H, when the user inputs natural language content 281, the IDE can determine that the natural language content 281 can correspond to one of the following tasks, for example: a second task for generating code generation content for natural language input; a third task for generating code editing content for natural language input; a fourth task for generating code annotation content for natural language input; and a fifth task for generating code repair content for natural language input.

[0082] 2H , response content 282 may correspond to a generated code snippet, and the IDE may display the generated code snippet outside of interactive component 210. Additionally, the IDE may also provide a control 283 associated with response content 282 for accepting or rejecting response content 282.

[0083] As another example, as shown in FIG2I , natural language content 291 may correspond to an editing task for an existing code snippet. Accordingly, response content 292 may correspond to edited content regarding the existing code snippet, and the IDE may display the edited content outside of interactive component 210. Additionally, the IDE may provide a control 293 associated with response content 292 for accepting or rejecting response content 292.

[0084] In some embodiments, the IDE can determine its corresponding task based on the natural language text input by the user. In some specific examples, such task scenarios can include but are not limited to code explanation, annotation, repair, unit testing and other more extensible content.

[0085] In some examples, in code generation scenarios, the IDE determines to generate code content from 0 to 1 and generates the relevant code in the code editor. Supported user operations include but are not limited to continuing the dialog, regenerating, accepting / rejecting all, etc.

[0086] In some examples, when modifying code, the IDE can determine that changes are being made to existing code, generate the corresponding changes within the code editor, and display the differences. Users can choose to continue the conversation, regenerate the changes, or accept or reject them in whole or in part.

[0087] In some examples, in code Q&A scenarios, the IDE can generate corresponding Q&A content in the interactive component without affecting the relevant content in the user's code editor. Support for users includes but is not limited to continuing the conversation and regenerating.

[0088] In some examples, during code explanation scenarios, users can enter natural language, the / explain task command, or the / explain task command plus natural language. Once the task is initiated, the IDE recognizes it as a request for code explanation and generates corresponding Q&A content in the interactive component, without affecting the user's code editing area. The IDE can support options including, but not limited to, continuing the conversation, regenerating, and accepting / rejecting all.

[0089] In some examples, in code commenting scenarios, users can enter natural language, / doc commands, or both. The IDE can then identify changes to existing code, generate the corresponding changes within the code editor, and display the differences. The IDE can also support options such as continuing the conversation, regenerating, and accepting or rejecting the changes in whole or in part.

[0090] In some examples, in code repair scenarios, users can enter natural language, / fix task instructions, / fix task instructions plus natural language, or perform preset operations (for example, clicking the Fix button) in the error prompt area within the code editor. After initiating the task, the IDE can recognize the need for code repair, determine that it is necessary to make related modifications to the existing code, generate the corresponding modified content in the code editor, and display the difference in the code. The IDE can support users including but not limited to continuing the conversation, regenerating, accepting / rejecting in whole or in part, etc.

[0091] In some examples, in code unit testing scenarios, users can enter natural language, the / test task command, or the / test task command plus natural language. After initiating the task, the IDE recognizes the need for code unit testing and determines that the code content should be generated from 0 to 1, generating the relevant code within the code editor. The IDE can support options including, but not limited to, continuing the conversation, regenerating, and accepting / rejecting all.

[0092] Through the interaction process described above, the embodiments of the present disclosure can support users to express their code editing intentions through unified natural language input, and can provide users with response content with a unified style, thereby improving the efficiency and experience of code editing.

[0093] The following will further describe the support for processing user input in the code editing interface by means of a dialog window. In some embodiments, the IDE can support the user to trigger the IDE to present a dialog window through a preset operation.

[0094] 2J as an example, the IDE may present a dialog window based on the user's selection of entry 291. Alternatively, the IDE may receive the user's selection of code snippet 270 and receive a selection of entry 292 to present the dialog window.

[0095] In yet other embodiments, as discussed above, the IDE may also present a dialog window based on selection of a portal 244 in the interactive component.

[0096] As shown in Figure 2K, the IDE can display a dialog window 293 with the virtual object in the code editing interface 200K. In some embodiments, the dialog window 293 can present interactive messages between the user and the virtual object.

[0097] In some embodiments, the dialog window 293 may provide an input control 296 , and may obtain user input content via the control 296 , and provide feedback on the input content.

[0098] In some embodiments, when the dialog window 293 is displayed based on the entry 244 in the interactive component 210 triggered by the user, the IDE may stop displaying the interactive component 210 accordingly.

[0099] Additionally, the IDE may present interaction messages between the user and the interaction component 210 in the dialog window 293. Such interaction messages may include, but are not limited to, input content 212, response content 225, input content 230, and response content 240.

[0100] Furthermore, the IDE may support the user to integrate contextual information of the interactive component 210 in the dialog window 293 to process additional input received via the input control 296 and provide corresponding additional response content in the dialog window 293 or the code editing area.

[0101] In some embodiments, the additional input and the already received input content (eg, input content 212 or input content 230 ) may correspond to multiple turns of input in the same conversation with the virtual object.

[0102] In some embodiments, the IDE may also support the user in establishing a new dialog with a virtual object, thereby processing received input content without inheriting the context information of the interaction component 210 .

[0103] In some embodiments, the IDE may also support the user to view historical conversations with the virtual object by clicking “history”. Such historical conversations may correspond to one or more conversations with other interactive components, or conversations initiated in the conversation window 293.

[0104] Accordingly, after receiving an instruction to switch to another dialog, the IDE may switch the dialog window 293 to present historical interaction messages associated with the other selected dialog.

[0105] In this way, the embodiments of the present disclosure can also support unified management of one or more rounds of conversations with interactive components in a conversation window, thereby facilitating users to view historical interaction records and improving code editing efficiency.

[0106] Example Process

[0107] 3 shows a flowchart of an example code editing process 300 according to some embodiments of the present disclosure. The process 300 may be implemented at the electronic device 110. The process 300 is described below with reference to FIG1.

[0108] As shown in the figure, in block 310 , the electronic device 110 displays a code editing interface, which includes a code editing area for editing code lines.

[0109] In block 320 , the electronic device 110 presents an interactive component in the code editing area based on the received first preset operation, where the interactive component includes an input control.

[0110] In block 330 , the electronic device 110 provides first response content to the first input based on the first input obtained via the input control while maintaining display of the interactive component.

[0111] In block 340 , the electronic device 110 provides second response content for the second input based on the second input obtained via the input control of the interactive component, where the second response content is generated based on context information associated with the first response content.

[0112] In some embodiments, process 300 also includes: displaying a dialog window in the code editing interface based on a second preset operation for the interactive component; and displaying an interactive message corresponding to the interactive component in the dialog window, the interactive message including at least a first input, a first response content, a second input, and a second response content.

[0113] In some embodiments, providing first response content to the first input includes: displaying the first response content in an interactive component or a code editing area based on a type of the first response content.

[0114] In some embodiments, the type includes one of: interpretation content for the first input; code generation content for the first input; code editing content for the first input; code annotation content for the first input; code repair content for the first input.

[0115] In some embodiments, the first input and the second input correspond to multiple turns of input in the same session with the target virtual object.

[0116] In some embodiments, the first input and / or the second input includes at least one of the following: natural language input; a first preset instruction corresponding to a preset function; a second preset instruction corresponding to a preset prompt information.

[0117] In some embodiments, the first input also indicates a selection of the code snippet.

[0118] In some embodiments, contextual information is associated with the selected code snippet.

[0119] In some embodiments, process 300 further includes: in response to the first response content or the second response content including the target editing content in the code editing region, providing a control in the interactive component for accepting or rejecting the target editing content.

[0120] FIG4 shows a flowchart of an example code editing process 400 according to some embodiments of the present disclosure. The process 400 may be implemented at the electronic device 110. The process 400 is described below with reference to FIG1.

[0121] As shown in FIG. 4 , in block 410 , the electronic device 110 displays a code editing interface, which includes a code editing area for editing code lines.

[0122] In block 420 , the electronic device 110 presents an interactive component in the code editing area based on the received first preset operation, where the interactive component includes an input control.

[0123] In block 430 , the electronic device 110 determines a target task corresponding to the natural language input based on the natural language input acquired by the input control.

[0124] In block 440 , the electronic device 110 displays response content generated based on the natural language input in the code editing area or the interactive component based on the type of the target task.

[0125] In some embodiments, determining a target task corresponding to the natural language input based on the natural language input acquired by the input control includes: determining a target task matching the natural language input from a set of preset tasks based on the natural language input.

[0126] In some embodiments, a set of preset tasks includes multiple items of the following: a first task for generating interpretation content for natural language input; a second task for generating code generation content for natural language input; a third task for generating code editing content for natural language input; a fourth task for generating code annotation content for natural language input; and a fifth task for generating code repair content for natural language input.

[0127] In some embodiments, determining a target task corresponding to the natural language input based on the natural language input acquired by the input control includes: providing the natural language input to a task recognition model to determine a target task that matches the natural language input.

[0128] In some embodiments, process 400 also includes: displaying a dialog window in the code editing interface based on a second preset operation for the interactive component; and displaying an interactive message corresponding to the interactive component in the dialog window, the interactive message including at least natural language input and response content.

[0129] In some embodiments, process 400 further includes: in response to a second preset operation, stopping presenting the interactive component in the code editing area.

[0130] In some embodiments, the input control is a first input control, and the dialog window also provides a second input control. Process 400 also includes: based on the additional input content obtained via the second input control, providing additional response content for the additional input content in the dialog window and / or the code editing area.

[0131] In some embodiments, the conversation window is associated with a target virtual object, and the natural language input and the additional input content input correspond to multiple rounds of input in a first conversation with the target virtual object.

[0132] In some embodiments, process 400 further includes: based on a preset operation for the dialog window, switching the dialog window to present historical interaction messages, where the historical interaction messages correspond to a second conversation with the target virtual object.

[0133] Example devices and equipment

[0134] Embodiments of the present disclosure also provide corresponding apparatuses for implementing the above-described methods or processes. FIG5A shows a schematic structural block diagram of an example apparatus 500A for code editing according to certain embodiments of the present disclosure. Apparatus 500A may be implemented as or included in electronic device 110. Each module / component in apparatus 500A may be implemented by hardware, software, firmware, or any combination thereof.

[0135] As shown in Figure 5A, the device 500A includes a display module 510, which is configured to display a code editing interface, the code editing interface includes a code editing area for editing code lines; a presentation module 520, which is configured to present an interactive component in the code editing area based on a received first preset operation, the interactive component including an input control; a providing module 530, which is configured to provide a first response content to the first input while keeping the interactive component displayed based on a first input obtained via the input control; and a generation module 540, which is configured to provide a second response content to the second input based on a second input obtained via the input control of the interactive component, the second response content being generated based on context information associated with the first response content.

[0136] In some embodiments, the device 500A also includes a first display module, which is configured to display a dialog window in the code editing interface based on a second preset operation for the interactive component; and display an interactive message corresponding to the interactive component in the dialog window, the interactive message including at least a first input, a first response content, a second input and a second response content.

[0137] In some embodiments, the providing module 530 is further configured to: provide the first response content for the first input includes: displaying the first response content in an interactive component or a code editing area based on the type of the first response content.

[0138] In some embodiments, the type includes one of: interpretation content for the first input; code generation content for the first input; code editing content for the first input; code annotation content for the first input; code repair content for the first input.

[0139] In some embodiments, the first input and the second input correspond to multiple turns of input in the same session with the target virtual object.

[0140] In some embodiments, the first input and / or the second input includes at least one of the following: natural language input; a first preset instruction corresponding to a preset function; a second preset instruction corresponding to a preset prompt information.

[0141] In some embodiments, the first input also indicates a selection of the code snippet.

[0142] In some embodiments, contextual information is associated with the selected code snippet.

[0143] In some embodiments, the apparatus 500A further includes a first providing module configured to provide a control for accepting or rejecting the target editing content in the interactive component in response to the first response content or the second response content including the target editing content in the code editing area.

[0144] 5B shows a schematic structural block diagram of an example apparatus 500B for code editing according to certain embodiments of the present disclosure. Apparatus 500B may be implemented as or included in electronic device 110. Each module / component in apparatus 500B may be implemented by hardware, software, firmware, or any combination thereof.

[0145] As shown in Figure 5B, the device 500B includes a display module 550, which is configured to display a code editing interface, the code editing interface includes a code editing area for editing code lines; a presentation module 560, which is configured to present an interactive component in the code editing area based on a received first preset operation, the interactive component including an input control; a determination module 570, which is configured to determine a target task corresponding to the natural language input based on the natural language input obtained by the input control; and a generation module 580, which is configured to display response content generated based on the natural language input in the code editing area or the interactive component based on the type of the target task.

[0146] In some embodiments, the determination module 570 is further specifically configured to: based on the natural language input, determine a target task that matches the natural language input from a set of preset tasks.

[0147] In some embodiments, a set of preset tasks includes multiple items of the following: a first task for generating interpretation content for natural language input; a second task for generating code generation content for natural language input; a third task for generating code editing content for natural language input; a fourth task for generating code annotation content for natural language input; and a fifth task for generating code repair content for natural language input.

[0148] In some embodiments, the determination module 570 is further specifically configured to: provide natural language input to the task identification model to determine a target task that matches the natural language input.

[0149] In some embodiments, the device 500B also includes a first display module, which is configured to display a dialog window in the code editing interface based on a second preset operation for the interactive component; and display an interactive message corresponding to the interactive component in the dialog window, the interactive message including at least natural language input and response content.

[0150] In some embodiments, the apparatus 500B further includes a stopping module configured to stop presenting the interactive component in the code editing area in response to a second preset operation.

[0151] In some embodiments, the input control is a first input control, the dialog window also provides a second input control, and the device 500B also includes a first providing module, which is configured to provide additional response content for the additional input content in the dialog window and / or code editing area based on the additional input content obtained via the second input control.

[0152] In some embodiments, the conversation window is associated with a target virtual object, and the natural language input and the additional input content input correspond to multiple rounds of input in a first conversation with the target virtual object.

[0153] In some embodiments, the apparatus 500B further includes a first presentation module configured to switch the dialog window to present historical interaction messages based on a preset operation for the dialog window, where the historical interaction messages correspond to the second conversation with the target virtual object.

[0154] FIG6 shows a block diagram of an electronic device 600 in which one or more embodiments of the present disclosure may be implemented. It should be understood that the electronic device 600 shown in FIG6 is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. The electronic device 600 shown in FIG6 can be used to implement the electronic device 110 of FIG1 .

[0155] As shown in FIG6 , electronic device 600 is a general-purpose electronic device. Components of electronic device 600 may include, but are not limited to, one or more processors or processing units 610, memory 620, storage device 630, one or more communication units 640, one or more input devices 650, and one or more output devices 660. Processing unit 610 may be a real or virtual processor and is capable of performing various processes according to programs stored in memory 620. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to enhance the parallel processing capabilities of electronic device 600.

[0156] The electronic device 600 typically includes a plurality of computer storage media. Such media can be any accessible media that can be obtained by the electronic device 600, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 620 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 630 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and / or data and can be accessed within the electronic device 600.

[0157] The electronic device 600 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG6 , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a “floppy disk”) and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) by one or more data media interfaces. The memory 620 may include a computer program product 625 having one or more program modules configured to perform various methods or actions of various embodiments of the present disclosure.

[0158] The communication unit 640 enables communication with other electronic devices via a communication medium. Additionally, the functions of the components of the electronic device 600 can be implemented in a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the electronic device 600 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.

[0159] The input device 650 may be one or more input devices, such as a mouse, keyboard, or trackball. The output device 660 may be one or more output devices, such as a display, a speaker, or a printer. The electronic device 600 may also communicate with one or more external devices (not shown) through the communication unit 640 as needed, such as a storage device, a display device, or the like, with one or more devices that allow a user to interact with the electronic device 600, or with any device that allows the electronic device 600 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0160] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0161] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0162] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0163] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0164] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple implementations of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part for a module, program segment or instruction, and a part for a module, program segment or instruction comprises one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0165] While various implementations of the present disclosure have been described above, the foregoing description is intended to be illustrative, not exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is selected to best explain the principles of the implementations, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for code editing, comprising: Displaying a code editing interface, the code editing interface including a code editing area for editing code lines; Based on the received first preset operation, presenting an interactive component in the code editing area, the interactive component including an input control; Based on a first input obtained via the input control, while maintaining display of the interactive component, providing first response content for the first input; as well as Based on a second input obtained via the input control of the interactive component, second response content for the second input is provided, wherein the second response content is generated based on context information associated with the first response content.

2. The method according to claim 1, further comprising: Based on a second preset operation for the interactive component, displaying a dialog window in the code editing interface; as well as An interaction message corresponding to the interaction component is displayed in the dialog window, wherein the interaction message at least includes the first input, the first response content, the second input, and the second response content.

3. The method according to claim 1, wherein providing a first response content to the first input comprises: Based on the type of the first response content, the first response content is displayed in the interactive component or the code editing area.

4. The method of claim 3, wherein the type comprises one of: an explanation of the first input; Generate content for the first input code; Editing content of the code for the first input; Annotation content of the code for the first input; The code of the first input is repaired. 5 . The method of claim 1 , wherein the first input and the second input correspond to multiple turns of input in the same session with a target virtual object.

6. The method according to claim 1, wherein the first input and / or the second input comprises at least one of the following: Natural language input; a first preset instruction corresponding to the preset function; A second preset instruction corresponding to the preset prompt information. The method of claim 1 , wherein the first input further indicates a selection of a code snippet. The method of claim 7 , wherein the context information is associated with the selected code snippet.

9. The method according to claim 1, further comprising: In response to the first response content or the second response content including target editing content in the code editing area, providing a control in the interactive component for accepting or rejecting the target editing content.

10. A method for code editing, comprising: Displaying a code editing interface, the code editing interface including a code editing area for editing code lines; Based on the received first preset operation, presenting an interactive component in the code editing area, the interactive component including an input control; Based on the natural language input acquired by the input control, determining a target task corresponding to the natural language input; as well as Based on the type of the target task, response content generated based on the natural language input is displayed in the code editing area or the interactive component.

11. The method according to claim 10, wherein determining a target task corresponding to the natural language input based on the natural language input acquired by the input control comprises: Based on the natural language input, the target task matching the natural language input is determined from a group of preset tasks.

12. The method of claim 11, wherein the set of pre-set tasks includes multiple of the following: The first task is to generate explanation content for the natural language input; The second task is to generate code generation content for the natural language input; The third task is to generate code editing content for the natural language input; The fourth task is to generate code annotation content for the natural language input; The fifth task is to generate code repair content for the natural language input.

13. The method according to claim 10, wherein determining a target task corresponding to the natural language input based on the natural language input acquired by the input control comprises: The natural language input is provided to a task identification model to determine the target task that matches the natural language input.

14. The method according to claim 10, further comprising: Based on a second preset operation for the interactive component, displaying a dialog window in the code editing interface; as well as An interaction message corresponding to the interaction component is displayed in the dialog window, wherein the interaction message at least includes the natural language input and the response content.

15. The method according to claim 14, further comprising: In response to the second preset operation, the interactive component is stopped from being presented in the code editing area.

16. The method according to claim 14, wherein the input control is a first input control, the dialog window further provides a second input control, and the method further comprises: Based on the additional input content acquired via the second input control, additional response content to the additional input content is provided in the dialog window and / or the code editing area. 17 . The method of claim 16 , wherein the dialog window is associated with a target virtual object, and the natural language input and the additional input content input correspond to multiple rounds of input in a first conversation with the target virtual object.

18. The method according to claim 17, further comprising: Based on a preset operation for the dialog window, the dialog window is switched to present a historical interaction message, where the historical interaction message corresponds to a second conversation with the target virtual object.

19. A device for code editing, comprising: A display module configured to display a code editing interface, wherein the code editing interface includes a code editing area for editing code lines; A presentation module, configured to present an interactive component in the code editing area based on the received first preset operation, wherein the interactive component includes an input control; a providing module configured to provide, based on a first input acquired via the input control, a first response content for the first input while keeping displaying the interactive component; as well as The generating module is configured to provide second response content for the second input based on the second input obtained through the input control of the interactive component, wherein the second response content is generated based on context information associated with the first response content.

20. A device for code editing, comprising: A display module configured to display a code editing interface, wherein the code editing interface includes a code editing area for editing code lines; A presentation module, configured to present an interactive component in the code editing area based on the received first preset operation, wherein the interactive component includes an input control; A determination module, configured to determine a target task corresponding to the natural language input based on the natural language input acquired by the input control; as well as A generating module is configured to display response content generated based on the natural language input in the code editing area or the interactive component based on the type of the target task.

21. An electronic device, comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform a method according to any one of claims 1 to 9 or 10 to 18.

22. A computer-readable storage medium having a computer program stored thereon, the computer program being executable by a processor to implement the method according to any one of claims 1 to 9 or 10 to 18.

23. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 9 or 10 to 18.

Citation Information

Patent Citations

  • Code generation method and device, electronic equipment and storage medium

    CN117724722A

  • Natural Language Engine for Coding and Debugging

    US20160357519A1

Cited By

  • Interface interaction method and device, equipment and storage medium

    CN121029299A