VS Code-based Project Startup Method, Device, and Electronic Device

By developing project startup plug-ins in VS Code, automatically identifying and starting software development projects, the cumbersome problems of manually identifying and starting projects in the existing technology are solved, and the efficiency of software development is improved.

CN119861910BActive Publication Date: 2025-05-30SHENZHEN HAIGUI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510345109.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-05-30
Estimated Expiration
2045-03-24

AI Technical Summary

Technical Problem

In existing software development technology, creating and starting different types of software development projects requires manual identification of project types and execution of corresponding startup commands. The operation is cumbersome and the programming ability requirements are high, resulting in low software development efficiency.

Method used

Provide a project startup method based on VS Code. By developing project startup plug-in in VS Code, obtaining the project directory of the user's workspace, traversing the directory to determine whether there is a project type identification file, recording the target project type, obtaining the startup file and executing the target startup command to start the project.

Benefits of technology

It realizes automatic identification of project types and launching corresponding types of projects, reducing manual operations, reducing programming capabilities requirements, and improving software development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119861910B_ABST
    Figure CN119861910B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device and electronic device for starting a project based on VS Code, which includes obtaining the project directory of the workspace corresponding to the user; traversing the project directory to determine whether there is a project type identification file in the project directory; if there is a project type identification file in the project directory, recording the target project type identification file existing in the project directory, and determining the target project type of the workspace based on the target project type identification file; obtaining the startup file from the project directory based on a preset rule; obtaining the target startup command for starting the target project from the obtained startup file based on the target project type, and executing the target startup command to start the target project. By using the present invention, the manual operations required to start a specified type of project can be reduced, the programming ability requirements for relevant personnel are relatively low, and it is beneficial to improve the software development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technologies, and in particular, to a method, apparatus, and electronic device for starting a project based on VS Code. Background Art

[0002] With the continuous development of Internet technologies, it is generally necessary to create different types of software development projects to meet diverse software development requirements. Existing software development technologies usually adopt the method of manually creating the required type of projects separately for development. After creating multiple different types of projects in this way, if relevant personnel want to start a specified type of project, they need to manually identify the type of each project and find the specified type of project and then execute the corresponding start command to start the project. The operation is cumbersome and requires a relatively high programming ability for relevant personnel. It is difficult to start multiple different types of projects, and the software development efficiency is low. Summary of the Invention

[0003] In view of this, an object of the present invention is to provide a method, apparatus, and electronic device for starting a project based on VS Code to alleviate the above problems existing in existing software development technologies.

[0004] In a first aspect, an embodiment of the present invention provides a method for starting a project based on VS Code. The method is applied to a project start plug-in developed in VS Code, and the method includes: obtaining a project directory of a workspace corresponding to a user; wherein, the workspace includes at least one project, and the project directory includes a file directory of each project represented in a tree structure; traversing the project directory to determine whether there is a project type identification file in the project directory; if there is a project type identification file in the project directory, recording the target project type identification file existing in the project directory, and determining the target project type of the workspace based on the target project type identification file; obtaining a start file from the project directory based on a preset rule; wherein, the start file includes a start command for starting a corresponding project; obtaining a target start command for starting a target project from the obtained start files based on the target project type, and executing the target start command to start the target project.

[0005] Second aspect, an embodiment of the present invention further provides a project startup device based on VS Code. The device is applied to a project startup plugin developed in VS Code and includes: a first acquisition module for acquiring the project directory of the workspace corresponding to the user; wherein, the workspace contains at least one project, and the project directory includes the file directory of each project represented in a tree structure; a judgment module for traversing the project directory to judge whether there is a project type identification file in the project directory; a record determination module for, if there is a project type identification file in the project directory, recording the target project type identification file existing in the project directory and determining the target project type of the workspace based on the target project type identification file; a second acquisition module for acquiring a startup file from the project directory based on a preset rule; wherein, the startup file includes a startup command for starting the corresponding project; a startup module for acquiring a target startup command for starting the target project from the obtained startup file based on the target project type and executing the target startup command to start the target project.

[0006] Third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory. The memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the above-mentioned project startup method based on VS Code in the first aspect.

