Plug-in-based instruction execution method and device, equipment, medium and product

By introducing plug-in-based instruction execution methods into front-end development tools, using preset instruction plug-ins and manifest files, the problem of inconvenience in using traditional front-end development tools is solved, the operation efficiency and accuracy are improved, and the maintenance of development tools is enhanced and user experience.

CN118916039AInactive Publication Date: 2024-11-08SHENZHEN SMARTCITY TECH DEV GRP CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411420665.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2024-11-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the installation dependency, startup and construction of traditional front-end development tools, developers need to frequently manually enter instructions, which is inefficient and prone to errors, resulting in inconvenience in use.

Method used

Using plug-in-based instruction execution method, by preset instruction plug-ins and manifest files, responding to external interactions, matching target identifiers and calling target callback functions to execute instructions, simplifying the instruction execution process and improving efficiency.

Benefits of technology

It improves operational convenience and efficiency, ensures the accuracy of instruction execution, reduces the possibility of errors, realizes modularization of instructions, facilitates expansion and maintenance, and improves the flexibility of user experience and development tools.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916039A_ABST
    Figure CN118916039A_ABST
Patent Text Reader

Abstract

The invention discloses a plug-in-based instruction quick execution method and device, equipment, a storage medium and a computer program product, and relates to the technical field of front-end development, the plug-in is applied to a preset instruction plug-in installed by a front-end development tool, and the preset instruction plug-in at least comprises a list file. A target identifier of a target instruction corresponding to the interaction operation is matched, the interaction operation and the target identifier are bound in a list file, and the target identifier is associated with a target callback function; and calling a target callback function corresponding to the target identifier to execute the execution content of the target instruction packaged by the target callback function. The technical problem that a traditional front-end development tool is inconvenient to use is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of front-end development technology, and in particular to a plug-in-based instruction execution method, device, equipment, storage medium and computer program product. Background Art

[0002] As front-end project development becomes increasingly complex, vscode has become the preferred tool for many developers with its rich functions and good user experience. However, despite the powerful functions of vscode, in the traditional front-end development process, the project installation dependencies, startup and construction still rely on manual input of commands in the terminal. Developers need to frequently search and accurately input the corresponding commands. This method not only requires developers to be familiar with a variety of commands, but also has low efficiency. It is also very easy to cause command input errors due to human negligence, which in turn affects the continuity and stability of project implementation. Therefore, most of the traditional front-end development tools are inconvenient to use. Summary of the invention

[0003] The main purpose of this application is to provide a plug-in-based instruction execution method, device, equipment, storage medium and computer program product, aiming to solve the technical problem of the inconvenience of using traditional front-end development tools.

[0004] To achieve the above purpose, the present application proposes a plug-in-based instruction execution method, which is applied to a preset instruction plug-in installed by a front-end development tool, wherein the preset instruction plug-in includes at least a manifest file, and the plug-in-based instruction execution method includes: In response to an external interactive operation on the preset instruction plug-in, a target identifier of a target instruction corresponding to the interactive operation is matched, the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; The target callback function corresponding to the target identifier is called to execute the execution content of the target instruction encapsulated by the target callback function.

[0005] In one embodiment, the preset instruction plug-in further includes a running entry file, and before the step of responding to the external interactive operation on the preset instruction plug-in, the step further includes: When the preset instruction plug-in is activated, the activation function in the running entry file is called, wherein the activation function is used to initialize the preset instruction plug-in so that the preset instruction plug-in responds to the interactive operation.

[0006] In one embodiment, the step of responding to the preset instruction plug-in externally and matching the interactive operation of the target identifier of the instruction corresponding to the interactive operation comprises: In a case where it is detected that the interactive operation is inputting a preset shortcut key, taking a first identifier associated with the instruction corresponding to the preset shortcut key in the list file as the target identifier; In a case where it is detected that the interactive operation is a right-click on a file explorer, a preset file explorer menu corresponding to the file explorer is popped up, and according to a first preset option clicked in the preset file explorer menu, a second identifier associated with an instruction corresponding to the first preset option in the manifest file is used as the target identifier; In the case where it is detected that the interactive operation is a right-click on an editor, a preset editor menu corresponding to the editor is popped up, and according to a second preset option clicked in the preset editor menu, a third identifier associated with an instruction corresponding to the second preset option in the manifest file is used as the target identifier; In a case where it is detected that the interactive operation is clicking a preset editor icon, the fourth identifier associated with the instruction corresponding to the preset editor icon in the manifest file is used as the target identifier.

