Code debugging method, device, equipment, medium and product

By running an extension plugin in the code editor, the debugging commands are enhanced and their display is improved, addressing the shortcomings of the existing debugging console and enhancing the security and readability of debugging results.

CN122432023APending Publication Date: 2026-07-21MOORE THREADS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MOORE THREADS TECH CO LTD
Filing Date
2026-06-18
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

The existing code editor's debugging console cannot handle debugging commands, and the displayed debugging results are presented in a single format, lacking flexibility and readability.

Method used

By running the extension plugin in the code editor, the debugging commands in the debugging interaction window are obtained, and the command and display are enhanced to improve the security and reliability of command execution and enrich the display of debugging results.

Benefits of technology

It effectively reduces the risk of command execution failure or exception, improves the security and readability of the debugging command execution process, and solves the problem of the single format of debugging console results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432023A_ABST
    Figure CN122432023A_ABST
Patent Text Reader

Abstract

The application discloses a code debugging method and device, equipment, medium and product, and relates to the technical field of computers. The method comprises the following steps: acquiring a first debugging command input in a debugging interaction window, wherein the debugging interaction window is created by calling a view interface of a code editor; determining a command execution result based on the first debugging command by calling a debugging interface of the code editor, wherein the debugging interface is used for calling a debugging tool to perform code debugging; and controlling the debugging interaction window to perform display based on the command execution result; wherein an extension plug-in is used to perform at least one of the following functions: command enhancement processing on the first debugging command, and display enhancement processing on the command execution result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a code debugging method, apparatus, device, medium and product. Background Technology

[0002] Code debugging is a crucial part of the software and hardware development process. After code development is complete, developers need to verify the logical correctness of the code to ensure the reliability and stability of the software and hardware functions.

[0003] In related technologies, developers typically use the built-in debugging console of the code editor to input debugging commands, enabling interaction with underlying debugging tools to complete debugging operations such as setting breakpoints and viewing variables.

[0004] However, the existing debugging console cannot process debugging commands, and the debugging results it displays are presented in a single format, lacking flexibility and readability. Summary of the Invention

[0005] This application provides a code debugging method, apparatus, device, medium, and product. The technical solutions provided by this application include the following aspects.

[0006] On one hand, embodiments of this application provide a code debugging method, the method being used for running an extension plugin in a code editor, the method comprising: Get the first debugging command entered in the debugging interaction window, which is created by calling the view interface of the code editor; By calling the code editor's debugging interface, the execution result of the command is determined based on the first debugging command. The debugging interface is used to call debugging tools to debug the code. Based on the command execution results, control the display of the debugging interaction window; The extension plugin is used to perform at least one of the following functions: to enhance the first debugging command and to enhance the display of the command execution result.

[0007] On the other hand, embodiments of this application provide a code debugging apparatus, the apparatus comprising: The module is configured to retrieve the first debugging command entered in the debug interaction window, which is created by calling the view interface of the code editor. The calling module is configured to determine the command execution result based on the first debugging command by calling the code editor's debugging interface. The debugging interface is used to call debugging tools for code debugging. The control module is configured to control the display of the debugging interaction window based on the command execution results; The first debugging command is processed by the calling module's command enhancement process, or the command execution result is processed by the control module's display enhancement process, or the first debugging command is processed by the calling module's command enhancement process and the command execution result is processed by the control module's display enhancement process.

[0008] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-described code debugging method.

[0009] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the above-described code debugging method.

[0010] On the other hand, embodiments of this application provide a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor reads and executes the computer program from the computer-readable storage medium to implement the above-described code debugging method.

[0011] The technical solution provided in this application can bring the following beneficial effects: By using an extension plugin running within the code editor, the system first retrieves the initial debugging command entered by the user in the debugging interaction window, which is created by calling the code editor's view interface. Then, by calling the code editor's debugging interface, the extension plugin obtains the corresponding command execution result based on the initial command. The extension plugin can enhance the initial debugging command, effectively reducing the risk of command execution failure or exceptions, thereby improving the security and reliability of the initial debugging command execution process. The extension plugin can also enhance the display of the command execution result, making the originally monotonous text results richer and more readable, thus solving the problem of the existing debugging console's monotonous and inflexible display format, and improving the effect and readability of the command execution result display. Attached Figure Description

[0012] Figure 1 This is a flowchart illustrating a code debugging method provided in an illustrative embodiment of this application; Figure 2 This is a schematic diagram of a debugging interaction window provided in an illustrative embodiment of this application; Figure 3 This is a flowchart illustrating another illustrative embodiment of the code debugging method provided in this application; Figure 4 This is a schematic diagram of a command enhancement process provided in an illustrative embodiment of this application; Figure 5 This is a flowchart illustrating another embodiment of the code debugging method provided in this application; Figure 6 This is a schematic diagram illustrating the command execution result after enhanced processing, provided by an illustrative embodiment of this application; Figure 7 This is a schematic diagram illustrating a display enhancement process provided in an illustrative embodiment of this application; Figure 8 This is a flowchart illustrating the command completion execution process provided in an illustrative embodiment of this application; Figure 9 This is a schematic diagram illustrating the command completion recommendation results provided in an illustrative embodiment of this application; Figure 10 This is a schematic diagram illustrating the command completion process provided in an illustrative embodiment of this application; Figure 11 This is a schematic diagram showing the result of a switching display command before execution, provided in an illustrative embodiment of this application. Figure 12 This is a schematic diagram showing the result of executing a switching display command according to an illustrative embodiment of this application; Figure 13 This is a schematic diagram of the structure of a code debugging device provided in an illustrative embodiment of this application; Figure 14 This is a schematic diagram of the structure of a code debugging device provided in another illustrative embodiment of this application; Figure 15 This is a structural block diagram of a computer device provided in an illustrative embodiment of this application. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0014] Illustrative embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following illustrative embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0015] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0016] It should be understood that although the terms “first,” “second,” etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, a first parameter may also be referred to as a second parameter, and similarly, a second parameter may also be referred to as a first parameter. Depending on the context, the word “if” as used herein may be interpreted as “when…” or “in response to determination.”

[0017] It should be noted that this application may display a prompt interface, pop-up window, or output voice prompt information before collecting user, processor, computer device, and other related data, and during the process of collecting user-related data. This prompt interface, pop-up window, or voice prompt information is used to inform the user that their related data is being collected. This ensures that the application only begins executing the steps related to collecting user-related data after receiving confirmation from the user regarding the prompt interface or pop-up window; otherwise (i.e., without receiving confirmation from the user), the steps related to collecting user-related data end, meaning no user-related data is collected. In other words, all user data collected in this application is collected with the user's consent and authorization, and the collection, use, and processing of related user data must comply with the laws, regulations, and standards of relevant countries and regions.

[0018] First, the terms used in the embodiments of this application will be introduced.

[0019] Code debugging refers to a series of operations performed by developers during software and hardware development to detect, locate, and correct logical, syntax, or runtime errors in a program. These operations involve tracing, analyzing, and verifying the execution of the code. Code debugging is typically performed after code is written or when program errors occur, and it is a crucial means of ensuring software quality and improving software reliability. Specifically, code debugging includes, but is not limited to, the following operations: setting breakpoints to pause program execution, viewing and modifying variable values, stepping through code to observe program behavior, analyzing the call stack to trace function call relationships, and monitoring expressions to track changes in specific data. Through code debugging, developers can gain a deep understanding of the program's execution flow, quickly locate the root cause of problems, and thus efficiently complete error fixing and functional verification.

[0020] A code editor is a computer application used for writing, editing, and managing source code. It is one of the most basic and commonly used tools in software development. Code editors typically provide basic editing functions such as syntax highlighting, code folding, automatic indentation, and bracket matching to improve the efficiency and accuracy of code writing. Some code editors have extension interfaces and support third-party plugin integration, such as Visual Studio Code (VSCode), Eclipse, and IntelliJ IDEA. For ease of explanation, the following examples use VSCode as an example. These types of code editors not only provide basic text editing functions but also allow developers or third-party developers to create feature-rich extension plugins through open extension mechanisms. Examples include the VSCode Extension in VSCode, the Eclipse Plug-in in Eclipse, and the IntelliJ IDEA Plugin in IntelliJ IDEA. Extension plugins can interact with debugging tools by calling the Application Programming Interface (API) provided by the code editor, enabling functions such as sending debugging commands and receiving command execution results, thereby expanding the capabilities of the code editor.

[0021] Debugging tools are background programs that operate independently of the code editor and are specifically designed for code debugging. Examples include the GNU Debugger (GDB) and the Windows Debugger (WinDbg). For clarity, the following example uses GDB as an example. Debugging tools typically run via a command-line interface (CLI) and lack a separate graphical user interface. Their core function is to receive and parse debugging commands input by the developer, perform corresponding debugging operations on the target program, and return the results as text. In actual development environments, code editors usually integrate debugging tools. For example, VSCode itself does not have built-in debugging functionality; instead, it integrates external debugging tools such as GDB. Specifically, VSCode calls GDB through a debugging extension plugin, forwards user-inputted debugging commands to GDB for execution, and receives and displays the debugging results returned by GDB. This integration allows developers to use debugging functionality within the code editor without directly interacting with the command-line debugging tool.

[0022] Code debugging is a crucial part of the software development process. After code development is complete, developers need to verify the logical correctness of the code to ensure the reliability and stability of the software functionality. In related technologies, mainstream code editors typically have built-in debugging console functionality. Developers enter debugging commands in the debugging console, which sends these commands to the underlying debugging tools. Through interaction with these tools, developers can perform debugging operations such as setting breakpoints, viewing variables, and single-stepping to verify for code defects, and the debugging results are returned to the debugging console for display. However, existing code editors cannot process the received debugging commands during code debugging, and the debugging results they display are relatively monotonous.

[0023] To address the aforementioned issues, this application provides a code debugging method. By using an extension plugin running in a code editor, it first obtains the first debugging command entered by the user in the debugging interaction window, which is created by calling the code editor's view interface. Then, by calling the code editor's debugging interface, based on the first debugging command, it obtains the corresponding command execution result. The extension plugin can enhance the first debugging command, effectively reducing the risk of command execution failure or exceptions, thereby improving the security and reliability of the first debugging command execution process. The extension plugin can also enhance the display of the command execution result, making the originally monotonous text result richer and more readable, thus solving the problem of the existing debugging console's single display format and lack of flexibility, and improving the effect and readability of the command execution result display.

[0024] like Figure 1 As shown, a flowchart of a code debugging method provided in an illustrative embodiment of this application is illustrated. The method is used in a computer device, the computer device is equipped with a code editor, and the code editor is equipped with an extension plugin. The following embodiment uses the extension plugin to execute the method as an example for illustration. The method includes at least one of the following steps.

[0025] Step 110: Obtain the first debugging command entered in the debugging interaction window. The debugging interaction window is created by calling the view interface of the code editor.

[0026] The first debugging command refers to the command entered by the developer during code debugging, used to control the debugging tools to perform specific debugging operations. For example, the first debugging command could be `break main`, `print var`, `continue`, or `backtrace`. `break main` is used to set breakpoints, `print var` is used to view variable values, `continue` is used to resume program execution, and `backtrace` is used to view call stack information.

[0027] In some embodiments, the code editor has a view interface, and the extension plugin uses the code editor's view interface to create a debugging interaction window that can be used for code debugging interaction. After receiving the first debugging command entered in the debugging interaction window, the extension plugin can perform code debugging operations based on the first debugging command.

[0028] To illustrate, the VSCode code editor has a WebView API. Extensions create a debug interactive window by calling the WebView API and can receive the first debug command entered in the debug interactive window.

[0029] like Figure 2 The diagram illustrates a schematic embodiment of a debugging interaction window provided in this application. The debugging interaction window includes a debugging result display area 210 and a command input box 220. The debugging result display area 210 is used to display debugging results. These results may include, but are not limited to, a first debugging command entered by the user, or the command execution result returned by the debugging tool. The command input box 220 is used for the user to enter the first debugging command. After the user enters the first debugging command in the command input box 220, the debugging interaction window sends the first debugging command to the debugging tool for execution and displays the corresponding command execution result in the debugging result display area 210.