[0007] A project startup method, device and electronic device based on VS Code provided by an embodiment of the present invention acquire the project directory of the workspace corresponding to the user; traverse the project directory to judge whether there is a project type identification file in the project directory; if there is a project type identification file in the project directory, record the target project type identification file existing in the project directory and determine the target project type of the workspace based on the target project type identification file; acquire a startup file from the project directory based on a preset rule; acquire a target startup command for starting the target project from the obtained startup file based on the target project type and execute the target startup command to start the target project. By adopting the above technology, the project startup plugin developed in VS Code can automatically identify the type of the project and start the corresponding type of project, reducing the manual operations required to start a specified type of project, having a relatively low requirement for the programming ability of relevant personnel, and being beneficial to improving the software development efficiency.

[0008] Other features and advantages of the present invention will be described in the subsequent description, and part of them will become obvious from the description or be understood by implementing the present invention. The objectives and other advantages of the present invention are realized and obtained by the structures specifically pointed out in the description, the claims and the drawings.

[0009] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specifically describes preferred embodiments in conjunction with the accompanying drawings as follows. Description of the Drawings

[0010] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0011] Figure 1 It is a flowchart of a project startup method based on VS Code in an embodiment of the present invention;

[0012] Figure 2 It is an example diagram of starting a project using a project startup plugin in an embodiment of the present invention;

[0013] Figure 3 It is a structural schematic diagram of a project startup device based on VS Code in an embodiment of the present invention;

[0014] Figure 4 It is a structural schematic diagram of an electronic device in an embodiment of the present invention. Detailed Embodiments

[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0016] Currently, existing software development technologies usually adopt the method of manually creating the required type of projects separately for development. After creating multiple different types of projects using this method, if relevant personnel want to start a specified type of project, they need to manually identify the type of each project and find the specified type of project and then execute the corresponding startup command to start the project. The operation is cumbersome and requires a relatively high programming ability for relevant personnel. The difficulty of starting multiple different types of projects is relatively large, and the software development efficiency is relatively low.

[0017] Based on this, a project startup method, device, and electronic device based on VS Code provided by the embodiments of the present invention can alleviate the above problems existing in the existing software development technologies.

[0018] For the convenience of understanding this embodiment, first, a project startup method based on VS Code disclosed in the embodiments of the present invention will be introduced in detail. This method can be applied to a project startup plugin developed in VS Code. Refer to Figure 1 As shown, this method may include the following steps:

[0019] Step S102, obtain the project directory corresponding to the user's workspace.

[0020] Among them, the workspace may contain at least one project, and the project directory may include the file directories of each project represented in a tree structure.

[0021] The types of projects can be divided according to programming languages. For example, the types of projects may include Vue, Node.js, Python, Java, etc. Here, the specific division method of project types is not limited.

[0022] Step S104, traverse the project directory to determine whether there is a project type identification file in the project directory.

[0023] In the actual application process, the project type identification file may refer to a file that is representative of the type of the project. For example, the package.json file in a Node.js project, the pom.xml file in a Java project, etc. Here, the definition method of the project type identification file is not limited.

[0024] Step S106, if there is a project type identification file in the project directory, record the target project type identification file existing in the project directory, and determine the target project type of the workspace based on the target project type identification file.

[0025] For example, if there is a package.json file in the project directory, it can be determined that the workspace contains a Node.js project (that is, the target project type of the workspace has the Node.js type); if there is a pom.xml file in the project directory, it can be determined that the workspace contains a Java project (that is, the target project type of the workspace has the Java type).

[0026] Step S108, obtain the startup file from the project directory based on a preset rule.

[0027] Among them, the startup file includes a startup command for starting the corresponding project.

[0028] The preset rule can be defined from aspects such as file names, data structures in files, data contents in files, project metadata, file directory levels, etc. Here, the definition method of the preset rule is not limited.

[0029] Step S110: Obtain a target startup command for starting the target project from the obtained startup file based on the target project type, and execute the target startup command to start the target project.