[0007] In one embodiment, the options in the preset file explorer menu and the preset editor menu are displayed in functional groups, the preset file explorer menu includes a first front group, a change group, an edit group and a default group, and the preset editor menu includes a second front group, a workspace group, a comparison group, a search group, a cut group and a modification group.

[0008] In one embodiment, the step of executing the execution content of the target instruction encapsulated by the target callback function includes: When the target instruction is a local startup instruction or a build instruction, reading the content of the manifest file and parsing the script set in the manifest file; Traversing the script set, searching for the script key of the keyword associated with the instruction corresponding to the interactive operation, and storing the script key in the script command array; Add a run script command prefix before the first script key in the script command array to form a to-be-executed instruction corresponding to the target instruction; A new terminal is created and displayed, and the to-be-executed instruction is sent to the new terminal for execution to complete the execution content of the target instruction, wherein the new terminal is an interactive operation interface for running the to-be-executed instruction.

[0009] In one embodiment, the step of executing the execution content of the target instruction encapsulated by the target callback function includes: In the case where the target instruction is a download-dependent instruction, a new terminal is created and displayed, and the preset configuration item instruction is sent to the new terminal for execution to complete the execution content of the target instruction encapsulated by the target callback function. The preset configuration item instruction is used to execute the download-dependent operation and does not change according to the specific content of the preset instruction plug-in.

[0010] In addition, to achieve the above purpose, the present application also proposes a plug-in-based instruction execution device, which is applied to a preset instruction plug-in installed by a front-end development tool, wherein the preset instruction plug-in includes at least a manifest file, and the plug-in-based instruction execution device includes: A response module, used to respond to an external interactive operation on the preset instruction plug-in, match a target identifier of a target instruction corresponding to the interactive operation, wherein the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; An execution module is used to call the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

[0011] In addition, to achieve the above-mentioned purpose, the present application also proposes a plug-in-based instruction execution device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the plug-in-based instruction execution method as described above.

[0012] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the plug-in-based instruction execution method described above are implemented.

[0013] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the plug-in-based instruction execution method as described above.

[0014] The present application provides a plug-in-based instruction execution method, which is applied to a front-end development tool. A preset instruction plug-in is installed in the front-end development tool, and the preset instruction plug-in includes at least a manifest file. The plug-in-based instruction execution method includes: responding to external interactive operations on the preset instruction plug-in, matching a target identifier of a target instruction corresponding to the interactive operation, the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; calling the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

[0015] This application responds to external interactive operations on preset instruction plug-ins, allowing users to trigger the execution of instructions through simple interactive operations, thereby improving the convenience and efficiency of operations. By binding interactive operations to target identifiers through manifest files, accurate matching between operations and instructions is achieved, ensuring the accuracy of instruction execution and reducing the possibility of execution errors. By calling callback functions associated with target identifiers, fast execution of instructions is achieved, the execution process is simplified, and execution efficiency is improved. By encapsulating the execution content of instructions in callback functions, modularization of execution content is achieved, which is convenient for expansion, modification and reuse, and improves the maintainability and flexibility of development tools. Compared with related solutions that require users to implement instructions by manually writing and executing code, this application allows users to trigger instructions through more intuitive plug-in-based interactive operations, improving user experience and operational efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A flowchart diagram of the first embodiment of the plug-in-based instruction execution method of the present application; Figure 2 A schematic diagram of a right-click resource manager context menu scenario provided in Embodiment 1 of the plug-in-based instruction execution method of the present application; Figure 3 A schematic diagram of a right-click editor menu scenario provided in Embodiment 1 of the plug-in-based instruction execution method of the present application; Figure 4 A schematic diagram of a scenario of clicking the icon menu in the upper right corner of the editor provided in Example 1 of the plug-in-based instruction execution method of the present application; Figure 5 A flowchart diagram of the second embodiment of the plug-in-based instruction execution method of the present application; Figure 6 This is a schematic diagram of the module structure of a plug-in-based instruction execution device according to an embodiment of the present application; Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the plug-in-based instruction execution method in the embodiment of the present application.

[0019] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0021] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The plug-in-based instruction execution method of the embodiment of the present application is applied to a front-end development tool, in which a preset instruction plug-in is installed, and the preset instruction plug-in includes at least a manifest file. The plug-in-based instruction execution method includes: responding to external interactive operations on the preset instruction plug-in, matching the target identifier of the target instruction corresponding to the interactive operation, the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; calling the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

[0023] In this embodiment, for ease of description, the following description is made with the front-end development system as the execution subject.