[0030] In some embodiments, the extension plugin listens for user input events in the debug interaction window. When it detects that the user has entered a first debug command and confirmed its execution, the extension plugin obtains the first debug command.

[0031] Step 120: By calling the debugging interface of the code editor, the execution result of the command is determined based on the first debugging command. The debugging interface is used to call the debugging tool for code debugging.

[0032] In some embodiments, the extension plugin can enhance the first debugging command, and then execute the enhanced first debugging command by calling the debugging interface of the code editor to obtain the command execution result.

[0033] The command enhancement processing can be used to process, transform, supplement, or verify the first debugging command. Through the above processing, the computer device can obtain the first debugging command after command enhancement processing. This enhanced first debugging command is more suitable for execution by the debugging interface and is more secure and better in line with debugging expectations.

[0034] For example, before the first debugging command is executed, the extension plugin is used to perform command checks and processing on the first debugging command to prevent execution errors or exceptions from occurring during the execution of the first debugging command. Then, the debugging interface is called to execute the first debugging command after command enhancement processing to obtain the command execution result.

[0035] In other embodiments, the extension plugin does not perform command enhancement processing on the first debugging command, but directly calls the code editor's debugging interface to execute the first debugging command and obtain the command execution result. This application does not impose limitations on this aspect.

[0036] In some embodiments, the extension plugin itself does not have the ability to directly execute the first debugging command, nor can it communicate directly with the underlying debugging tool. Therefore, the code editor provides a debugging interface as a communication bridge between the extension plugin and the debugging tool. The extension plugin calls this debugging interface to pass the acquired first debugging command or a command-enhanced version of the first debugging command to the code editor, which then forwards the first debugging command or the command-enhanced version of the first debugging command to the debugging tool for execution.

[0037] The debugging interface encapsulates the calling details of the underlying debugging tools, including functions such as starting the debugging tools, sending debugging commands, and receiving execution results. Extended plugins do not need to concern themselves with the specific type of debugging tool or its communication protocol; they only need to call the interface according to its specifications to execute the first debugging command.

[0038] As an illustration, the VSCode code editor provides a Debug Extension API, which is a specific implementation of the code editor's debugging interface. Extension plugins can invoke the debugging interface by calling the corresponding methods in this Debug Extension API. Extension plugins communicate with the underlying debugging tools through the Debug Adapter Protocol (DAP): they encapsulate the first debugging command or a command-enhanced first debugging command into a message conforming to the DAP protocol and pass the message to the debugging tool through the sending interface provided by the Debug Extension API; after the debugging tool executes the command, it returns the command execution result to the extension plugin through the same path.

[0039] In some embodiments, after the extended plugin calls the debugging interface to execute the first debugging command, the command execution result returned by the debugging tool includes the standard output, standard error output, debugging status information, variable values, breakpoint information, call stack information, etc. This application embodiment does not limit the specific content or quantity of the command execution result. In implementation, the command execution result can be the execution result of the original first debugging command or the execution result of the enhanced first debugging command.

[0040] In this illustration, the code editor is Eclipse. The DebugPlatform Extension Point provided by Eclipse is a specific implementation of the debugging interface of the code editor. The extension plugin invokes the debugging interface by calling the startup method in this extension point to establish communication with the underlying debugging tool. Subsequently, the extension plugin encapsulates the first debugging command, or a command enhanced version of the first debugging command, into a format recognizable by the debugging tool and sends it to the debugging tool through the debugging interface. After executing the command, the debugging tool returns the command execution result to the extension plugin through the same path; for example, the standard output returned is "Hello, world", and the current variable value is x=42.

[0041] Step 130: Based on the command execution results, control the debugging interaction window for display.

[0042] In some embodiments, after the extension plugin obtains the command execution result, it controls the debugging interaction window to display the command execution result.

[0043] In other embodiments, after obtaining the command execution result, the extension plugin does not directly control the debugging interaction window to display the command execution result. Instead, it performs display enhancement processing on the command execution result to improve the display effect and readability, and then controls the debugging interaction window to display the enhanced command execution result. This application does not impose limitations on this aspect.

[0044] Among them, the display enhancement processing is used to parse, format, filter, and visually enhance the raw command execution results returned by the debugging interface, so as to provide a clearer and more readable display effect in the debugging interaction window.

[0045] As an illustration, the extension plugin receives the command execution results returned by the debugging interface, which are presented in JSON format. However, the debugging interactive window only supports displaying HyperText Markup Language (HTML) format files. The extension plugin enhances the display of the command execution results by parsing the JSON format into an HTML file format supported by the debugging interactive window, making it suitable for display and improving the readability of the command execution results.

[0046] After enhancing the display of command execution results, the extension plugin controls the debugging interaction window to display the processed results. For example... Figure 2As shown, the debugging result display area 210 in the debugging interaction window is used to present the command execution results. Users can view the execution status of debugging commands through the debugging result display area 210, including whether the command was executed successfully, the returned variable values, the hit breakpoint locations, the current call stack information, etc. The command input box 220 is used to receive the first debugging command input by the user, and the extension plugin performs subsequent processing based on the received first debugging command.

[0047] In some embodiments, the extension plugin is used to perform at least one of the following functions: to enhance the first debugging command and to enhance the display of the command execution result.

[0048] This is illustrative; the extension plugin may be used only to enhance the command of the first debugging command, or only to enhance the display of the command execution result, or it may be used to enhance both the command of the first debugging command and the display of the command execution result. This application does not impose any limitations on these aspects.

[0049] Therefore, the result of the command execution can be obtained from the first debug command after the command enhancement process, and / or, the result of the command execution after the enhancement process is displayed in the debug interaction window.

[0050] In summary, by using an extension plugin running within the code editor, the system first obtains the initial debugging command entered by the user in the debugging interaction window, which is created by calling the code editor's view interface. Then, by calling the code editor's debugging interface, the extension plugin obtains the corresponding command execution result based on the initial debugging command. The extension plugin can enhance the initial debugging command, effectively reducing the risk of command execution failure or exceptions, thereby improving the security and reliability of the initial debugging command execution process. The extension plugin can also enhance the display of the command execution result, making the originally monotonous text results richer and more readable, thus solving the problem of the existing debugging console's monotonous and inflexible display format, and improving the effect and readability of the command execution result display.

[0051] In some embodiments, when the extension plugin detects a debug session creation instruction in the code editor, it calls the code editor's view interface to create a debug interaction window.

[0052] As an illustration, when the code editor starts the debugging function, it generates a debugging session creation command. This command is used to notify various extension components that a debugging session is about to begin. Extension plugins have pre-registered listeners for this command. When the command is detected, the extension plugin knows that a debugging session has been triggered, and then executes the process of creating the debugging interaction window, calling the code editor's view interface to create the debugging interaction window.

[0053] In some embodiments, the debugging session creation command is triggered by either user-initiated triggering or automatic triggering by the extension plugin. For example, a user clicks the "Start Debugging" button or presses a debugging shortcut key to generate the debugging session creation command. Another example is when the extension plugin detects that the code has reached a specific breakpoint or receives a specific event from the debugging interface, it automatically generates the debugging session creation command. This application does not limit the specific triggering method for the debugging session creation command.

[0054] By calling the code editor's view interface to create a debugging interaction window when a debugging session creation command is detected in the code editor, the debugging interaction window and the debugging session can be automatically associated and created without the user having to manually open or configure the debugging interaction interface. This simplifies the initialization process of the debugging environment and significantly improves the automation and ease of operation of the debugging process.

[0055] In some embodiments, the extension plugin needs to enhance the first debugging command. For example... Figure 3 As shown, a flowchart of a code debugging method provided in another illustrative embodiment of this application is illustrated. The method is used in a computer device, which has a code editor installed and an extension plugin installed in the code editor. The following embodiment uses the extension plugin to execute the method as an example. The above step 120 can also be implemented as the following steps 121, 122 and 123.

[0056] Step 121: Perform a command check on the first debugging command.

[0057] Since the first debugging command entered by the user in the debugging interaction window may have the risk of execution error or be unsuitable for the debugging interface, in order to avoid exceptions during the execution of the first debugging command, the extension plugin needs to perform a command check on the first debugging command before calling the code editor's debugging interface to execute the first debugging command, and perform command enhancement processing on the first debugging command based on the check results, so as to improve the security and reliability of the first debugging command execution process.

[0058] In some embodiments, before executing the first debugging command by calling the code editor's debugging interface, the extension plugin performs a command check on the first debugging command to determine whether the first debugging command has a risk of execution error or is unsuitable for execution by the debugging interface. If the command check result indicates that the first debugging command has a risk of execution error or is unsuitable for execution by the debugging interface, the extension plugin performs corresponding processing measures on the first debugging command; if the command check result indicates that the first debugging command does not have a risk of execution error or is suitable for execution by the debugging interface, the extension plugin directly sends the first debugging command to the debugging interface for execution.

[0059] In some embodiments, the extension plugin predefines one or more command checking methods for the first debugging command. Each command checking method corresponds to a command characteristic of a debugging command that has the risk of execution error or is unsuitable for execution by the debugging interface. The extension plugin determines whether the first debugging command has the risk of execution error or is unsuitable for execution by the debugging interface by matching the obtained first debugging command with the preset security checking methods.

[0060] As an illustration, the extended plugin predefined command check is used to check whether the first debug command is a debug command that may cause the debug session to block due to excessive execution time, such as reading device files or executing debug commands that may produce infinite output; or to check whether the first debug command is a debug command that is unsuitable for execution by the debug interface, such as the break command for setting breakpoints, where the user only enters break without specifying the breakpoint location, the user's intention is unclear, and the debug interface cannot execute it directly. It is worth noting that the above command check is only an illustrative example, and the embodiments of this application do not limit the content of the command check.

[0061] In some embodiments, the extension plugin performs command checks on the first debugging command through command parsing.

[0062] Specifically, the extension plugin performs lexical and syntactic analysis on the first debugging command to extract information such as the command name, parameter options, and target file path from the first debugging command, and performs command checks on the extracted information according to a preset command checking method.

[0063] For illustration, when the extracted command name is cat and the target file path starts with / proc / or / dev / , the command check result indicates that the debugging command is a debugging command with a risk of execution error; when the extracted command name is break and no parameters are specified, the command check result indicates that the debugging command is a debugging command that is not suitable for execution by the debugging interface.

[0064] The specific method of command checking is not limited in the embodiments of this application.

[0065] Step 122: Based on the processing measures corresponding to the command inspection results, perform command enhancement processing on the first debugging command to obtain the first debugging command after command enhancement processing.

[0066] When the command check indicates that the first debugging command is at risk of execution error or is unsuitable for execution via the debugging interface, directly calling the code editor's debugging interface to execute the first debugging command may result in exceptions or errors due to unsuitability for the debugging interface. Therefore, the extension plugin needs to perform command enhancement processing on the first debugging command before execution.

[0067] In some embodiments, the extension plugin predefines processing measures for the inspection results of various command checks. When the inspection result indicates that the first debugging command has a risk of execution error or is not suitable for execution by the debugging interface, the extension plugin performs command enhancement processing on the first debugging command based on the processing measures corresponding to the inspection result, resulting in the first debugging command after command enhancement processing.

[0068] For example, when the extension plugin predefines multiple command checks, it also configures corresponding handling measures for each check result. For instance, for the first debug command that may cause the debug session to block due to excessive execution time, the corresponding handling measure is to add timeout protection to prevent the first debug command from taking too long to execute; for the first debug command that outputs abnormal format after reading a special file system, the corresponding handling measure is character replacement.