[0030] A project startup method based on VS Code provided by an embodiment of the present invention includes: obtaining a project directory of a user's corresponding workspace; traversing the project directory to determine whether there is a project type identification file in the project directory; if there is a project type identification file in the project directory, record the target project type identification file existing in the project directory, and determine the target project type of the workspace based on the target project type identification file; obtaining a startup file from the project directory based on a preset rule; obtaining a target startup command for starting the target project from the obtained startup file based on the target project type, and executing the target startup command to start the target project. By adopting the above technology, the project startup plug-in developed in VS Code can automatically identify the type of the project and start the corresponding type of project, reducing the manual operations required to start a specified type of project, having a relatively low requirement for the programming ability of relevant personnel, and being conducive to improving software development efficiency.

[0031] As a possible implementation manner, the above preset rule may include a first rule for determining whether the main file name of a file contains a first keyword, a second rule for determining whether the file extension is a target extension, a third rule for determining whether the data structure of the file is a target data structure, and a fourth rule for determining whether the data in the file contains a second keyword. Based on this, the above step S108 (i.e., obtaining a startup file from the project directory based on a preset rule) may include:

[0032] Step 1: Traverse the project directory to obtain the file name of each file in the project directory.

[0033] Wherein, the file name may include the main file name and the extension of the corresponding file.

[0034] Step 2: Obtain initial candidate files from the project directory based on the first rule, the second rule, and the obtained file names.

[0035] Wherein, the candidate files may include first initial candidate files whose main file names contain the first keyword and / or second initial candidate files whose extensions are the target extension.

[0036] Exemplarily, when traversing to a certain file in the project directory, the file name of the file (including the main file name and the extension) can be obtained, and it can be determined whether the main file name of the file contains the first keyword based on the first rule. If the main file name of the file contains the first keyword (such as "config", "setup", etc.), the file can be determined as the first initial candidate file; after obtaining the extension of the file, it can also be determined whether the extension of the file is the target extension (such as ".json", ".xml", ".yaml", ".sh", etc.) based on the second rule. If the extension of the file is the target extension, the file can be determined as the second initial candidate file; if the file is determined as the first initial candidate file and / or the second initial candidate file, it indicates that the file is more likely to be a startup file, and it can be further determined whether the file is a startup file.

[0037] Step 3: Perform data parsing on the obtained initial candidate files, and obtain candidate files with the target data structure and the data in the files containing the second keyword from the obtained initial candidate files based on the third rule, the fourth rule, and the data parsing results, and then obtain the startup file from the obtained candidate files.

[0038] Exemplarily, after traversing to a certain file in the project directory and determining that the file is the first initial candidate file and / or the second initial candidate file, the file can be further parsed to obtain the data structure and data content of the file, and it can be determined whether the data structure of the file is the target data structure (such as having a "scripts" field, with <build>Labels, etc.), if the data structure of the file is the target data structure, then further determine whether the data content of the file contains the second keyword (such as "start", "run", "main", etc.) based on the fourth rule. If the data content of the file contains the second keyword, the file can be determined as a candidate file; if the file is determined as a candidate file, it means that the file is very likely to be a startup file, and the file can be directly determined as a startup file or further determine whether the file is a startup file.

[0039] In the actual application process, the above preset rules may further include project metadata (such as.gitignore file, README.md file, etc.) and / or the fifth rule for determining whether the file directory level is the target level. Based on this, there are mainly two operation methods for obtaining the startup file from the obtained candidate files in step 3 above:

[0040] Operation method 1: Extract the obtained candidate files as startup files.

[0041] Continuing with the previous example, for a certain candidate file, the candidate file can be directly determined as a startup file and the candidate file can be obtained.

[0042] Operation method 2: Determine the file directory level of the obtained candidate files, and obtain the target files from the candidate files based on the project metadata and / or the fifth rule, and then extract the obtained target files as startup files; among them, the target files include project metadata and / or the file directory level of the target files is the target level.