[0024] Since most of the current front-end development projects, from installing dependencies, starting to building, still rely on developers to manually type a series of complex commands in the terminal, this operation mode not only requires developers to remember many commands and their specific parameters, increasing learning costs and memory burdens, but also greatly reduces development efficiency. In addition, the manual input of commands is prone to errors due to human negligence, such as spelling errors in commands, improper parameter settings, etc. These problems are often not easy to detect, but can inadvertently hinder the smooth progress of the project, affecting the quality of the code, the continuity of the project and the ultimate stability.

[0025] The present application provides a solution. Through interactive operations on preset instruction plug-ins, users can easily trigger instruction execution, greatly improving operational efficiency. At the same time, the manifest file is used to bind interactions and target identifiers to ensure accurate correspondence between operations and instructions, reduce execution errors, and instantly call callback functions, simplifying the instruction execution process. The instruction content is modularly encapsulated in the callback function, which is easy to expand, modify and reuse, enhances the maintainability and flexibility of the development tool, and optimizes the front-end development experience as a whole.

[0026] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a front-end development system, etc. The front-end development system is taken as an example to illustrate this embodiment and the following embodiments.

[0027] Based on this, the embodiment of the present application provides a plug-in-based instruction execution method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the plug-in-based instruction execution method of the present application.

[0028] In this embodiment, the plug-in-based instruction execution method is applied to a preset instruction plug-in installed by a front-end development tool, the preset instruction plug-in includes at least a manifest file, and the plug-in-based instruction execution method includes steps S10 to S20: Step S10, responding to an external interactive operation on a preset instruction plug-in, matching a target identifier of a target instruction corresponding to the interactive operation, the interactive operation and the target identifier are bound in a manifest file, and the target identifier is associated with a target callback function; It should be noted that front-end development tools refer to software tools for developing Web front-end applications, providing an environment for writing, debugging, and testing Web front-end codes, such as Visual Studio Code, Sublime Text, Eclipse, etc. Preset instruction plug-ins refer to extension modules pre-installed in front-end development tools, which add additional functions or instructions to front-end development tools. The manifest file (package.json) refers to a component of the preset instruction plug-in, usually in the form of a configuration file, which is used to define the plug-in's meta information (such as name, version), supported instructions, and its binding relationship with interactive operations.

[0029] In addition, it should be noted that external refers to any external entity or system that interacts with the preset instruction plug-in, such as users, scripts, etc. Interaction operations refer to the operations performed by users on the preset instruction plug-in in the front-end development tool, such as clicking buttons, selecting menu items, etc. These operations trigger the execution of target instructions. Target instructions refer to the specific instructions that the user intends to execute through interactive operations, and the execution logic of specific instructions is encapsulated in the target callback function. The target callback function refers to the function associated with the target identifier. When the target identifier is triggered, the callback function is called to execute the corresponding execution logic. The target identifier means that in the manifest file, each interactive operation is bound to an identifier. These identifiers are used to uniquely identify and locate the instructions that the user wants to execute.

[0030] The system listens for interactive operations from the user, such as clicking a button, selecting a menu item, etc. When an interactive operation is captured, the system parses the specific information of the interactive operation, including the operation type (such as input shortcut keys, right-click Explorer context menu, etc.), the operation object (such as a button or menu item), etc. Based on the specific information of the interactive operation obtained by parsing, the corresponding target instruction and target identifier are queried in the manifest file.

[0031] It is understandable that in traditional front-end development tools, users need to remember complex commands or perform cumbersome menu operations to execute common functions, which reduces development efficiency. Therefore, step S10 is performed. Through the mechanism of preset instruction plug-ins and manifest files, users only need to perform simple interactive operations, and the system can automatically match the corresponding instruction identifier, which improves the convenience and intuitiveness of user operations, reduces the memory burden, and greatly simplifies the operation process.

[0032] Step S20, calling the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

[0033] It should be noted that once the target identifier is determined, the system will search for the corresponding target callback function in the manifest file based on the target identifier, and implement the execution content of the encapsulated target instruction by calling the target callback function, including the required parameter processing, logical judgment, resource call, etc. After the target instruction is executed, the target callback function will return the execution result or trigger other events, such as updating the user interface, displaying the execution result to the user, etc. When the target instruction is executed and all other events are completed, the current execution process ends and prepares to respond to the next interactive operation.

[0034] It is understandable that since the system usually relies on users to manually input commands or perform complex menu operations to trigger instruction execution, and lacks a mechanism for unified management and automated execution, step S20 is performed. Through the mechanism of preset instruction plug-ins and manifest files, centralized management, automatic matching and calling of instructions are realized, which greatly simplifies the operation process and improves development efficiency. At the same time, by encapsulating the instruction execution content in the target callback function, the modularization and reusability of the execution logic are achieved, reducing the risk of errors and maintenance costs.