[0069] In some embodiments, the check result includes any one of the following: the first debugging command belongs to a first type of debugging command, the first debugging command belongs to a second type of debugging command, and the first debugging command belongs to a third type of debugging command. The processing measures include at least one of adding a character replacement command, adding special characters, and adding timeout information. If the extension plugin finds that the first debugging command belongs to a first type of debugging command, it adds timeout information to the first debugging command, resulting in a first debugging command with enhanced command processing. The first type of debugging command is a system command and does not belong to the file operation category. The timeout information is used to automatically stop the execution of the first debugging command when it times out.

[0070] System commands are those used to interact with the operating system. Because system command execution failures pose a high risk, they require command enhancement. File operation commands are used to view, create, merge, and append files. Since file operations may cause output to overlap with subsequent command prompts if the file content does not end with a newline character, command enhancement is also necessary.

[0071] As an example, some system commands (such as ping, sleep, or commands containing infinite loops) take too long to execute, causing the debugging session to wait for an extended period and become unresponsive to subsequent operations. This prevents the debugging tool from returning execution results correctly, so timeout protection needs to be added to them. Some file operation commands do not end with a newline character, causing the output of the file operation command to be directly pasted into the subsequent command prompt. Newline processing is required to remove this newline character.

[0072] In some embodiments, if the first debugging command is a system command and not a file operation command, the extension plugin adds timeout information to the first debugging command.

[0073] The timeout information is used to automatically stop the execution of the first debug command when it times out. For example, the extension plugin adds `timeout 10` before the first debug command; `timeout 10` is the timeout information. If the execution time of the first debug command exceeds 10 seconds, the execution of the first debug command will be automatically terminated to prevent the debug session from being occupied or frozen for an extended period.

[0074] It is worth noting that the specific implementation of the timeout information described above is merely an illustrative example, and the embodiments of this application do not limit it.

[0075] In some embodiments, when the first debugging command belongs to the second type of debugging command, the extension plugin adds special characters and timeout information to the first debugging command to obtain the first debugging command after command enhancement. The second type of debugging command is a system command, belongs to the file operation command, and the operation object is a non-preset file. The special characters are used to control the line break of the command execution result of the first debugging command. A preset file refers to a file whose content contains special character formats. For example, a process information file may use null characters as separators between different data items. Directly reading a preset file can lead to display anomalies such as data items being concatenated, requiring character replacement processing.

[0076] As an illustration, the content read from the process information file is "Python3app.py --port8080", with no spaces between data items, making it inconvenient for users to observe.

[0077] In some embodiments, when the first debugging command belongs to the second type of debugging command, the extension plugin first adds a special character to control the newline after the first debugging command is executed, so that subsequent debugging prompts or output content are displayed from a newline. Secondly, the extension plugin adds timeout information to automatically terminate the execution of the command when the execution time exceeds a preset time threshold, avoiding long waits caused by operating on large or abnormal files.

[0078] For example, for the first debugging command `cat / etc / passwd`, the extension plugin first processes it as `cat / etc / passwd; echo`. The `echo` character is used to output a newline character after command execution, controlling the line break of the command execution result. Furthermore, the extension plugin adds timeout information, processing the first debugging command as `timeout 10 cat / etc / passwd; echo`, limiting the execution time of the first debugging command to no more than 10 seconds.

[0079] It is worth noting that the specific implementation methods of controlling line breaks and timeout protection described above are merely exemplary examples, and the embodiments of this application do not limit them.

[0080] In some embodiments, when the first debugging command belongs to the third type of debugging command, the extension plugin adds a character replacement command, special characters, and timeout information to the first debugging command to obtain the first debugging command after command enhancement processing. The third type of debugging command is a system command, belongs to the file operation command category, and the operation object is a preset file. The character replacement command is used to control the replacement of characters in the command execution result of the first debugging command that do not meet the preset format requirements.

[0081] When the extension plugin calls the code editor's debugging interface to execute the third type of debugging commands, several issues arise. First, because the default file uses null characters as separators between different data items instead of spaces, direct reading can cause multiple data items to be concatenated, making it difficult for the user to distinguish individual parameters or variables. Second, similar to executing the second type of debugging commands, after processing files using file operation commands, the output does not end with a newline character, causing the output content to be directly concatenated with the subsequent command prompt, affecting the display. Furthermore, some file operation commands may operate on large files or have delays in the reading process, also posing a risk of blocking the debugging session. Therefore, the extension plugin needs to add character replacement commands, special characters, and timeout information for these types of debugging commands.

[0082] In some embodiments, when the first debugging command belongs to the third type of debugging command, the extension plugin first adds a character replacement command to the first debugging command to replace characters in the output that do not meet the preset format requirements with preset characters, thus separating the originally contiguous data items and presenting them in a more readable format. Secondly, the extension plugin adds special characters to ensure that a newline character is output after the command execution, so that subsequent debugging prompts or output content start from a newline. Finally, the extension plugin adds timeout information to automatically terminate the execution of the first debugging command if its execution time exceeds a preset time threshold.

[0083] For example, for the first debugging command `cat / proc / 12345 / cmdline`, the extension plugin first passes the output to the character substitution command via a pipe ("|", used to pass the standard output of the command on the left as the standard input of the command on the right), processing the first debugging command as `cat / proc / 12345 / cmdline | tr '\0' ' '`, replacing empty characters in the output with spaces, making the originally concatenated command line parameters (such as `Python3app.py --port8080`) into a space-separated readable form (such as `Python3 app.py --port 8080`); then a newline character is added, processing the first debugging command as `cat / proc / 12345 / cmdline | tr '\0' ' '; echo`, ensuring that the output ends with a newline character; finally, a timeout protection command is added, processing the first debugging command as `timeout 10 cat / proc / 12345 / cmdline | tr '\0' ''; echo`, limiting the command execution time to no more than 10 seconds. It is worth noting that the above-mentioned character replacement commands, timeout information, and special characters are merely illustrative examples, and the embodiments of this application do not impose any limitations on them.

[0084] In other embodiments, the extension plugin is also used to perform permission verification on the first debugging command, detect whether the first debugging command attempts to access restricted resources, and if insufficient permissions are found, intercept it in advance and prompt the user to avoid execution failure.

[0085] In other embodiments, the extension plugin is also used to perform loop detection processing on the first debug command, identify command structures that may cause infinite loops or excessive iterations, and automatically attach an iteration limit or a forced exit condition.

[0086] It is worth noting that the embodiments of this application do not limit the specific scenarios that require command enhancement processing, or the specific methods of command enhancement processing.

[0087] When the command check result indicates that the first debugging command belongs to the preset type of debugging command, the extension plugin adopts a differentiated processing strategy to enhance the first debugging command, which can effectively ensure the security and reliability of the first debugging command during execution, thereby significantly improving the overall security and reliability of the code debugging process.

[0088] Step 123: Execute the first debug command after command enhancement processing by calling the code editor's debugging interface, and obtain the command execution result.

[0089] After the command enhancement process is completed, the extension plugin obtains the first debug command after the command enhancement process. By calling the debugging interface of the code editor, it executes the first debug command after the command enhancement process, and its execution process is more stable and reliable.

[0090] After receiving the first debug command after command enhancement processing, the extension plugin passes the first debug command after command enhancement processing to the code editor by calling the debug interface. The code editor then forwards the first debug command after command enhancement processing to the debug tool for execution.

[0091] As an illustration, the extension plugin communicates with the debugging tool through the debug adapter protocol. The extension plugin encapsulates the first debug command after command enhancement processing into a message conforming to the debug adapter protocol and sends it to the debugging tool through the debug interface. After the debugging tool executes the command, it returns the command execution result to the extension plugin through the debug interface.

[0092] In other embodiments, if the command check result indicates that the first debugging command does not belong to the first type of debugging command, the second type of debugging command, or the third type of debugging command, it indicates that the first debugging command will not cause problems such as abnormal output format, execution blocking, or session freezing during execution, and is suitable for debugging interface execution. Therefore, the extension plugin does not need to perform command enhancement processing on the first debugging command and can directly send the first debugging command to the debugging tool for execution.

[0093] In some embodiments, if the first debugging command is not a system command, the extension plugin executes the first debugging command by calling the code editor's debugging interface and obtains the command execution result.

[0094] Among these, the first debugging command, which is not a system command, is usually a built-in debugging command of the debugging tool. These commands are directly parsed and executed by the debugging tool itself, without interacting with the operating system or executing external processes. Therefore, these commands do not pose a risk of session blocking due to excessive execution time, nor do they involve output format errors caused by reading the file system. Extension plugins can directly call the debugging interface to execute these debugging commands without requiring additional security measures.

[0095] For example, when a user enters "print counter," this command is a built-in variable printing command in the debugging tool and is not a system command. After the extension plugin recognizes that this command is not a system command, it directly calls the debugging interface to execute the command without requiring command enhancement.

[0096] It is worth noting that the embodiments of this application do not impose specific limitations on specific scenarios where command enhancement processing is not required.

[0097] By extending the plugin, when the command check result indicates that the first debugging command belongs to the preset type of debugging command, the first debugging command is enhanced. This effectively reduces the possibility of the first debugging command causing execution errors, blocking or exceptions during execution, and improves the execution efficiency of the first debugging command while ensuring the safety and reliability of the debugging process.

[0098] like Figure 4 The diagram illustrates a command enhancement process provided in an illustrative embodiment of this application, which includes at least one of the following steps.

[0099] Step 401: Obtain user commands.

[0100] In some embodiments, the extension plugin receives user commands entered by the user in the debugging interaction window of the code editor. The user commands are the first debugging commands described in the above embodiments, and the first debugging commands can be any type of debugging commands.

[0101] Step 402: Determine if it is a shell command. If yes, proceed to step 404; otherwise, proceed to step 403.

[0102] In some embodiments, users interact with the operating system using shell commands in the code editor; these shell commands are system commands. Because some shell commands take too long to execute, causing debugging sessions to wait for extended periods and become unresponsive to subsequent operations, the extension plugin needs to perform type identification on the first obtained debugging command, determining whether the command belongs to the Shell command category, and then performing command enhancement processing.

[0103] Step 403: Return directly to the original command.

[0104] In some embodiments, when the extension plugin recognizes that the first debugging command is not a shell command, the command does not need to be enhanced and the original command is returned directly.

[0105] Step 404: Extract the shell command portion.

[0106] In some embodiments, when the extension plugin recognizes that the first debugging command belongs to a shell command, it extracts the core shell command portion from the complete command string entered by the user, and removes any irrelevant parameters or formatting modifiers for subsequent processing.

[0107] Step 405: Detect potentially dangerous command patterns.

[0108] In some embodiments, the extension plugin predefines dangerous command patterns, and shell commands matching these patterns require command enhancement. The extension plugin determines whether a command needs enhancement by matching the extracted shell command against a predefined library of dangerous command patterns. Specifically, this includes identifying whether the command belongs to the file operation category and whether the object of the command is a preset file (such as / proc / ). / cmdline).

[0109] Step 406: Determine if it is a cat command. If yes, proceed to step 408; otherwise, proceed to step 407.

[0110] In some embodiments, the `cat` command is a file operation command. Since some files do not end with a newline character, the output of the `cat` command is directly concatenated with the subsequent command prompt, resulting in a cluttered display and affecting user readability. The extension plugin needs to enhance the `cat` command by determining whether the currently extracted shell command is indeed the `cat` command.

[0111] Step 407: Add timeout protection.

[0112] In some embodiments, when the first debugging command needs to add timeout protection, the extension plugin adds a timeout protection command, such as timeout information, to the user command, limiting the execution time of the user command to a preset time threshold, and automatically stopping execution to prevent the debugging session from being blocked due to excessive execution time.

[0113] Step 408, determine if it is / proc / If / cmdline is used, proceed to step 410; otherwise, proceed to step 409.

[0114] In some embodiments, the default file set by the extension plugin is the process information file, while / proc / Files located at the ` / cmdline` address are mostly process information files. These files use null characters as separators between different data items instead of spaces. Direct reading of these files would cause multiple data items to be concatenated, making it impossible for users to distinguish individual parameters or variables. Extension plugins need to check if the command parameters of the debugging command are " / proc / ". The " / cmdline" command is used to determine whether the user command is targeting a process information file.