[0043] Continuing with the previous example, for a certain candidate file, the file directory level of the candidate file can be determined, and it can be determined whether the file directory level of the candidate file is the target level based on the fifth rule. If the file directory level of the candidate file is the target level, the candidate file can be determined as the target file and the candidate file can be extracted as the startup file; it can also be determined whether the candidate file includes project metadata. If the candidate file includes project metadata, the candidate file can be determined as the target file and the candidate file can be obtained as the startup file.

[0044] As a possible implementation, the above-mentioned project startup method based on VS Code may further include: if there is a project type identification file in the project directory, record the target file directory of the target project type identification file, and cache the recorded target file directory, so as to directly determine the target project type identification file based on the cached target file directory when traversing to the target project directory. By adopting the above operation mode of caching the results generated during the traversal process, the cached results can be directly used when the cached results appear during the traversal process, which can reduce the repeated calculations during the traversal process, thereby facilitating the improvement of the efficiency of traversing the project directory to find the project type identification file.

[0045] As a possible implementation, determining the target project type of the workspace based on the target project type identification file in step S106 above may include: obtaining the file name of the project type identification file; determining the target project type of the workspace based on the obtained file name.

[0046] For example, if it is detected that the file name of a certain file is "package.json", the determined target project type may be the Node.js type; if it is detected that the file name of a certain file is "pom.xml", the determined target project type may be the Java type.

[0047] As a possible implementation, the above-mentioned project startup method based on VS Code may further include: providing a graphical user interface to display the project directory through the graphical user interface after obtaining the project directory of the workspace corresponding to the user.

[0048] As a possible implementation, after displaying the project directory through the graphical user interface, the above-mentioned project startup method based on VSCode may further include: in response to a file selection operation or a folder selection operation on the project directory displayed by the graphical user interface, generating a startup menu and displaying it through the graphical user interface, so as to traverse the project directory to determine whether there is a project type identification file in the project directory after responding to a project startup trigger operation on the startup menu.

[0049] Exemplarily, after the project directory is displayed on the graphical user interface, the user can perform a selection operation (such as right-clicking the mouse, double-clicking the mouse, etc.) on any file or folder in the project directory on the graphical user interface to trigger the project startup plugin developed in VS Code to generate a startup menu and display the startup menu through the graphical user interface. The startup menu may include startup options, and the user can select the startup option on the startup menu, thereby triggering the project startup plugin to perform the step of traversing the project directory to determine whether there is a project type identification file in the project directory through the selection operation.

[0050] As a possible implementation, the above startup files can correspond one-to-one with the above target project types. Based on this, if there is only one target project type, the obtaining of the target startup command for starting the target project from the obtained startup files based on the target project type in step S110 above may include: obtaining the target startup command from the startup files.

[0051] Correspondingly, if there are multiple target project types, the obtaining of the target startup command for starting the target project from the obtained startup files based on the target project type in step S110 above may include:

[0052] Step A1, generating a startup project selection menu based on the target project type and the startup files and displaying it through a graphical user interface.

[0053] Among them, the startup project selection menu may include options corresponding to each target project type, and each option is generated based on the corresponding target project type and its corresponding startup file.

[0054] Step A2, in response to a selection operation for a target option in the startup project selection menu displayed on the graphical user interface, determining the target startup file corresponding to the target option from the startup files, and obtaining the target startup command from the target startup file.

[0055] For ease of understanding, the implementation manner of the above project startup method based on VS Code is described exemplarily below with a specific application as an example.

[0056] A project startup plugin integrated in the VS Code environment can be developed in advance so as to use the project startup plugin to start a project. As shown in Figure 2 The process of starting a project using the project startup plugin is as follows:

[0057] Step S1, identifying the project type.

[0058] Among them, the project type may include types such as Vue, Node.js, Python, Java, etc.

[0059] The operation manner of the above step S1 may include:

[0060] Step S11, checking the project root directory.

[0061] Exemplarily, when a user opens a large workspace containing one or more projects in VS Code, the project startup plugin can obtain the project directory tree of the current workspace and start checking each directory level by level from the current workspace directory of VS Code to see if there are project type identification files (such as package.json files, pom.xml files, requirements.txt files, etc.).

[0062] Step S12, record the inspection path.

[0063] The project startup plugin can record the inspected path during the inspection process to avoid duplicate inspections.