[0035] In a feasible implementation manner, the preset instruction plug-in further includes a running entry file. In step S10, before the step of responding to the external interactive operation on the preset instruction plug-in, step A01 is also included: Step A01, when the preset instruction plug-in is activated, call the activation function in the run entry file, wherein the activation function is used to initialize the preset instruction plug-in so that the preset instruction plug-in responds to the interactive operation.

[0036] It should be noted that the run entry file (extension.js) is a file in the preset instruction plug-in, which is responsible for the initialization and configuration of the plug-in, and usually contains the activation function and other necessary initialization codes. The activation function refers to the function used to perform the initialization operation of the plug-in, such as registering the target instruction, setting the callback function, etc., which exists in the run entry file. The execution of the activation function indicates that the plug-in is ready to respond to user operations.

[0037] In addition, it should be noted that when the preset instruction plug-in is installed and ready to be activated in the front-end development tool, the system will call the activation function in the run entry file and perform a series of initialization operations, such as loading configuration, registering target instructions to the event processing system of the front-end development tool, and setting necessary callback functions, etc. Through these operations, the preset instruction plug-in can respond to various interactive operations performed by the user in the development tool.

[0038] In this implementation, necessary initialization steps are automatically executed through the activation function, which reduces manual intervention and lowers the error rate. Once the plug-in is activated, it can immediately respond to user operations, thereby improving the immediacy of user interaction. Users do not need to worry about the complex configuration and initialization process behind the plug-in. They only need to simply install and activate the plug-in to use the functions it provides, thereby improving user efficiency.

[0039] In a feasible implementation, in step S10, in response to an external interactive operation on a preset instruction plug-in, the step of matching the interactive operation with a target identifier of an instruction corresponding to the interactive operation includes steps A11 to A14: Step A11, when it is detected that the interactive operation is inputting a preset shortcut key, taking the first identifier associated with the instruction corresponding to the preset shortcut key in the list file as the target identifier; It should be noted that preset shortcut keys refer to user-defined or system-preset keyboard shortcut keys, which are used to quickly trigger specific commands. The system continuously monitors keyboard input events in the background. When an interactive operation of keyboard input shortcut keys is detected, the input key combination is compared with the shortcut keys defined in the manifest file. If a matching shortcut key is found, the first identifier associated with the shortcut key, i.e., the target identifier, is searched in the manifest file.

[0040] Exemplarily, in the preset instruction plug-in, the pre-set download dependency command shortcut key is "Shift+Alt+I". When the user enters the shortcut key Shift+Alt+I through the keyboard, the system responds immediately and determines the target identifier corresponding to the download dependency command in the manifest file.

[0041] Step A12, when it is detected that the interactive operation is a right-click on the file explorer, a preset file explorer menu corresponding to the file explorer is popped up, and according to the first preset option clicked in the preset file explorer menu, a second identifier associated with the instruction corresponding to the first preset option in the manifest file is used as the target identifier; It should be noted that the file explorer refers to a tool in the front-end development tool used to browse and manage files and directories in the front-end development project. The preset file explorer menu refers to the context menu for the file explorer, which contains a series of command options. The first preset option refers to a specific command selected by the user in the preset file explorer menu, such as "Download Dependencies", "Local Start", etc.

[0042] In addition, it should be noted that when it is detected that the user performs a right-click interaction operation in the file explorer area, the system will display a preset file explorer menu based on the location of the user's right-click (such as a file, folder, directory, etc.), record the user's first preset option in the preset file explorer menu, and search for the associated second identifier, i.e., the target identifier, in the manifest file based on the first preset option.

[0043] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 2 , Figure 2 A scenario diagram of a right-click resource manager context menu is provided. In a front-end development tool, there is a file resource manager P, which includes directories and files of multiple front-end development projects. When a user right-clicks a file p1 therein, the system pops up a corresponding preset file resource manager menu A, which includes multiple options, such as a download dependency command option a1, a local startup command option b1, a build command option c1, etc. When a user clicks the download dependency command option a1, the system determines a target identifier corresponding to option a1 in the manifest file, that is, a target identifier corresponding to the download dependency command. Similarly, when a user clicks the local startup command option b1, the system determines a target identifier corresponding to the local startup command in the manifest file; when a user clicks the build command option c1, the system determines a target identifier corresponding to the build command in the manifest file.