[0115] Step 409: Add a newline character.

[0116] In some embodiments, when a newline character is required, the extension plugin adds a newline character to the user command to ensure that a newline character is output after the command is executed, so that the subsequent debug prompt or output content is displayed from a newline.

[0117] Step 410: Process the null character and add a newline character.

[0118] In some embodiments, when it is necessary to handle null characters and add newline characters, the extension plugin first adds a null character replacement command to the user command. This command replaces null characters in the output with a preset delimiter, separating the originally concatenated data items and presenting them in a more readable format. Secondly, the extension plugin adds a newline character to ensure that a newline character is output after the command is executed, so that subsequent debug prompts or output content begin displaying on a newline.

[0119] Step 411: Record the command modification.

[0120] In some embodiments, after adding or modifying user commands, the extension plugin records all the modifications made to the user commands, including the modification type, added security measures, and the correspondence between the original user commands and the user commands modified through command enhancement processing. This record can be used for debug log output, user auditing, or subsequent error tracing.

[0121] Step 412: Return the user command after command enhancement processing.

[0122] In some embodiments, the extension plugin uses the recorded modified user command as the enhanced user command, corresponding to the first debug command after command enhancement as described in the above embodiments, and prepares to send it to the debug interface for execution.

[0123] Step 413: Send a command to the debug interface.

[0124] In some embodiments, the extension plugin sends the finalized, enhanced first debug command to the debug interface for execution and waits to obtain the command execution result.

[0125] In summary, the extension plugin, through user command type recognition, dangerous command pattern matching, and differentiated command enhancement measures, achieves timeout protection for shell commands, addition of newline characters for the cat command, and handling of empty characters in the process information file. This effectively avoids debugging session blocking caused by excessively long command execution time, display chaos caused by output format issues, and content concatenation caused by the special format of the process information file, thereby significantly improving the security, reliability, and readability of the first debugging command execution.

[0126] In some embodiments, the extension plugin needs to enhance the display of command execution results. For example... Figure 5 As shown, a flowchart of a code debugging method provided in another illustrative embodiment of this application is illustrated. The method is used in a computer device, the computer device is equipped with a code editor, and the code editor is equipped with an extension plugin. In the following embodiment, the method is described using the extension plugin as an example. The above step 130 can also be implemented as the following steps 131, 132 and 133.

[0127] Step 131: Perform display enhancement processing on the enhanced content in the command execution result to obtain the command execution result after display enhancement processing.

[0128] Because the raw command execution results returned by the debugging tool are directly displayed in the debugging interaction window, users cannot intuitively obtain the key information in the debugging information, and the display format is monotonous and lacks readability. In order to improve the information richness of the debugging results display and the user interaction experience, the extension plugin needs to enhance the display of command execution results and display them based on the enhanced command execution results.

[0129] In some embodiments, the extension plugin parses the command execution result, identifies content requiring display enhancement, performs the corresponding display enhancement processing on that content, and obtains the command execution result with enhanced display. Based on the command execution result with enhanced display, the extension plugin controls the debugging interaction window to display the debugging results.

[0130] In some embodiments, the enhanced content includes at least one of color codes and debug marker link elements. When the extension plugin performs display enhancement processing on the enhanced content in the command execution result, it converts the color codes in the command execution result based on the color display style of the display file to obtain the command execution result after display enhancement processing.

[0131] The display file is the format file that the debugging interaction window relies on when displaying content. When displaying debugging results, the extension plugin needs to control the rendering and presentation of the debugging interaction window based on the format specifications of the display file. For example, when the debugging interaction window displays debugging results in a webpage view, the extension plugin needs to convert the command execution results into HTML format, and the corresponding display file is an HTML file; when the debugging interaction window uses other rich text display methods, the display file is the rich text format file corresponding to that display method. This application does not limit the specific type of the display file.

[0132] In some embodiments, the display file includes color display style definitions that indicate the color rules used by the debug interaction window when displaying different content. Based on the color display styles in the display file, the extension plugin converts the color codes in the command execution results into style identifiers or style instructions that conform to the display file format specifications, ensuring that the converted content can be correctly parsed and rendered in the debug interaction window.

[0133] For example, when the command execution result returned by the debugging tool contains American National Standards Institute (ANSI) color codes (such as "\x1b[32m" for green, "\x1b[31m" for red, etc.), the extension plugin parses these ANSI color codes and converts them into the corresponding HTML styles (such as "style=color: green") according to the color display styles defined in the display file (such as an HTML file).

[0134] In some embodiments, the command execution results returned by the debugging tool do not include ANSI color codes. In this case, the extension plugin proactively adds the corresponding ANSI color codes to the debugged content based on the type of debugged content in the command execution results.

[0135] For example, the extension plugin can identify different types of information in the command execution results, such as error messages, warning messages, and normal output messages, and add ANSI color codes to error messages (e.g., "\x1b[31m"), warning messages (e.g., "\x1b[33m"), and normal output messages (e.g., "\x1b[32m")) to them.

[0136] In other embodiments, when the extension plugin performs display enhancement processing on the enhanced content in the command execution result, it transforms the debug marker link element in the command execution result based on the interactive element display style of the display file to obtain the command execution result after display enhancement processing. The debug marker link element is used to mark the link content in the command execution result, and the command execution result after display enhancement processing includes interactive links.

[0137] Among them, the debug markup link element is a special format link element embedded in the debug results to carry the link content. Illustratively, Debug Markup Language (DML) links are typically encoded using a preset format specification, such as the Operating System Command 8 (OSC 8) hyperlink protocol format. In the original text, it appears as a combination of special characters containing escape sequences (such as "\x1b]8;;URL\x1b\\TEXT\x1b]8;;\x1b\\"). If displayed directly, users cannot recognize its link attributes or perform interactive operations.

[0138] The display style of interactive elements refers to the formatting specifications defined in the display file used to implement interactive interface elements. For example, when the debugging interactive window displays debugging results in a web page view, the display style of interactive elements is the hyperlink tag in HTML (such as...). The plugin defines the tag and its related styles. Based on the display style of this interactive element, it converts the debug tag link element into an interactive element that conforms to the display file format specification, so that the converted link can be correctly rendered in the debug interactive window and support user interaction.

[0139] In some embodiments, the extension plugin parses the command execution results and identifies content that conforms to the format specifications of debug tag link elements. Subsequently, based on the interactive element display style of the displayed file, the extension plugin encapsulates the extracted information into interactive elements (such as HTML tags). The interactive element (label) is linked to a command message within the link, and its click event is associated with that message. After this transformation, the debug marker links, originally plain text, are converted into clickable interactive elements.

[0140] For example, when the command execution result returned by the debugging tool contains the DML link "https: / / example.com / doc / 123\\View document details\\", the extension plugin parses the link, extracts the Uniform Resource Locator (URL) information https: / / example.com / doc / 123 and the display text "View document details". Subsequently, the extension plugin converts it to an interactive element display style based on HTML format. View document details A hyperlink element in the form of a URL. When a user clicks this link, the extension can either open the URL in a browser or retrieve the link content and display it in the debug interaction window.

[0141] It is worth noting that the above-described method of converting DML links to HTML hyperlinks is merely illustrative. This application does not limit the format type of the debug tag link element or the specific form of the interactive element display style.

[0142] In other embodiments, the extension plugin is also used to perform type-aware highlighting of variable values ​​in the command execution result, assigning different colors or icon styles according to different data types such as numbers, strings, booleans, and variables, to obtain a command execution result with enhanced display.

[0143] In other embodiments, the extension plugin is also used to align and draw borders on the tabular data in the command execution results, converting tabs or spaces in the original text into a grid view with equal-width columns, thus obtaining the command execution results with enhanced display.

[0144] This application does not limit the specific method by which the extension plugin is used to enhance display.

[0145] The extension plugin enhances the display of command execution results by using color display styles and interactive element display styles based on the display file. This allows the extension plugin to adopt differentiated display enhancement strategies for different types of enhanced content in the command execution results, thereby improving the readability and information differentiation of the displayed command execution results and enhancing the visualization and interactivity of the command execution results displayed in the debugging interactive window.

[0146] In some embodiments, the display of the enhanced command execution result includes an interactive link, which contains a second debugging command. To prevent execution exceptions or errors during the execution of the second debugging command, the extension plugin needs to perform command checks and command enhancement processing on the second debugging command in the interactive link to ensure the security and reliability of the second debugging command execution process.

[0147] In other embodiments, the execution result of the enhanced command does not contain interactive links, and this application does not limit this.

[0148] In some embodiments, if the interactive link contains a second debugging command, the extension plugin performs a command check on the second debugging command in the interactive link.

[0149] The method of performing command checking on the second debugging command in the interactive link in this embodiment is the same as the method of performing command checking on the first debugging command in the above embodiment. This embodiment will not repeat the details here.

[0150] In some embodiments, the extension plugin performs command enhancement processing on the second debugging command in the interactive link based on the processing measures corresponding to the inspection results of the command inspection.

[0151] The method of command enhancement processing for the second debugging command in this embodiment is the same as the method of command enhancement processing for the first debugging command in the above embodiment, and will not be repeated here.

[0152] By performing command checks and command enhancement processing on the interactive links containing second debugging commands, differentiated command enhancement processing strategies can be adaptively adopted for different preset types of second debugging commands, thereby ensuring the security and reliability of the second debugging commands in the interactive links.

[0153] Step 132: Generate a display file for the debugging interaction window based on the command execution results after display enhancement processing.

[0154] After the extension plugin completes the display enhancement processing of the command execution results, the enhanced command execution results are obtained. For illustration, the enhanced command execution results include converted color style identifiers (such as color styles in HTML) and interactive elements (such as clickable DML links), but this content does not yet have a complete display format and cannot be directly parsed and rendered by the debug interactive window. Therefore, the extension plugin needs to generate the display file that the debug interactive window depends on based on the enhanced command execution results.

[0155] In some embodiments, the display file is a formatted file used by the debugging interactive window to display content. The file format of the display file is associated with the implementation of the debugging interactive window. The extension plugin generates the display file according to the file format of the display file based on the command execution result with enhanced display.

[0156] As an illustration, when the debug interactive window is implemented using a web page view, the displayed file is an HTML file. The extension plugin will display the enhanced text content, color style indicators, and interactive elements from the command execution results, assembling them according to HTML format specifications to generate a complete HTML file. This HTML file contains rich text content such as converted colored text and clickable links, which can be correctly parsed and rendered by the debug interactive window.

[0157] In other embodiments, the extension plugin can also enhance the display of command execution results by adding layout information or visual enhancement effects to the command execution results, so as to control the display effect of the command execution results in the debugging interaction window.

[0158] For example, the extension plugin can embed a line number display function in the display file to add line number identifiers to the displayed command execution results, making it easy for users to quickly locate and reference specific output lines; or, it can embed a theme switching function in the display file, allowing users to choose a light or dark theme to view the debugging results according to their personal preferences or ambient lighting.

[0159] It is worth noting that the specific method of enhancing the display of command execution results is not limited in the embodiments of this application.

[0160] In some embodiments, the display files generated by the extension plugin must conform to preset format specifications. To ensure the format compliance of the display files, the extension plugin formats the command execution results after display enhancement before generating the display files.

[0161] For example, the formatting processing performed by the extension plugin on the command execution results after display enhancement includes at least one of the following: formatting the command execution results with spaces and line breaks, processing leading spaces and indentation, merging multiple consecutive spaces, processing tabs, and deleting trailing spaces. This application embodiment does not limit the specific method of formatting processing.

[0162] Step 133: Control the debugging interactive window to display the file.

[0163] After the extension plugin generates the display file, it needs to be loaded into the debugging interaction window to visualize the debugging results.

[0164] In some embodiments, the extension plugin passes the generated display file to the debugging interaction window, which parses the display file and renders the debugging results to the user according to the format definition and content organization in the file.