[0064] Step S13, determine the project type.

[0065] Once the project type identification file is found, the project startup plugin can record the path of the project type identification file in the project directory tree and determine the project type according to the file type of the project type identification file. For example, in the workspace, there is a Node.js project and a Java project. After the project startup plugin detects the package.json file, it will identify that there is a Node.js project in the workspace. After the project startup plugin detects the pom.xml file, it will identify that there is a Java project in the workspace.

[0066] Step S2, determine the location of the startup file.

[0067] Possible startup file identifiers can be predefined for each project type (for example, the startup file identifier for a Node.js project can be the start script, "scripts" field, etc. in the package.json file), so that the project startup plugin can use the depth-first search algorithm to search the project directory to determine the location of the startup file.

[0068] The search process of the depth-first search algorithm mainly includes: starting from the project root directory, performing a depth-first search on each directory; for each directory, checking whether there is a startup file identifier; if a startup file identifier is found, recording the path of the directory where the startup file identifier exists; if the project type has a known common directory structure, the common directory structure can be checked preferentially; for a specific type of project, the startup file identifier in the root directory can be checked first instead of checking whether there is a startup file identifier in the subdirectory (for example, for a Node.js project, the package.json file in the root directory can be checked preferentially instead of deeply checking the subdirectories).

[0069] Starting from the project root directory, the operation mode of performing a depth-first search on each directory can be as follows: The project startup plugin starts from the project root directory and first checks for common startup files in the root directory (for example, the package.json file is usually located in the root directory). If no startup file is found in the root directory, the project startup plugin will record the root directory and recursively check the subdirectories. In each subdirectory, the project startup plugin will again first check for startup files instead of delving deeper into the subdirectories to check for startup files. Once a startup file is found in a certain directory, the project startup plugin will stop further searching in that branch and return the search result to the user, that is, the project startup plugin will give priority to the main project type marked by the user rather than delving into each subdirectory for searching.

[0070] During the process of using the depth-first search algorithm to search the project directory to determine the location of the startup file, a caching mechanism can be used to cache the results of previous searches. When the same search conditions appear, the cached results can be directly used to reduce duplicate calculations. A series of rules can also be pre-established based on experience so that when analyzing the file content (such as analyzing the file name, parsing the file data, etc.), the established rules can be used to filter out the startup files. For example, files with names containing "config", "setup", etc. may be startup files, files with a relatively shallow file path depth may be startup files, use project metadata (such as.gitignore, README.md, etc.) to infer the possible location of the startup file, filter out possible startup files according to common startup file types (such as.json,.xml,.yaml,.sh, etc.), and have a specific data structure (such as having a "scripts" field, with <build>Labels, etc.) and the data content contains specific keywords (such as "start", "run", "main", etc.) may be startup files, and those with specific file names (such as "package.json", etc.) may be startup files.

[0071] Step S3, execute the startup command according to the project type.

[0072] The operation mode of the above step S3 may include:

[0073] Step S31, read the startup command.

[0074] According to the project type and the determined location of the startup file, the corresponding startup command in the corresponding startup file can be read.

[0075] For example, if the project startup plugin finds the "scripts" field in the package.json file (which is a common startup file identifier), and if the "start": "node app.js" command is defined in the "scripts" field, the project startup plugin can extract this command as the startup command.

[0076] Step S32, execute the startup command.

[0077] For example, for a Node.js project, the child_process module of Node.js can be used to execute the startup command read for the Node.js project.

[0078] In the above step S3, the project corresponds one-to-one with the startup file whose location of the startup file is determined (that is, each project has a unique startup file for starting the project and the directory location is known), and each startup file contains the startup command for starting the corresponding project; after the project startup plugin determines the project type and obtains the startup command, it can take the following two different operation modes according to whether the project type is one or more: (1) If there is only a single type of project, directly execute the startup command; (2) If there are multiple types of projects, generate options corresponding to each option based on each project type and its corresponding startup file, and then generate a startup project selection menu containing multiple options and display it through the provided user interface, so that the user can trigger the project startup plugin to execute the startup file corresponding to the specified option by selecting the specified option in the startup project selection menu.