[0044] Step A13, when it is detected that the interactive operation is a right-click on the editor, a preset editor menu corresponding to the editor is popped up, and according to the second preset option clicked in the preset editor menu, a third identifier associated with the instruction corresponding to the second preset option in the manifest file is used as the target identifier; It should be noted that the editor refers to the text editor used to write and edit code in the front-end development tools, the preset editor menu refers to the context menu for the editor, which contains a series of command options, and the second preset option refers to a specific command selected by the user in the preset editor menu, such as "Download Dependencies", "Local Start", etc.

[0045] In addition, it should be noted that the system listens for the user's right-click event on the editing area interface. When it detects that the user performs a right-click interaction operation in the editing area interface, the system displays the preset editor context menu based on the location of the user's right click (such as text, code line, etc.), records the user's second preset option in the preset editor context menu, and searches the manifest file for the associated third identifier, i.e., the target identifier, based on the second preset option.

[0046] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 3 , Figure 3 A scenario diagram of the right-click editor menu is provided. In the front-end development tool, there is an editor for development. In the editing area interface W of the editor, multiple text codes are included. When the user right-clicks on the code w1, the system pops up the corresponding preset editor context menu B, which includes multiple options, such as download dependency command option a2, local startup command option b2, build command option c2, etc. When the user clicks the download dependency command option a2, the system determines the target identifier corresponding to option a2 in the manifest file, that is, the target identifier corresponding to the download dependency command. Similarly, when the user clicks the local startup command option b2, the system determines the target identifier corresponding to the local startup command in the manifest file; when the user clicks the build command option c2, the system determines the target identifier corresponding to the build command in the manifest file.

[0047] Step A14, when it is detected that the interactive operation is clicking on the preset editor icon, the fourth identifier associated with the instruction corresponding to the preset editor icon in the manifest file is used as the target identifier.

[0048] It should be noted that the preset editor icon refers to a preset, clickable icon in the front-end development tool, which is used to quickly access or execute specific instructions, including download dependency icons, local startup icons, and build icons. The system monitors the user's interactive operation of clicking the preset editor icon, and searches the manifest file for the fourth identifier associated with the icon, namely the target identifier, according to the preset editor icon that was clicked.

[0049] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 4 , Figure 4A schematic diagram of a scenario in which an icon menu is clicked in the upper right corner of an editor is provided. In the front-end development tool, there is an editor E for development. Three preset editor icons are set in the upper right corner of the editor: download dependency icon a3, local startup icon b3, and build icon c3. When a user clicks the download dependency icon a3, the system determines the target identifier corresponding to icon a3 in the manifest file, that is, the target identifier corresponding to the download dependency command. Similarly, when a user clicks the local startup command icon b3, the system determines the target identifier corresponding to the local startup command in the manifest file; when a user clicks the build command icon c3, the system determines the target identifier corresponding to the build command in the manifest file.

[0050] In this implementation, by detecting the input of the preset shortcut keys, the corresponding instructions are automatically determined and executed, without the need for the user to manually enter commands, thereby significantly improving the convenience of operation and execution efficiency. By right-clicking the file explorer and selecting the preset menu item, right-clicking in the editor and selecting the preset menu item, or clicking the preset editor icon, the corresponding instructions are directly triggered, simplifying the operation process and improving the flexibility and efficiency of the operation.

[0051] In a feasible implementation, the options in the preset file explorer menu and the preset editor menu are displayed in functional groups. The preset file explorer menu includes a first front group, a change group, an edit group, and a default group. The preset editor menu includes a second front group, a workspace group, a comparison group, a search group, a cut group, and a modification group.

[0052] It should be noted that in the preset file explorer menu, the first front group refers to the group arranged at the front, which contains user-defined or frequently used commands, the change group contains commands related to changing file contents, the edit group contains commands related to editing file contents, and the default group contains entries for opening the command palette.

[0053] In addition, it should be noted that in the preset editor menu, the second front group is similar to the first front group, and refers to the group arranged in the front, which contains user-defined or frequently used commands. The workspace group contains commands related to workspace operations, the comparison group contains commands related to file comparison in the difference editor, the search group contains commands related to searching in the search view, the cut group contains commands related to cutting, commands related to copying and pasting files, and the modify group contains commands related to modifying files.

[0054] In this embodiment, by putting commands with similar functions together and grouping the commands in the menu, the menu can be made clearer and more organized. Users can quickly locate the commands they need according to the group name, making it easier for users to find related commands and improving user operation efficiency.

[0055] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 In step S20, the execution content of the target instruction encapsulated by the target callback function includes steps E01 to E04: Step E01, when the target instruction is a local startup instruction or a build instruction, read the content of the manifest file and parse the script set in the manifest file; It should be noted that the local startup instruction refers to the command used to start the front-end project in the local development environment, such as npm run start. The build instruction refers to the use of specific commands or scripts to compile, compress, merge and other operations on the source code of the front-end project, and finally generate optimized code suitable for the production environment, such as npm run build. The script collection refers to the collection of all script commands defined by the scripts object in the manifest file. The scripts object defines a series of scripts that can be executed by the npm run command. These scripts are usually used for various tasks in the automated development process, such as testing, building, and publishing.