[0165] In some embodiments, the debug interactive window loads a display file through the code editor's view interface. The extension plugin calls the loading method provided by the view interface, passing the path or content data of the display file to the debug interactive window. Upon receiving the display file, the debug interactive window parses and renders it, displaying the debug results, including colored text and clickable links, in the debug results display area.

[0166] For example, when the displayed file is an HTML file, the debug interaction window, as an embedded browser component, loads and renders the HTML file. In the rendered interface, the original ANSI color codes are converted into corresponding colored text displays, and the original DML links are converted into clickable hyperlink elements. Users can view debug information in different colors in the debug interaction window and click links to execute corresponding second debug commands.

[0167] like Figure 6 As shown, this illustration depicts a schematic embodiment of the present application demonstrating the enhanced command execution results. The command execution result 610 displayed in the debug result display area includes breakpoint trigger location information. This command execution result 610 is displayed in gray font to distinguish it from other normal output content, facilitating quick user identification of the breakpoint trigger location. Furthermore, the command execution result 620 displayed in the debug result display area includes an interactive DML link. This command execution result 620 is displayed in gray font, and the DML link is a clickable interactive element. When the user clicks the DML link, the associated second debug command (e.g., jumping to line 5 of the main.cpp file, or printing the value of a specified variable) will be automatically executed, thereby improving the convenience of debugging operations.

[0168] In some embodiments, when the extension plugin controls the display of the debugging interaction window, it can also perform auxiliary processing such as scrolling positioning, automatic refresh, or pagination display of the displayed content to improve the user's viewing experience.

[0169] As an illustration, when new debugging results are generated, the extension plugin controls the debugging interaction window to automatically scroll to the latest content, ensuring that the user can see the latest debugging information in a timely manner. This application embodiment does not limit the specific method of displaying debugging results.

[0170] By enhancing the display of command execution results through extension plugins, and displaying the command execution results based on the enhanced results, debugging content that might otherwise contain special formats such as color codes and links can be correctly presented in a visual and interactive form in the debugging interaction window. This significantly improves the readability, information differentiation, and user experience of command execution results, enhances the extension plugin's ability to process command execution results, and improves the overall display effect of code debugging.

[0171] like Figure 7 The diagram illustrates a display enhancement process provided in an illustrative embodiment of this application, which includes at least one of the following steps.

[0172] Step 701: Receive the raw debug output.

[0173] In some embodiments, the extension plugin receives the raw debug output returned by the debug interface. This raw debug output is the command execution result described in the above embodiments, which may contain various types of content such as text, error messages, ANSI escape sequences, and DML links. It needs to be enhanced in terms of display to improve the presentation of the raw debug output.

[0174] Step 702: Use the ANSI color analyzer.

[0175] In some embodiments, the extension plugin calls the ANSI color parser to identify and parse the ANSI escape sequences in the original debug output so that they can be converted into a format supported by the debug interactive window. The ANSI escape sequences are the color codes described in the above embodiments.

[0176] Step 703: Convert ANSI escape sequences to HTML styles.

[0177] In some embodiments, the extension plugin converts the parsed ANSI escape sequences into HTML styles. For example, "\x1b[32m" representing green is converted to "style=color: green" or the corresponding CSS class name, thus enabling colored text display in the debug interactive window.

[0178] Step 704: Detect DML links.

[0179] In some embodiments, the extension plugin detects the command execution results to identify whether there is content that conforms to the DML link format specification. The DML link is the interactive link described in the above embodiments, such as a link format containing OSC 8 escape sequences, but it is not interactive. The extension plugin needs to convert it into a style that can be correctly rendered in the debug interactive window and support user interaction.

[0180] Step 705: Determine if a DML link is found. If yes, proceed to step 707; otherwise, proceed to step 706.

[0181] In some embodiments, the extension plugin determines whether DML links are found in the command execution result, thereby determining whether display enhancement processing of DML links is required.

[0182] Step 706: Save the original text.

[0183] In some embodiments, when no DML links are detected, the extension plugin preserves the original text content without requiring the conversion of it into interactive elements.

[0184] Step 707: Convert the DML link into a clickable element.

[0185] In some embodiments, when a DML link is detected, the extension plugin converts the extracted DML link information into clickable elements, such as converting the DML link into HTML elements. Label.

[0186] Step 708: Add tooltips and click events.

[0187] In some embodiments, the extension plugin adds tooltips and click events to the transformed clickable elements, enabling users to view link hints when hovering and trigger corresponding command execution or URL redirection when clicking.

[0188] Step 709: Format spaces and line breaks.

[0189] In some embodiments, the extension plugin formats spaces and newlines in the command execution results to ensure that the output has a good layout in the debugging interaction window.

[0190] Step 710: Process the leading spaces and indentation.

[0191] In some embodiments, the extension plugin processes leading whitespace indentation, preserving or transforming the indentation format in the original output, making the hierarchical structure of the code or command output clearly discernible.

[0192] Step 711: Process multiple consecutive spaces.

[0193] In some embodiments, the extension plugin processes multiple consecutive spaces, merging them appropriately or converting them to formats such as non-breaking spaces in HTML to avoid display anomalies caused by consecutive spaces.

[0194] Step 712, process tabs.

[0195] In some embodiments, the extension plugin processes tabs, converting them into an appropriate number of spaces or the corresponding HTML format to ensure consistent indentation of tabs across different display environments.

[0196] Step 713: Generate the final HTML.

[0197] In some embodiments, the extension plugin integrates the content processed by the above steps to generate the final HTML content, which corresponds to the display file described in the above embodiments and is used to display in the debugging interaction window.

[0198] Step 714: Render in Webview.

[0199] In some embodiments, the debugging interaction window of the code editor is implemented as a webview, and the extension plugin renders and displays the final HTML content generated in the webview of the debugging interaction window of the code editor.

[0200] Step 715: Add interactive event handling.

[0201] In some embodiments, the extension plugin adds interactive event handling logic to the rendered interactive elements to ensure that they respond correctly when users click on links or trigger other interactive behaviors.

[0202] Step 716: Display formatted output.

[0203] In some embodiments, the extension plugin displays the final output, after formatting, color enhancement, link transformation, and interactive event binding, in the debug interaction window for users to view and manipulate.

[0204] In summary, the extended plugin performs ANSI color code parsing and conversion, DML link detection and clickable element conversion, and standardization of formatting such as spaces, line breaks, and tabs on the original debug output. Finally, it generates HTML content for rendering and display in WebView. This achieves color enhancement, interactive enhancement, and layout optimization of the debug output results, effectively solving problems such as monotonous colors, unclickable links, and chaotic formatting in traditional debug console output. As a result, it significantly improves the readability, information differentiation, and user interaction experience of the debug results.

[0205] In some embodiments, the extension plugin supports command completion functionality. When a user enters debug command characters in real time in the debug interaction window, the extension plugin performs a command completion process based on the debug command characters, determines the recommended command completion result, and displays the recommended command completion result in the debug interaction window for the user to select.

[0206] like Figure 8 As shown, a flowchart of the command completion execution process provided in an illustrative embodiment of this application is illustrated, the process including steps 810, 820, 830 and 840.

[0207] Step 810: Obtain the debugging command characters entered in real time in the debugging interaction window.

[0208] In this process, the user enters a debug command character in the command input box of the debug interaction window. This debug command character can be a complete command string or a command prefix to be completed (e.g., the user intends to enter "break" but currently only enters "bre"). The extension plugin listens for user input events in the command input box and obtains the debug command characters entered by the user in real time or on demand, as the basis for subsequent command completion.

[0209] In some embodiments, the extension plugin automatically triggers the command completion process after each character input by the user. In other embodiments, the extension plugin triggers the command completion process when the user presses a specific completion shortcut key (such as the Tab key). This application does not limit the triggering method of the command completion process.

[0210] Step 820: Determine the recommended result for command completion based on the debug command characters.

[0211] After obtaining the debug command characters that need to be completed, the extension plugin executes the command completion logic and generates recommended command completion results.

[0212] In some embodiments, the extension plugin first matches the debug command characters with historical debug commands, which are debug commands previously received by the debug interaction window; if a matching historical debug command exists, the matching historical debug command is determined as the command completion recommendation result.

[0213] Optionally, the extension plugin caches debugging commands that the user has entered in the debugging interaction window, and the extension plugin retrieves historical debugging commands by reading the cache.

[0214] Among them, historical debug commands represent debug commands that the user has entered and executed in historical debug sessions. These debug commands typically have a high probability of being reused. Therefore, during command completion, the completion result that matches the historical debug commands has the highest priority.

[0215] In some embodiments, when a debug command character successfully matches a historical debug command, the extension plugin determines the successfully matched historical debug command as the recommended command completion result, and uses the debug commands previously entered by the user as the recommended completion commands.

[0216] The extension plugin matches debug command characters with historical debug commands and determines command completion recommendations. It can provide completion suggestions for the currently entered debug command based on the user's historical debug commands, without relying on external command libraries or complex command parsing logic. This effectively improves the efficiency and accuracy of command completion, thereby significantly enhancing the convenience of debugging interaction and user experience.

[0217] In some embodiments, debugging commands include native debugging commands and custom debugging commands. Native debugging commands are built into the debugging tool, while custom debugging commands are user-defined debugging commands other than native debugging commands. Since the command completion interface of the code editor is designed for native debugging commands and does not have the functional logic to complete custom debugging commands, the extension plugin needs to use different command completion methods for custom commands and non-custom commands.

[0218] In some embodiments, when no matching historical debug commands exist, the extension plugin determines the recommended command completion result based on the matching result of the debug command characters and the custom command prefix, where the custom command prefix is ​​the character prefix of the custom debug command.

[0219] The custom command prefix identifies the character rules of custom debugging commands. For example, when the debugging tool is GDB, user-defined debugging commands typically use characters such as "ghw" or "mtext" as prefixes. The extension plugin matches the debugging command characters with the custom command prefix to determine whether the currently input debugging command characters conform to the naming rules of the custom commands. This determines whether different command completion methods should be used to complete the custom commands or non-custom commands.

[0220] As an illustration, when the extension plugin performs command completion for custom commands, it matches debug command characters with the set of custom commands to determine the recommended command completion result; when performing command completion for non-custom commands, it matches debug command characters with the set of non-custom commands to determine the recommended command completion result.

[0221] The extension plugin determines different command completion strategies by matching debug command characters with custom command prefixes. When the user's input of historical debug commands cannot provide a valid match, it selects different command completion strategies based on the matching results with the custom command prefix. This ensures the continuous availability of command completion functionality and avoids completion failures due to missing historical commands, thereby significantly improving the coverage and stability of command completion.

[0222] In other embodiments, the extension plugin does not need to determine the recommended completion command from historical debug commands. Instead, it directly matches the debug command characters with the custom command prefix and determines the recommended completion command based on the matching result. In other words, the command completion process does not depend on historical debug commands. This application does not impose any limitations on this aspect.

[0223] In some embodiments, when the matching result indicates that the debugging command characters do not match the custom command prefix, the extension plugin determines the recommended command completion result by calling the command completion interface of the code editor.

[0224] In cases where the matching result indicates that the debug command characters do not match the custom command prefix, it means that the currently input debug command characters do not conform to the naming rules of the custom command. In such cases, the extension plugin cannot use the command completion logic of the custom debug command and needs to use the command completion interface built into the code editor to complete the non-custom debug command.

[0225] To illustrate, if a user defines a custom command `mtext_print` corresponding to the custom command prefix `mtext`, when the user enters the debugging command character `pri`, since `pri` does not match the custom command prefix `mtext`, the extension plugin calls the code editor's command completion interface and passes `pri` to the debugging tool. The debugging tool returns a list of candidate commands prefixed with `pri`, such as `print`, `printf`, `priority`, etc., and the extension plugin uses this list as the recommended result for command completion.