[0079] In the actual application process, each option in the startup project selection menu can be named with the folder name where the startup file is located + the project type name, so that it is convenient for the user to intuitively know the project to be started through the startup project selection menu and select the corresponding option to trigger the startup of the corresponding project.

[0080] Step S4: Display the execution result of the startup command.

[0081] The project startup plugin can capture the execution result of the startup command obtained after the above step S3 and display it in the terminal of VS Code.

[0082] Continuing with the previous example, after obtaining the execution result of the startup command, the project startup plugin can display the execution result of the startup command through the user interface.

[0083] The advantages of the above VS Code-based project startup method compared with the prior art are mainly reflected in the following aspects:

[0084] 1) Improve development efficiency: By automatically identifying the project type and startup file, it reduces the manual operations of developers during project configuration and startup, significantly improving development efficiency.

[0085] 2) Reduce the operation error rate: Automated processing reduces the intervention of human operations, thereby reducing errors caused by manual operations.

[0086] 3) Enhance the user experience: It allows users to select projects to start through the user interface, enabling novice programmers to easily manage and start projects.

[0087] 4) Flexibility and scalability: It supports multiple programming languages, is applicable to multiple project types, and has good flexibility and scalability.

[0088] Based on the above VS Code-based project startup method, an embodiment of the present invention further provides a VSCode-based project startup device, which can be applied to the project startup plugin developed in VS Code. See Figure 3 As shown, the device may include the following modules:

[0089] The first acquisition module 302 is used to acquire the project directory corresponding to the user's workspace; wherein, the workspace contains at least one project, and the project directory includes the file directories of each project represented in a tree structure.

[0090] The judgment module 304 is used to traverse the project directory to judge whether there is a project type identification file in the project directory.

[0091] The record determination module 306 is used to, if there is a project type identification file in the project directory, record the target project type identification file existing in the project directory, and determine the target project type of the workspace based on the target project type identification file.

[0092] A second acquisition module 308, configured to acquire a startup file from the project directory based on a preset rule; wherein, the startup file includes a startup command for starting a corresponding project.

[0093] A startup module 310, configured to acquire a target startup command for starting a target project from the obtained startup file based on the target project type, and execute the target startup command to start the target project.

[0094] By adopting the above project startup device based on VS Code, the project startup plug-in developed in VS Code can be used to automatically identify the type of the project and start the project of the corresponding type, reducing the manual operations required to start a specified type of project, having relatively low requirements for the programming capabilities of relevant personnel, and being conducive to improving software development efficiency.

[0095] The above preset rule may include a first rule for determining whether the main file name of a file contains a first keyword, a second rule for determining whether the file extension is a target extension, a third rule for determining whether the data structure of the file is a target data structure, and a fourth rule for determining whether the data in the file contains a second keyword; based on this, the above second acquisition module 308 may further be configured to: traverse the project directory to obtain the file name of each file in the project directory; wherein, the file name includes the main file name and the extension of the corresponding file; acquire an initial candidate file from the project directory based on the first rule, the second rule, and the obtained file name; wherein, the candidate file includes a first initial candidate file whose main file name contains the first keyword and / or a second initial candidate file whose extension is the target extension; perform data parsing on the obtained initial candidate file, and acquire a candidate file whose data structure is the target data structure and the data in the file contains the second keyword from the obtained initial candidate file based on the third rule, the fourth rule, and the data parsing result, and then acquire the startup file from the obtained candidate file.

[0096] The above preset rule may further include project metadata and / or a fifth rule for determining whether the file directory level is a target level; based on this, the above second acquisition module 308 may further be configured to extract the obtained candidate file as the startup file; or, determine the file directory level of the obtained candidate file, and acquire a target file from the candidate file based on the project metadata and / or the fifth rule, and then extract the obtained target file as the startup file; wherein, the target file includes project metadata and / or the file directory level of the target file is the target level.

[0097] The above-mentioned record determination module 306 can also be used to: if there is a project type identification file in the project directory, record the target file directory of the target project type identification file, and cache the recorded target file directory, so as to directly determine the target project type identification file based on the cached target file directory when traversing the target project directory.