[0056] In addition, it should be noted that the system obtains the root directory of the current project through the path parameter (uri) of the callback function, thereby obtaining the path of the manifest file, reading the contents of the manifest file through the fs.readFileSync method, and using the JSON.parse method to parse the manifest file to obtain the scripts object, that is, the script collection.

[0057] Step E02, traverse the script collection, find the script key of the keyword associated with the instruction corresponding to the interactive operation, and store the script key in the script command array; It should be noted that the script key refers to the name of each script command in the script collection, and the script command array refers to the array that stores the filtered script keys. Use "Object.keys(scriptsData).filter(key =>key.includes('build'))" to traverse the script names in the script collection, filter the script keys based on whether they contain specific keywords (such as start, dev, serve for startup, and build for building), and store the filtered results in the script command array (startCommands).

[0058] Step E03, adding a run script command prefix before the first script key in the script command array to form a to-be-executed instruction corresponding to the target instruction; It should be noted that the script command prefix refers to the text that needs to be added in front when executing the script command, such as "npm run", and the to-be-executed instruction refers to the complete command composed of the script command prefix and the script key, ready to be executed in the terminal. The system concatenates the first filtered script key (startCommands[0]) with the run script command prefix (npm run) to form a complete to-be-executed instruction.

[0059] Step E04, creating a new terminal and displaying it, sending the instruction to be executed to the new terminal for execution to complete the execution content of the target instruction, wherein the new terminal is an interactive operation interface for running the instruction to be executed.

[0060] It should be noted that the new terminal refers to the interactive running interface created in the front-end development tool for executing the instructions to be executed. The system calls the API (Application Programming Interface) to create a new terminal, where the API can be "vscode.window.createTerminal", displays the terminal, and sends the instructions to be executed to the new terminal for execution.

[0061] In this implementation, by automatically reading the scripts in the manifest file, basic data is provided for subsequent execution steps. By automatically matching and filtering out the script commands required by the user, the user's search and selection time is reduced. By automatically building and executing commands, the user's operation steps and the possibility of errors are reduced, allowing the user to start or build a project with one click, significantly improving development efficiency.

[0062] In a feasible implementation manner, in step S20, executing the target instruction encapsulated by the target callback function includes step E11: Step E11, when the target instruction is a download-dependent instruction, a new terminal is created and displayed, and the preset configuration item instruction is sent to the new terminal for execution to complete the execution content of the target instruction encapsulated by the target callback function. The preset configuration item instruction is used to execute the download-dependent operation and does not change according to the specific content of the preset instruction plug-in.

[0063] It should be noted that the download dependency instruction refers to the command used to download project dependencies, such as npm install or yarn, the preset configuration item instruction refers to the predefined configuration item, which stores the command line instructions for installing project dependencies, and the download dependency operation refers to the process of executing the download dependency instruction to download and install the dependencies required for the project from a remote repository (such as npm or yarn repository).

[0064] In addition, it should be noted that the system calls the API for registering commands to register download dependency commands, where the API can be "vscode.commands.registerCommand", calls the API for creating terminals to create new terminals, where the API can be "vscode.window.createTerminal", and displays the new terminal, reads the predefined download dependency instructions from the predefined configuration item (config.code.install.command), and sends them to the new terminal for execution.

[0065] In this implementation, the operation of downloading dependencies is automatically executed in the newly created terminal through preset configuration item instructions, which greatly simplifies the tedious process of developers manually downloading and configuring project dependencies, not only reducing human errors, but also significantly improving development efficiency. By displaying and executing operations in the new terminal, users can clearly see the real-time progress and output results of downloading dependencies, thereby better understanding the build status of the project.

[0066] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the plug-in-based instruction execution method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0067] This application also provides a plug-in-based instruction execution device, please refer to Figure 6 The plug-in-based instruction execution device is applied to a preset instruction plug-in installed by the front-end development tool. The preset instruction plug-in includes at least a manifest file. The plug-in-based instruction execution device includes: A response module 10 is used to respond to an external interactive operation on a preset instruction plug-in, match a target identifier of a target instruction corresponding to the interactive operation, the interactive operation and the target identifier are bound in a manifest file, and the target identifier is associated with a target callback function; The execution module 20 is used to call the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