[0226] In other embodiments, the extension plugin determines the recommended command completion result based on the current debugging context when the matching result indicates that the debugging command character matches the custom command prefix.

[0227] In cases where the matching result indicates that the debug command character matches the custom command prefix, it means that the currently input debug command character conforms to the naming rules of the custom command. The extension plugin needs to use the custom debug command completion logic for the debug command character, that is, generate command completion recommendation results based on the current debugging context.

[0228] In some embodiments, the extension plugin determines the most recently entered custom debugging command in the debugging interaction window based on the current debugging context, and generates command completion recommendation results based on the determined custom debugging command, thereby making the most recently used custom debugging commands by the user the priority recommendation completion candidates based on the user's historical input behavior.

[0229] For example, suppose the user previously entered three custom debugging commands in sequence: `mtext_print counter`, `mtext_print result`, and `mtext_display flag`. When the user enters the command prefix `mtext` again, the extension plugin determines the recommended command completion results from the most recently entered custom debugging commands based on the current debugging context. For instance, if the variables `counter` and `flag` exist in the current debugging context but `result` does not, the extension plugin will prioritize recommending `mtext_print counter` and `mtext_display flag`. The extension plugin displays these recommendations in the debugging interaction window for the user to choose from.

[0230] The extension plugin employs differentiated completion strategies for custom and native debugging commands based on the matching results between debug command characters and custom command prefixes. This approach ensures the accuracy of custom debugging command completion in specific debugging scenarios while avoiding semantic discrepancies that might arise from applying a universal completion method to all commands, thus significantly improving the efficiency and adaptability of command completion.

[0231] In some embodiments, if the number of candidate debug commands in the command completion results does not reach the threshold, the extension plugin performs command completion on the debug command characters by executing a custom matching script to obtain the command completion recommendation results.

[0232] Optionally, the extension plugin has a preset threshold to determine whether the number of candidate debug commands in the command completion recommendation results meets expectations. When the number of candidate debug commands in the command completion recommendation results is lower than this threshold, it indicates that the current command completion results may not be sufficient, and the extension plugin needs to execute additional command completion strategies to obtain more debug command recommendation results.

[0233] In some embodiments, due to the limited functionality of the command completion interface built into the code editor, users predefine custom matching scripts to implement more powerful command completion logic. When the extension plugin determines that an additional command completion strategy needs to be executed, it calls the custom matching script to complete the debugging command characters.

[0234] For example, the user defines fuzzy matching rules in a custom matching script. After the extension plugin calls this script, the script performs a fuzzy match between the debug command characters and all available debug commands, and uses the result of the fuzzy match as the command completion recommendation. This method can obtain richer and more flexible completion results than the built-in command completion interface of the code editor.

[0235] Optionally, the custom matching script includes, but is not limited to, Python scripts, Shell scripts, JavaScript scripts, etc. This application does not limit the specific implementation language and type of the custom matching script.

[0236] It should be noted that other types of command completion logic can also be implemented in the custom matching script, such as sorting completion based on command usage frequency, and intelligent completion based on context. This application does not limit the specific implementation method of the custom matching script.

[0237] The extension plugin effectively expands the coverage of command completion by executing a custom matching script to obtain more command completion recommendations when the number of candidate debug commands in the command completion recommendation results does not reach the threshold. This avoids the impact of too few or missing recommendations on user operation efficiency, while maintaining the flexibility and scalability of the command completion strategy.

[0238] Step 830: Control the debugging interaction window to display the command completion recommendation results.

[0239] In some embodiments, the extension plugin displays the determined command completion recommendations in the debug interaction window for the user to select. The user can select the desired command from the displayed command completion recommendations, and the selected command will be automatically filled into the command input box, or the command can be executed directly.

[0240] For example, the extension plugin can display the command completion recommendation results in a list format in the debugging interaction window, which is displayed below the command input box. Users can browse the recommended commands in the list using the up and down arrow keys and press Enter to confirm the selection. The extension plugin can also display the command completion recommendation results as a floating panel, supporting mouse click selection. This application embodiment does not limit the specific display method of the command completion recommendation results.

[0241] like Figure 9 The diagram illustrates a schematic embodiment of this application, showing the display of command completion recommendations. In the diagram, the user enters the debug command character "dis" in the debug interaction window. The extension plugin executes the command completion process based on this debug command character, obtaining three command completion recommendations: "display", "disable", and "disassemble". The extension plugin controls the debug interaction window to display the three recommendations in a list format, setting the first result in the list (i.e., "display") as the default selected state. The user can switch between the selected command completion recommendations using the up and down arrow keys and press the Esc key to close the display of the command completion recommendations.

[0242] In some embodiments, when the number of command completion recommendation results exceeds a preset threshold, the extension plugin displays the recommendation results in pages or scrolls to avoid screen congestion caused by displaying too many results simultaneously. When the number of command completion recommendation results is zero, the extension plugin displays a "No matching command" message in the debug interaction window, or does not display anything.

[0243] Step 840: In response to the selection of the command completion recommendation result, determine the first debugging command based on the selected command completion recommendation result and the debugging command character.

[0244] After the command completion recommendations are displayed in the debug interaction window, the user can select from the displayed recommendations to determine the first debug command to be executed.

[0245] In some embodiments, the displayed command completion recommendations only include recommended debugging command functions or parameters, not complete debugging commands. A complete debugging command requires multiple necessary components, such as functions and parameters. Therefore, after the user selects a command completion recommendation, the selected recommendation must be combined with the entered debugging command characters to generate a complete first debugging command.

[0246] As an illustration, the user has entered the debugging command character "file_". The command completion recommendations provide the functions "file_open" to open a file and "file_close" to close a file. If the user selects "file_open", the selected debugging command is determined to be "file_open" based on this selection and the entered character. However, it is still necessary to add the file object to be opened, for example, by selecting the recommended parameters or by the user manually entering "test.txt", to obtain the first debugging command "file_opentest.txt".

[0247] In summary, by acquiring the debugging command characters input by the user in real time and determining the command completion recommendation results based on the debugging command characters and displaying them in the debugging interaction window for the user to choose from, the input efficiency of debugging commands can be significantly improved, the burden of manually typing complete commands can be reduced, and input errors caused by spelling mistakes or forgetting grammar can be reduced, thereby improving the overall convenience and user experience of debugging operations.

[0248] like Figure 10 As shown, it illustrates a schematic embodiment of the command completion process provided in this application, which includes at least one of the following steps.

[0249] Step 1001: The user enters the command prefix.

[0250] In some embodiments, the user enters a command prefix in the debugging interaction window. The entered command prefix is ​​the debugging command character described in the above embodiments. The command prefix is ​​the starting character or string fragment of the debugging command to be completed.

[0251] Step 1002: Check if there is a matching debug command in the cache. If yes, proceed to step 1004; otherwise, proceed to step 1003.

[0252] In some embodiments, the extension plugin checks whether there is a debug command in the cache that matches the command prefix previously entered by the user. The debug commands in the cache are debug commands that have been received and executed by the debug interaction window before, corresponding to the historical debug commands described in the above embodiments. The plugin is used to determine the completion result from the debug commands previously entered by the user. The completion result is the command completion recommendation result described in the above embodiments.

[0253] Step 1003: Return the matching command in the cache.

[0254] In some embodiments, when a matching historical debug command exists in the cache, the extension plugin directly returns the matching command in the cache as a candidate completion result, thereby providing the most commonly used command suggestions that best meet the user's expectations.

[0255] Step 1004: Determine if it is a custom command prefix. If yes, proceed to step 1007; otherwise, proceed to step 1005.

[0256] In some embodiments, the extension plugin determines whether the command prefix entered by the user is a custom command prefix. The custom command prefix refers to the character prefix of a predefined custom debugging command, which corresponds to the custom command prefix described in the above embodiments, so as to distinguish between custom debugging commands and non-custom debugging commands and ensure the accuracy of completion.

[0257] Step 1005: Immediately detect the debug command.

[0258] In some embodiments, when the user-input command prefix is ​​not a custom command prefix, the extension plugin does not need to determine the completion result from the custom command, but directly calls the command completion interface of the code editor to perform command completion.

[0259] Step 1006: Obtain the newly discovered matching command.

[0260] In some embodiments, after calling the command completion interface, the extension plugin obtains the completion result returned by the command completion interface.

[0261] Step 1007: Obtain context completion through the debug session.

[0262] In some embodiments, when the user inputs a command prefix that is a custom command prefix, the extension plugin obtains context completion through the debugging session and determines the completion result from the custom command input by the user in the debugging session. The debugging session is the debugging context described in the above embodiments.

[0263] Step 1008: Obtain the session completion result.

[0264] In some embodiments, after obtaining custom commands entered by the user in the debugging session, the extension plugin matches them with the debugging command prefix to determine the matching custom debugging command as the completion result.

[0265] Step 1009: Determine if the completion result is sufficient. If yes, proceed to step 1010; otherwise, proceed to step 1011.

[0266] In some embodiments, the extension plugin determines whether the number of currently obtained completion results has reached a preset number threshold in order to determine whether it is necessary to expand the execution scope of command completion, thereby saving processing time when the number of completion results is sufficient.

[0267] Step 1010: Merge and remove duplicate results.

[0268] In some embodiments, once the completion result is determined, the extension plugin merges the completion results from different completion sources and removes duplicate commands to obtain a merged and deduplicated completion result set, thereby avoiding the display of redundant options in the completion list and improving the user experience.

[0269] Step 1011: Determine whether advanced discovery is enabled. If yes, proceed to step 1012; otherwise, proceed to step 1010.

[0270] In some embodiments, the extension plugin determines whether to execute a custom matching script for enhanced completion if the number of completion results does not reach a certain threshold, thereby enabling a more advanced discovery strategy when there are insufficient candidate debugging commands provided by the regular completion source.

[0271] Step 1012: Enhance discovery using a Python script.

[0272] In some embodiments, when advanced discovery is initiated, the extension plugin uses a Python script to enhance discovery to obtain more completion results, thereby leveraging the flexibility of custom scripts to compensate for the shortcomings of conventional completion methods.

[0273] Step 1013: Obtain the Python completion result.

[0274] In some embodiments, the extension plugin obtains the completion results returned after enhanced discovery via a Python script, in order to include the completion results generated by the advanced discovery mechanism in the final completion list, ensuring the comprehensiveness of the completion results.

[0275] Step 1014, sorting results.

[0276] In some embodiments, the extension plugin sorts the final completion results after merging and deduplication, for example, according to rules such as command usage frequency, most recent usage time, or alphabetical order, so as to place the command most likely to be selected by the user at the top of the list, shorten the user's search time, and improve completion efficiency.

[0277] Step 1015: Return to the final completion list.

[0278] In some embodiments, the extension plugin returns the final completion list obtained after merging, deduplication, and sorting, as the command completion recommendation result described in the above embodiments, and outputs the processed completion candidate set in a standard format for use in subsequent display steps.

[0279] Step 1016: Display completion suggestions.

[0280] In some embodiments, the extension plugin will display the final completion list as a suggestion list in the debug interaction window for the user to select and complete the input of debug commands, thereby helping the user to quickly identify and select the required commands in a visual way.

[0281] In summary, the extension plugin intelligently and efficiently provides users with accurate and comprehensive debugging command completion suggestions by sequentially performing steps such as cache matching, custom command prefix matching, debug session completion, result merging and deduplication, advanced script enhancement discovery, sorting and recommendation, and visualization.

[0282] In some embodiments, the debug interaction window is equipped with a data export control. When the extension plugin receives a trigger operation on the data export control, it exports the content displayed in the debug interaction window to a file by calling the data export interface of the code editor.

[0283] Optionally, the debug interaction window includes a data export control, which can be presented as a button, menu item, or other interactive element. When the user needs to save the currently displayed content, they can trigger the data export operation by clicking the data export control. After receiving the trigger signal, the extension plugin calls the data export interface provided by the code editor to export the debugging results currently displayed in the debug interaction window into a file of the specified format.