[0098] The above-mentioned record determination module 306 can also be used to: obtain the file name of the project type identification file; determine the target project type of the work area based on the obtained file name.

[0099] The above-mentioned first acquisition module 302 can also be used to: provide a graphical user interface to display the project directory through the graphical user interface after obtaining the project directory of the work area corresponding to the user.

[0100] The above-mentioned first acquisition module 302 can also be used to: after displaying the project directory through the graphical user interface, in response to a file selection operation or a folder selection operation on the project directory displayed by the graphical user interface, generate a start menu and display it through the graphical user interface, so as to traverse the project directory to determine whether there is a project type identification file in the project directory after responding to a project start trigger operation on the start menu.

[0101] The above-mentioned start file can correspond to the above-mentioned target project type one by one; based on this, if there is only one above-mentioned target project type, the above-mentioned start module 310 can also be used to: obtain the target start command from the start file.

[0102] If there are multiple above-mentioned target project types, the above-mentioned start module 310 can also be used to: generate a start project selection menu based on the target project type and the start file and display it through the graphical user interface; wherein, the start project selection menu includes options corresponding to each target project type, and each option is generated based on the corresponding target project type and its corresponding start file; in response to a selection operation on a target option in the start project selection menu displayed by the graphical user interface, determine the target start file corresponding to the target option from the start file, and obtain the target start command from the target start file.

[0103] The project start device based on VS Code provided by the embodiments of the present invention has the same implementation principle and the same technical effects as those of the foregoing embodiments of the project start method based on VS Code. For the sake of brief description, for the parts not mentioned in the embodiments of the project start device based on VS Code, reference may be made to the corresponding content in the foregoing embodiments of the project start method based on VS Code.

[0104] An embodiment of the present invention further provides an electronic device, such as Figure 4 shown, which is a schematic structural diagram of the electronic device. The electronic device includes a processor 41 and a memory 40. The memory 40 stores computer-executable instructions that can be executed by the processor 41. The processor 41 executes the computer-executable instructions to implement the above-mentioned VS Code-based project startup method.

[0105] In Figure 4 the illustrated embodiment, the electronic device further includes a bus 42 and a communication interface 43. The processor 41, the communication interface 43, and the memory 40 are connected through the bus 42.

[0106] The memory 40 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 43 (which can be wired or wireless), a communication connection is realized between the system network element and at least one other network element. The Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 42 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 42 can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 4 only a bidirectional arrow is used in

[0107] The processor 41 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 41 or the instructions in the form of software. The above-mentioned processor 41 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor 41 reads the information in the memory and combines its hardware to complete the steps of the method for starting a project based on VS Code in the foregoing embodiments.

[0108] Unless otherwise specifically stated, the relative steps, numerical expressions, and numerical values of the components and steps set forth in these embodiments do not limit the scope of the present invention.

[0109] If the above function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.

[0110] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0111] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present invention, which are used to illustrate the technical solutions of the present invention, rather than limiting them. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions described in the foregoing embodiments or easily conceive of changes, or equivalently replace some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.< / build> < / build>

Claims

1. A project startup method based on VS Code, characterized in that: The method is applied to a project startup plug-in developed in VS Code, and the method includes: Obtaining a project directory of a workspace corresponding to the user; wherein the workspace includes at least one project, and the project directory includes a file directory of each project represented in a tree structure; Traversing the project directory to determine whether there is a project type identification file in the project directory; If there is a project type identification file in the project directory, recording the target project type identification file in the project directory, and determining the target project type of the workspace based on the target project type identification file; Obtaining a startup file from the project directory based on preset rules; wherein the startup file includes a startup command for starting the corresponding project, and the preset rules include a first rule for determining whether the main file name of the file contains a first keyword, a second rule for determining whether the extension of the file is a target extension, a third rule for determining whether the data structure of the file is a target data structure, and a fourth rule for determining whether the data in the file contains a second keyword; A target startup command for starting the target project is acquired from the obtained startup file based on the target project type, and the target startup command is executed to start the target project.