[0068] Optionally, the preset instruction plug-in further includes a running entry file, and the plug-in-based instruction execution device further includes an activation module 30, and the activation module 30 is used to: When the preset instruction plug-in is activated, the activation function in the run entry file is called, wherein the activation function is used to initialize the preset instruction plug-in so that the preset instruction plug-in responds to the interactive operation.

[0069] Optionally, the switching module 10 is further used for: When it is detected that the interactive operation is inputting a preset shortcut key, taking the first identifier associated with the instruction corresponding to the preset shortcut key in the manifest file as the target identifier; When it is detected that the interactive operation is a right-click on the file explorer, a preset file explorer menu corresponding to the file explorer is popped up, and according to the first preset option clicked in the preset file explorer menu, a second identifier associated with the instruction corresponding to the first preset option in the manifest file is used as the target identifier; When it is detected that the interactive operation is a right-click on the editor, a preset editor menu corresponding to the editor is popped up, and according to the second preset option clicked in the preset editor menu, a third identifier associated with the instruction corresponding to the second preset option in the manifest file is used as the target identifier; When it is detected that the interactive operation is clicking on the preset editor icon, the fourth identifier associated with the instruction corresponding to the preset editor icon in the manifest file is used as the target identifier.

[0070] Optionally, the options in the preset file explorer menu and the preset editor menu are displayed in functional groups. The preset file explorer menu includes the first front group, change group, edit group and default group, and the preset editor menu includes the second front group, workspace group, comparison group, search group, cut group and modification group.

[0071] Optionally, the execution module 20 is further configured to: When the target instruction is a local startup instruction or a build instruction, read the contents of the manifest file and parse the script set in the manifest file; Traverse the script collection, find the script key of the keyword associated with the instruction corresponding to the interactive operation, and store the script key in the script command array; Add the run script command prefix to the first script key in the script command array to form a to-be-executed instruction corresponding to the target instruction; A new terminal is created and displayed, and the instructions to be executed are sent to the new terminal for execution to complete the execution content of the target instructions, wherein the new terminal is an interactive operation interface for running the instructions to be executed.

[0072] Optionally, the execution module 20 is further configured to: When the target instruction is a download-dependent instruction, a new terminal is created and displayed, and the preset configuration item instruction is sent to the new terminal for execution to complete the execution content of the target instruction encapsulated by the target callback function. The preset configuration item instruction is used to execute the download-dependent operation and does not change according to the specific content of the preset instruction plug-in.

[0073] The plug-in-based instruction execution device provided by the present application adopts the plug-in-based instruction execution method in the above embodiment, which can solve the technical problem of the inconvenience of using traditional front-end development tools. Compared with the prior art, the beneficial effects of the plug-in-based instruction execution device provided by the present application are the same as the beneficial effects of the plug-in-based instruction execution method provided by the above embodiment, and the other technical features in the plug-in-based instruction execution device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0074] The present application provides a plug-in-based instruction execution device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the plug-in-based instruction execution method in the above-mentioned embodiment 1.

[0075] Reference below Figure 7 , which shows a schematic diagram of the structure of a plug-in-based instruction execution device suitable for implementing the embodiment of the present application. The plug-in-based instruction execution device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, PADs (Portable Application Description: tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The plug-in-based instruction execution device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0076] like Figure 7As shown, the plug-in-based instruction execution device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the plug-in-based instruction execution device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the plug-in-based instruction execution device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a plug-in-based instruction execution device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.

[0077] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0078] The plug-in-based instruction execution device provided by the present application adopts the plug-in-based instruction execution method in the above embodiment, which can solve the technical problem of the inconvenience of using traditional front-end development tools. Compared with the prior art, the beneficial effects of the plug-in-based instruction execution device provided by the present application are the same as the beneficial effects of the plug-in-based instruction execution method provided by the above embodiment, and the other technical features in the plug-in-based instruction execution device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0079] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0080] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0081] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the plug-in-based instruction execution method in the above-mentioned embodiment.

[0082] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0083] The computer-readable storage medium may be included in the plug-in-based instruction execution device; or may exist independently without being assembled into the plug-in-based instruction execution device.

[0084] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a plug-in-based instruction execution device, the plug-in-based instruction execution device: responds to external interactive operations on preset instruction plug-ins, matches the target identifier of the target instruction corresponding to the interactive operation, the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; calls the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

[0085] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0086] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0087] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0088] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned plug-in-based instruction execution method, and can solve the technical problem of the inconvenience of using traditional front-end development tools. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the plug-in-based instruction execution method provided by the above-mentioned embodiment, and will not be elaborated here.

[0089] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned plug-in-based instruction execution method when executed by a processor.