[0284] For example, after repeatedly printing and observing a variable, a user might want to save all the output results for later analysis. The user can click the "Export" button in the debugging interaction window. In response to this action, the extension plugin calls the code editor's file saving interface to export all content in the debugging results display area as an HTML file, text file, or JSON file. The user can choose the save path and filename, and the exported file can be opened and viewed locally or shared with others. This embodiment of the application does not impose any limitations on this.

[0285] In some embodiments, the data export control also supports filtering of the export range, such as exporting only the command execution results of the currently visible area, exporting only the command execution results selected by the user, or exporting all command execution results. This application embodiment does not limit the specific implementation and export format of the data export control.

[0286] In some embodiments, the debugging interaction window is provided with a command execution result switching control. When the extension plugin receives a trigger operation on the command execution result switching control, it switches the content displayed in the debugging interaction window.

[0287] Optionally, the debugging results displayed in the debugging interaction window may include various types of content, such as general output information, breakpoint hit information, variable value information, error messages, warning messages, and shared library loading information. To help users quickly locate specific types of debugging content and avoid reading interference caused by a large amount of mixed information, a command execution result toggle control is provided in the debugging interaction window. This command execution result toggle control can be presented in the form of a drop-down list, tab, or checkbox group, used to select the type of debugging content currently to be displayed.

[0288] In some embodiments, when a user triggers the command execution result switching control, the extension plugin responds to the triggering operation by switching the display of different types of debugging content in the debugging results.

[0289] For example, different types of debug content are labeled with type tags, including general debug content and loaded debug content. By default, the debug interaction window displays all types of debug content. When the user clicks the command execution result toggle control, the extension plugin controls the debug interaction window to hide loaded debug content.

[0290] like Figure 11 As shown, this diagram illustrates a schematic embodiment of the present application before the execution result of the switching display command. In the diagram, the debugging result display area in the debugging interaction window displays multiple types of debugging content, including general debugging content (such as breakpoint hit information, variable value output, expression calculation results, etc.) and loading-type debugging content (such as shared library loading information, dynamic link library loading logs, etc.). By default, the debugging result display area displays all types of debugging content, allowing the user to see complete debugging output information.

[0291] like Figure 12 As shown, this illustration depicts a schematic diagram of the switching display of command execution results according to an exemplary embodiment of this application. When the user clicks the command execution result switching control in the debugging interaction window, the extension plugin responds to the trigger operation by controlling the debugging interaction window to hide the loaded debugging content. Figure 12 As shown, after the switching operation is triggered, the shared library loading information such as "Loaded / lib64 / ld-linux-x86-64.so.2' Symbols loaded" that was originally displayed in the debugging results display area is hidden, and only general debugging content such as breakpoint hit information, source code line content, and register information is retained.

[0292] In some embodiments, when a user triggers the command execution result switching control, the extension plugin responds to the triggering operation by filtering the debugging results and displaying only the debugging content that matches the selected type in the debugging result display area, while other types of debugging content are hidden or collapsed.

[0293] For example, the command execution result toggle control can provide the following filtering options: "Show All", "Show Error Messages Only", "Show Warning Messages Only", "Show Breakpoint Messages Only", "Show Variable Values ​​Only", etc. When the user is only interested in error messages during debugging, they can select "Show Error Messages Only" from the toggle control. The extension plugin responds to this operation by controlling the debugging interaction window to only display the error message content in the debugging results, helping the user quickly locate the problem.

[0294] In other embodiments, the command execution result toggle control can also support multi-selection, for example, displaying both "error messages" and "warning messages" while hiding other types of content. The extension plugin can filter and display debugging results from multiple dimensions based on user selections.

[0295] In some embodiments, the command execution result switching control also supports displaying different types of debugging content in chronological order or by importance. This application embodiment does not limit the specific implementation method and switching logic of the command execution result switching control.

[0296] In other embodiments, when the user clicks the command execution result switching control again, the extension plugin controls the debugging interaction window to restore the display of the hidden loading type debugging content. This application does not limit the specific switching logic of the command execution result switching control.

[0297] By setting up data export controls and command execution result switching controls in the debugging interaction window, the code editor can provide users with a convenient way to persistently store debugging results, and flexibly filter and view specific types of debugging information according to debugging needs, avoiding interference from a large amount of mixed information, thereby significantly improving the convenience of data management and the readability of debugging results.

[0298] In other embodiments, the debug interaction window is also provided with a clear control, and the extension plugin responds to the triggering operation of the clear control to clear the debug results currently displayed in the debug interaction window.

[0299] Optionally, a clear control is configured in the debug interaction window. This clear control can be presented as a button, menu item, or other interactive element. When the user needs to clear the current debug output, they can trigger the clear operation by clicking the clear control. After receiving the trigger signal, the extension plugin clears all debug results in the output display area of ​​the debug interaction window, restoring the window to its initial blank state.

[0300] For example, during prolonged debugging, a large number of command outputs accumulate in the debugging interface, resulting in lengthy interface content and difficulty in locating information. Users can click the "Clear" button in the debugging interface; in response to this action, the extension plugin immediately clears all displayed content from the output area. After clearing, users can continue to enter new debugging commands, and the new execution results will be displayed again in a clean window, allowing users to focus on subsequent debugging tasks.

[0301] It is worth noting that the embodiments of this application do not limit the number and functions of the controls set in the debugging interaction window.

[0302] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0303] like Figure 13 As shown, it illustrates a schematic diagram of the structure of a code debugging device provided in an illustrative embodiment of this application. The functional modules in the device are implemented in the form of extension plugins as described in the above method embodiments. The extension plugins include a VSCode extension core 1310, a session management module 1320, a Webview console module 1330, a smart command completion module 1340, a command execution and processing module 1350, an output rendering module 1360, and a data export module 1370.

[0304] The VSCode extension core module 1310 includes an event listener 1311, a WebView manager 1312, and a debug session tracker 1313. The event listener 1311 listens for the start and end events of the Visual Studio Code debug session, triggering corresponding processing logic when the debug session state changes. The WebView manager 1312 is responsible for creating, managing, and destroying WebView instances, controlling the entire lifecycle of the WebView console. The debug session tracker 1313 tracks the current debug session state, captures debug output, and ensures the extension can obtain debug information in real time.

[0305] The session management module 1320 includes a session listener 1321, a WebView lifecycle manager 1322, a state manager 1323, and a content manager 1324. The session listener 1321 listens for the start and end events of the debugging session, working in conjunction with the event listener to promptly detect changes in the debugging session. The WebView lifecycle manager 1322 manages the specific creation, display, and destruction timing of the WebView, ensuring that the debugging interaction window appears and disappears at the correct times. The state manager 1323 manages the state and content of the WebView, including the window's display state and the current configuration of the user interface. The content manager 1324 manages the display and clearing of the debugging session content, controlling operations such as adding, removing, and clearing content in the output area.

[0306] The WebView console module 1330 includes a user interface 1331, a command input area 1332, a toolbar 1333, and an output display area 1334. The user interface 1331 provides a modern graphical user interface, serving as the front-end display layer for user interaction with the debugging console. The command input area 1332 receives GDB debugging commands input by the user, supporting auto-completion and navigation through command history. The toolbar 1333 provides function buttons for switching command execution results, exporting data, and clearing the console, facilitating quick execution of frequently used operations. The output display area 1334 displays the execution output of debugging commands, supporting the rendering of ANSI color codes and DML links.

[0307] The intelligent command completion module 1340 includes a completion request processor 1341, a cache queryer 1342, a session completer 1343, a Python discoverer 1344, and a result merger 1345. The completion request processor 1341 processes completion requests from the WebView command input area and coordinates the execution order of various completion strategies. The cache queryer 1342 queries the debug commands stored in the cache, prioritizing matching completion suggestions from historical commands. The session completer 1343 obtains context-dependent command completion suggestions based on the current debug session or utilizes the command completion capabilities built into the code debugger. The Python discoverer 1344 uses Python scripts for enhanced discovery, obtaining more candidate commands through custom scripts when regular completion results are insufficient. The result merger 1345 merges, deduplicates, and sorts the results from various completion strategies, including the cache queryer, session completer, and Python discoverer, to generate a final completion recommendation list.

[0308] The command execution and processing module 1350 includes a command receiver 1351, a command preprocessor 1352, a security checker 1353, a command executor 1354, and a result processor 1355. The command receiver 1351 receives command execution requests from the WebView console module, serving as the entry point for the command processing flow. The command preprocessor 1352 preprocesses received debugging commands, particularly performing security enhancements and format optimizations on Shell commands, thereby achieving enhanced command processing for debugging commands. The security checker 1353 detects whether user-inputted debugging commands contain potentially dangerous command patterns and applies appropriate security measures based on the risk level. The command executor 1354 executes the preprocessed and security-checked commands via the Visual Studio Code debugging API. The result processor 1355 processes the results returned after command execution, sending the raw output to the output rendering module 1360 for further processing.

[0309] The output rendering module 1360 includes an output receiver 1361, an ANSI parser 1362, a DML link processor 1363, a display formatter 1364, and an HTML renderer 1365. The output receiver 1361 receives raw output content from the command execution and processing module or a debugging session. The ANSI parser 1362 parses the ANSI color codes (such as "\x1b[32m" etc.) in the command execution results, converting them into HTML styles for display as colored text in the WebView. The DML link processor 1363 identifies and processes DML links in the command execution results, converting them into clickable interactive elements. The display formatter 1364 formats spaces, newlines, and tabs in the command execution results to maintain good layout, including handling line indentation, multiple consecutive spaces, and tab conversions. The HTML renderer 1365 generates the final HTML code from the content after ANSI parsing, DML link conversion, and formatting, and renders it in the WebView.

[0310] The data export module 1370 includes an export trigger 1371, a data collector 1372, an export formatter 1373, and a file saver 1374. The export trigger 1371 responds to a user clicking the export button on the toolbar, triggering the data export process. The data collector 1372 collects the output content in the current debug interactive window, preparing it for export. The export formatter 1373 formats the exported data, saving it in a suitable file format (such as a text file, HTML file, etc.). The file saver 1374 uses the file saving API provided by Visual Studio Code to save the formatted exported content to a user-specified file.

[0311] In summary, this code editing device, through the collaborative efforts of the VSCode extended core module, session management module, WebView console module, intelligent command completion module, command execution and processing module, output rendering module, and data export module, achieves full lifecycle management of debugging sessions, enhanced security execution of debugging commands, intelligent command completion, and color rendering and interactive display of debugging results, thus providing developers with an efficient and visual debugging environment.

[0312] like Figure 14 As shown, it illustrates a structural schematic diagram of a code debugging device provided in another illustrative embodiment of this application. The device includes an acquisition module 1410, a calling module 1420, and a control module 1430.

[0313] The acquisition module 1410 is configured to acquire the first debugging command entered in the debugging interaction window, which is created by calling the view interface of the code editor; Module 1420 is configured to determine the execution result of a command based on a first debugging command by calling the debugging interface of the code editor. The debugging interface is used to call debugging tools for code debugging. Control module 1430 is configured to control the display of the debugging interaction window based on the command execution results; The first debugging command is processed by the calling module's command enhancement process, or the command execution result is processed by the control module's display enhancement process, or the first debugging command is processed by the calling module's command enhancement process and the command execution result is processed by the control module's display enhancement process.

[0314] In some embodiments, the extension plugin is used to perform command enhancement processing on the first debug command, calls module 1420, and is also configured to perform command inspection on the debug command; Based on the processing measures corresponding to the inspection results of the command inspection, the first debugging command is enhanced to obtain the first debugging command after command enhancement. The first debug command, after command enhancement processing, is executed by calling the code editor's debug interface, and the command execution result is obtained.