2. The method according to claim 1, characterized in that: Obtaining a startup file from the project directory based on preset rules, including: Traversing the project directory to obtain the file name of each file in the project directory; wherein the file name includes the main file name and extension of the corresponding file; Based on the first rule, the second rule and the obtained file name, an initial candidate file is obtained from the project directory; wherein the initial candidate file includes a first initial candidate file whose main file name contains a first keyword and / or a second initial candidate file whose extension name is a target extension name; The obtained initial candidate file is subjected to data parsing, and based on the third rule, the fourth rule and the data parsing result, a candidate file whose data structure is the target data structure and whose data contains the second keyword is obtained from the obtained initial candidate file, and then the startup file is obtained from the obtained candidate file.

3. The method according to claim 2, characterized in that The preset rule also includes project metadata and / or a fifth rule for determining whether the file directory level is a target level; obtaining the startup file from the obtained candidate files includes: Extract the obtained candidate file as the startup file; or, determine the file directory level of the obtained candidate file, and obtain the target file from the candidate file based on the project metadata and / or the fifth rule, and then extract the obtained target file as the startup file; wherein the target file includes the project metadata and / or the file directory level of the target file as the target level.

4. The method according to claim 1, characterized in that: The method further comprises: If there is a project type identification file in the project directory, the target file directory of the target project type identification file is recorded, and the recorded target file directory is cached so that when traversing to the target project directory, the target project type identification file is directly determined based on the cached target file directory.

5. The method according to claim 2, characterized in that: Determining the target project type of the workspace based on the target project type identification file includes: Get the file name of the project type identification file; A target project type of the workspace is determined based on the obtained file name.

6. The method according to claim 2, characterized in that The method further comprises: A graphical user interface is provided to display the project directory through the graphical user interface after obtaining the project directory of the workspace corresponding to the user.

7. The method according to claim 6, characterized in that After displaying the project catalog via the graphical user interface, the method further includes: In response to a file selection operation or a folder selection operation on a project directory displayed by the graphical user interface, a startup menu is generated and displayed through the graphical user interface, so as to traverse the project directory in response to a project startup trigger operation on the startup menu to determine whether there is a project type identification file in the project directory.

8. The method according to claim 6, characterized in that The startup file corresponds to the target project type one by one; if there is only one target project type, obtaining a target startup command for starting the target project from the obtained startup file based on the target project type includes: Obtain the target startup command from the startup file; If there are multiple target project types, obtaining a target startup command for starting the target project from the obtained startup file based on the target project type includes: Generate a startup project selection menu based on the target project type and the startup file and display it through the graphical user interface; wherein the startup project selection menu includes options corresponding to each target project type, and each option is generated based on the corresponding target project type and its corresponding startup file; In response to a selection operation of a target option in a startup item selection menu displayed on the graphical user interface, a target startup file corresponding to the target option is determined from the startup file, and the target startup command is obtained from the target startup file.

9. A project startup device based on VS Code, characterized in that: The device is applied to a project startup plug-in developed in VS Code, and the device includes: A first acquisition module is used to acquire a project directory of a workspace corresponding to a user; wherein the workspace includes at least one project, and the project directory includes a file directory of each project represented in a tree structure; A determination module, used for traversing the project directory to determine whether there is a project type identification file in the project directory; a recording and determining module, configured to record a target project type identification file existing in the project directory if a project type identification file exists in the project directory, and determine a target project type of the workspace based on the target project type identification file; A second acquisition module is used to acquire a startup file from the project directory based on preset rules; wherein the startup file includes a startup command for starting the corresponding project, and the preset rules include a first rule for determining whether the main file name of the file contains a first keyword, a second rule for determining whether the extension of the file is a target extension, a third rule for determining whether the data structure of the file is a target data structure, and a fourth rule for determining whether the data in the file contains a second keyword; The startup module is used to obtain a target startup command for starting the target project from the obtained startup file based on the target project type, and execute the target startup command to start the target project.

10. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Automatic container starting method based on various types of projects

    CN113485795A

  • Software project dependency analysis method and device, computer equipment and storage medium

    CN115202709A