[0090] The computer program product provided by this application can solve the technical problem of the inconvenience of using traditional front-end development tools. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the plug-in-based instruction execution method provided in the above embodiment, which will not be repeated here.

[0091] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A plug-in-based instruction execution method, characterized in that: A preset instruction plug-in for installing a front-end development tool, wherein the preset instruction plug-in includes at least a manifest file, and the plug-in-based instruction execution method includes: In response to an external interactive operation on the preset instruction plug-in, a target identifier of a target instruction corresponding to the interactive operation is matched, the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; The target callback function corresponding to the target identifier is called to execute the execution content of the target instruction encapsulated by the target callback function.

2. The plug-in-based instruction execution method according to claim 1, characterized in that: The preset instruction plug-in also includes a running entry file, and before the step of responding to the external interactive operation of the preset instruction plug-in, it also includes: When the preset instruction plug-in is activated, the activation function in the running entry file is called, wherein the activation function is used to initialize the preset instruction plug-in so that the preset instruction plug-in responds to the interactive operation.

3. The plug-in-based instruction execution method according to claim 1, characterized in that: The step of responding to the external interactive operation on the preset instruction plug-in and matching the target identifier of the instruction corresponding to the interactive operation includes: In a case where it is detected that the interactive operation is inputting a preset shortcut key, taking a first identifier associated with the instruction corresponding to the preset shortcut key in the list file as the target identifier; In a case where it is detected that the interactive operation is a right-click on a file explorer, a preset file explorer menu corresponding to the file explorer is popped up, and according to a first preset option clicked in the preset file explorer menu, a second identifier associated with an instruction corresponding to the first preset option in the manifest file is used as the target identifier; In the case where it is detected that the interactive operation is a right-click on an editor, a preset editor menu corresponding to the editor is popped up, and according to a second preset option clicked in the preset editor menu, a third identifier associated with an instruction corresponding to the second preset option in the manifest file is used as the target identifier; In a case where it is detected that the interactive operation is clicking a preset editor icon, the fourth identifier associated with the instruction corresponding to the preset editor icon in the manifest file is used as the target identifier.

4. The plug-in-based instruction execution method according to claim 3, characterized in that: The options in the preset file explorer menu and the preset editor menu are displayed in functional groups. The preset file explorer menu includes a first front group, a change group, an edit group and a default group. The preset editor menu includes a second front group, a workspace group, a comparison group, a search group, a cut group and a modification group.

5. The plug-in-based instruction execution method according to claim 1, characterized in that: The step of executing the execution content of the target instruction encapsulated by the target callback function includes: When the target instruction is a local startup instruction or a build instruction, reading the content of the manifest file and parsing the script set in the manifest file; Traversing the script set, searching for the script key of the keyword associated with the instruction corresponding to the interactive operation, and storing the script key in the script command array; Add a run script command prefix before the first script key in the script command array to form a to-be-executed instruction corresponding to the target instruction; A new terminal is created and displayed, and the to-be-executed instruction is sent to the new terminal for execution to complete the execution content of the target instruction, wherein the new terminal is an interactive operation interface for running the to-be-executed instruction.

6. The plug-in-based instruction execution method according to claim 1, characterized in that: The step of executing the execution content of the target instruction encapsulated by the target callback function includes: In the case where the target instruction is a download-dependent instruction, a new terminal is created and displayed, and the preset configuration item instruction is sent to the new terminal for execution to complete the execution content of the target instruction encapsulated by the target callback function. The preset configuration item instruction is used to execute the download-dependent operation and does not change according to the specific content of the preset instruction plug-in.

7. A plug-in-based instruction execution device, characterized in that: A preset instruction plug-in for installing a front-end development tool, wherein the preset instruction plug-in includes at least a manifest file, and the plug-in-based instruction execution device includes: A response module, used to respond to an external interactive operation on the preset instruction plug-in, match a target identifier of a target instruction corresponding to the interactive operation, wherein the interactive operation and the target identifier are bound in the manifest file, and the target identifier is associated with a target callback function; An execution module is used to call the target callback function corresponding to the target identifier to execute the execution content of the target instruction encapsulated by the target callback function.

8. A plug-in-based instruction execution device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the plug-in-based instruction execution method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the plug-in-based instruction execution method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the plug-in-based instruction execution method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data interaction method and device, electronic equipment and storage medium

    CN110691136A

  • Operation visualization method and device, equipment and storage medium

    CN114780195A

  • Command line tool execution method and device, medium and equipment

    CN116048476A

  • Plug-in extension method and device based on assembly, electronic equipment and storage medium

    CN118245034A