[0315] In some embodiments, the inspection result includes any one of the following: the first debugging command belongs to a first type of debugging command, the first debugging command belongs to a second type of debugging command, and the first debugging command belongs to a third type of debugging command. The processing measures include at least one of adding a character replacement command, adding special characters, and adding timeout information. The calling module 1420 is further configured to add timeout information to the first debugging command if the first debugging command belongs to a first type of debugging command, thereby obtaining the first debugging command after command enhancement processing. The first type of debugging command is a system command and does not belong to the file operation command category. The timeout information is used to automatically stop the execution of the first debugging command when the execution of the first debugging command times out. When the first debugging command belongs to the second type of debugging command, special characters and timeout information are added to the first debugging command to obtain the first debugging command after command enhancement. The second type of debugging command is a system command, belongs to the file operation command, and the operation object is a non-preset file. The special characters are used to control the command execution result of the first debugging command to be a newline. If the first debugging command belongs to the third type of debugging command, add a character replacement command, special characters, and timeout information to the first debugging command to obtain the first debugging command after command enhancement. The third type of debugging command is a system command, belongs to the file operation command, and the operation object is a preset file. The character replacement command is used to control the replacement of characters in the command execution result of the first debugging command that do not meet the preset format requirements.

[0316] In some embodiments, the extension plugin is used to perform display enhancement processing on the command execution result, and the control module 1430 is further configured to perform display enhancement processing on the enhanced content in the command execution result to obtain the command execution result after display enhancement processing; A display file for generating a debugging interactive window is generated based on the command execution results after display enhancement processing; The control and debugging interactive window displays the files.

[0317] In some embodiments, the enhanced content includes at least one of color codes and debug marker link elements. The control module 1430 is also configured to convert the color codes in the command execution result based on the color display style of the display file to obtain the enhanced command execution result. Based on the interactive element display style of the presentation file, the debug marker link elements in the command execution result are transformed to obtain the command execution result with enhanced display. The debug marker link elements are used to mark the link content in the command execution result, and the command execution result with enhanced display includes interactive links.

[0318] In some embodiments, the interactive link includes a second debugging command, and the control module 1430 is further configured to perform a command check on the second debugging command in the interactive link; Based on the processing measures corresponding to the inspection results of the command inspection, the second debugging command in the interactive link is subjected to command enhancement processing.

[0319] The acquisition module 1410 is also configured to acquire debug command characters entered in real time in the debug interaction window; Based on the characters in the debugging command, determine the recommended result for command completion; The control and debugging interactive window displays command completion recommendation results; In response to the selection of the command completion recommendation result, the first debugging command is determined based on the selected command completion recommendation result and the debugging command character.

[0320] The acquisition module 1410 is also configured to match debug command characters with historical debug commands, which are the debug commands received earlier by the debug interaction window; If a matching historical debugging command exists, the matching historical debugging command will be selected as the command completion recommendation.

[0321] The acquisition module 1410 is also configured to determine the command completion recommendation result based on the matching result of the debugging command characters and the custom command prefix when no matching historical debugging command exists. The custom command prefix is ​​the character prefix of the custom debugging command.

[0322] In some embodiments, the acquisition module 1410 is further configured to determine the recommended command completion result by calling the command completion interface of the code editor when the matching result indicates that the debugging command character does not match the custom command prefix; If the matching result indicates that the debugging command character matches the custom command prefix, the recommended command completion result is determined based on the current debugging context.

[0323] The acquisition module 1410 is also configured to, when the number of candidate debug commands in the command completion recommendation results does not reach the number threshold, execute a custom matching script to complete the debug command characters and obtain the command completion recommendation results.

[0324] In some embodiments, the debugging interaction window is provided with at least one of a data export control and a command execution result switching control. The control module 1430 is also configured to, in response to receiving a trigger operation on the data export control, export the content displayed in the debugging interaction window to a file by calling the data export interface of the code editor. In response to receiving a trigger operation on the command execution result toggling control, switch the content displayed in the debug interaction window.

[0325] The control module 1430 is also configured to call the code editor's view interface to create a debugging interaction window when a debug session creation command is detected in the code editor.

[0326] In summary, by using an extension plugin running within the code editor, the system first obtains the initial debugging command entered by the user in the debugging interaction window, which is created by calling the code editor's view interface. Then, by calling the code editor's debugging interface, the extension plugin obtains the corresponding command execution result based on the initial debugging command. The extension plugin can enhance the initial debugging command, effectively reducing the risk of command execution failure or exceptions, thereby improving the security and reliability of the initial debugging command execution process. The extension plugin can also enhance the display of the command execution result, making the originally monotonous text results richer and more readable, thus solving the problem of the existing debugging console's monotonous and inflexible display format, and improving the effect and readability of the command execution result display.

[0327] Please refer to Figure 15 This diagram illustrates a structural block diagram of a computer device 1500 provided in an illustrative embodiment of this application. The computer device 1500 may be a smartphone, computer, tablet computer, or other terminal or server with storage capabilities. The computer device 1500 includes a processor 1501 and a memory 1502. The processor 1501 includes the code debugging device shown in the above embodiment.

[0328] Processor 1501 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 1501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 1501 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1501 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content required to be displayed on the screen.

[0329] The memory 1502 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 1502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices.

[0330] In some embodiments, the computer device 1500 may also optionally include a peripheral device interface 1503 and at least one peripheral device.

[0331] Those skilled in the art will understand that Figure 15 The structure shown does not constitute a limitation on the computer device 1500, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0332] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0333] On the other hand, embodiments of this application provide a computer device, which includes a processor and a memory. The memory stores at least one instruction, which is loaded and executed by the processor to implement the code debugging method provided in the embodiments of this application above.

[0334] On the other hand, embodiments of this application provide a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to implement the code debugging method provided in the embodiments of this application above.

[0335] On the other hand, embodiments of this application provide a computer program product, which includes computer instructions stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium, executes the computer instructions, and causes the processor of the computer device to load and execute the code debugging methods provided in the above-described method embodiments.

[0336] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A code debugging method, characterized in that, The method is used for running extension plugins in a code editor, and the method includes: The first debugging command entered in the debugging interaction window is obtained, and the debugging interaction window is created by calling the view interface of the code editor; By calling the debugging interface of the code editor, the command execution result is determined based on the first debugging command. The debugging interface is used to call debugging tools to perform code debugging. Based on the command execution result, control the display of the debugging interaction window; The extension plugin is used to perform at least one of the following functions: to enhance the first debugging command and to enhance the display of the command execution result.

2. The method according to claim 1, characterized in that, The extension plugin is used to enhance the first debugging command. The step of determining the command execution result based on the first debugging command by calling the code editor's debugging interface includes: Perform a command check on the first debugging command; Based on the processing measures corresponding to the inspection results of the command inspection, the first debugging command is subjected to command enhancement processing to obtain the first debugging command after command enhancement processing; The first debugging command after command enhancement processing is executed by calling the debugging interface of the code editor, and the execution result of the command is obtained.

3. The method according to claim 2, characterized in that, The inspection result includes any one of the following: the first debugging command belongs to the first type of debugging command, the first debugging command belongs to the second type of debugging command, and the first debugging command belongs to the third type of debugging command. The processing measures include at least one of the following: adding a character replacement command, adding special characters, and adding timeout information. The processing measures corresponding to the inspection results based on the command inspection perform command enhancement processing on the first debugging command to obtain a first debugging command after command enhancement processing, including at least one of the following: If the first debugging command belongs to the first type of debugging command, timeout information is added to the first debugging command to obtain the first debugging command after the command enhancement processing. The first type of debugging command is a system command and does not belong to the file operation command category. The timeout information is used to automatically stop the execution of the first debugging command when the execution of the first debugging command times out. When the first debugging command belongs to the second type of debugging command, special characters and timeout information are added to the first debugging command to obtain the first debugging command after the command enhancement processing. The second type of debugging command is a system command, belongs to the file operation command, and the operation object is a non-preset file. The special characters are used to control the command execution result of the first debugging command to be a newline. When the first debugging command belongs to the third type of debugging command, a character replacement command, special characters, and timeout information are added to the first debugging command to obtain the first debugging command after the command enhancement processing. The third type of debugging command is a system command, belongs to the file operation command category, and the operation object is a preset file. The character replacement command is used to control the replacement of characters in the command execution result of the first debugging command that do not meet the preset format requirements.

4. The method according to claim 1, characterized in that, The extension plugin is used to enhance the display of the command execution results. The step of controlling the display of the debugging interaction window based on the command execution results includes: The enhanced content in the command execution result is then subjected to display enhancement processing to obtain the command execution result with enhanced display. The display file for the debugging interaction window is generated based on the command execution result after the display enhancement processing; Control the display of the presentation file in the debugging interaction window.

5. The method according to claim 4, characterized in that, The enhanced content includes at least one of color codes and debug marker link elements. The process of performing display enhancement processing on the enhanced content in the command execution result to obtain a command execution result with enhanced display includes at least one of the following: Based on the color display style of the display file, the color code in the command execution result is converted to obtain the command execution result after display enhancement. Based on the interactive element display style of the display file, the debug marker link element in the command execution result is transformed to obtain the command execution result after display enhancement. The debug marker link element is used to mark the link content in the command execution result, and the command execution result after display enhancement includes interactive links.

6. The method according to claim 5, characterized in that, The interactive link contains a second debugging command, and the method further includes: Perform a command check on the second debugging command in the interactive link; Based on the processing measures corresponding to the inspection results of the command inspection, the second debugging command in the interactive link is subjected to command enhancement processing.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Obtain the debugging command characters entered in real time in the debugging interaction window; Based on the debug command characters, determine the command completion recommendation result; The debug interaction window is controlled to display the command completion recommendation results; In response to the selection of the command completion recommendation result, the first debugging command is determined based on the selected command completion recommendation result and the debugging command character.

8. The method according to claim 7, characterized in that, The method of determining the command completion recommendation result based on the debug command characters includes: The debugging command characters are matched with historical debugging commands, which are the debugging commands received earlier by the debugging interaction window; If a matching historical debugging command exists, the matching historical debugging command will be identified as the command completion recommendation result.

9. The method according to claim 8, characterized in that, The method further includes: In the absence of a matching historical debugging command, the recommended command completion result is determined based on the matching result between the characters of the debugging command and the custom command prefix, where the custom command prefix is ​​the character prefix of the custom debugging command.

10. The method according to claim 9, characterized in that, The process of determining the recommended command completion result based on the matching result between the debug command characters and the custom command prefix includes: If the matching result indicates that the debugging command character does not match the custom command prefix, the command completion recommendation result is determined by calling the command completion interface of the code editor; If the matching result indicates that the debugging command character matches the custom command prefix, the command completion recommendation result is determined based on the current debugging context.

11. The method according to claim 7, characterized in that, The method further includes: If the number of candidate debugging commands in the command completion recommendation results does not reach the threshold, a custom matching script is executed to complete the characters of the debugging commands, thus obtaining the command completion recommendation results.

12. The method according to any one of claims 1 to 6, characterized in that, The debugging interaction window is provided with at least one of a data export control and a command execution result switching control, and the method further includes at least one of the following: In response to receiving a trigger operation on the data export control, the content displayed in the debugging interaction window is exported as a file by calling the data export interface of the code editor; In response to receiving a trigger operation on the command execution result switching control, the content displayed in the debugging interaction window is switched.

13. A code debugging device, characterized in that, The device includes: The acquisition module is configured to acquire the first debugging command entered in the debugging interaction window, which is created by calling the view interface of the code editor; The calling module is configured to determine the command execution result based on the first debugging command by calling the debugging interface of the code editor. The debugging interface is used to call debugging tools for code debugging. The control module is configured to control the display of the debugging interaction window based on the command execution result; Wherein, the first debugging command is processed by the command enhancement processing of the calling module, or the command execution result is processed by the display enhancement processing of the control module, or the first debugging command is processed by the command enhancement processing of the calling module and the command execution result is processed by the display enhancement processing of the control module.

14. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the code debugging method as described in any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the code debugging method as described in any one of claims 1 to 12.

16. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, and a processor reads from and executes the computer program to implement the code debugging method as described in any one of claims 1 to 12.