CN115202642A - VSCode integrated development environment Shell-based intelligent editing method and plug-in tool - Google Patents

VSCode integrated development environment Shell-based intelligent editing method and plug-in tool Download PDF

Info

Publication number
CN115202642A
CN115202642A CN202210737458.XA CN202210737458A CN115202642A CN 115202642 A CN115202642 A CN 115202642A CN 202210737458 A CN202210737458 A CN 202210737458A CN 115202642 A CN115202642 A CN 115202642A
Authority
CN
China
Prior art keywords
shell
grammar
command
automatically
vscode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210737458.XA
Other languages
Chinese (zh)
Inventor
林超超
吴春光
齐璇
顾郁莲
战茅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kirin Software Co Ltd
Original Assignee
Kirin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202210737458.XA priority Critical patent/CN115202642A/en
Publication of CN115202642A publication Critical patent/CN115202642A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Abstract

The application discloses a Shell intelligent editing method and a plug-in tool based on a VSCode integrated development environment, wherein a Shell intelligent editing plug-in is developed in the VSCode integrated development environment; when the Shell script file enters a text editor, activating and running the Shell intelligent editing plug-in; the Shell intelligent editing plug-in receives the content input by the text editor; the Shell intelligent editing plug-in automatically completes and completes the Shell grammar in the content input by the text editor, automatically floats the window to preview the use of the Shell grammar and the meaning of command operation options, automatically checks the static grammar and formats codes, and adds or deletes code templates and automatically inserts template codes; the common development method is used for solving the technical problems that when the Shell script is edited, the prompt function of syntax autocompletion and completion is not supported, the meaning content of command usage and operation options does not exist, a man command is required to be used for checking in a linux command line, static syntax check does not exist, and code formatting does not exist.

Description

VScode integrated development environment Shell-based intelligent editing method and plug-in tool
Technical Field
The invention belongs to the technical field of VScode development environments, and particularly relates to a method and a plug-in tool for Shell intelligent editing based on a VScode integrated development environment.
Background
The Linux system is widely applied, the Shell is used as a primary interaction means of the Linux system, is a command interface and a programming language, but an intelligent IDE tool does not support the development work of the Shell language all the time, developers generally adopt a text editor such as Vim to directly develop, the scheme is extremely unfriendly to novices, and the common development method has the defects that when the Shell script is edited, the prompt function of grammar automatic completion and completion is not supported, the meaning content of command usage and operation options does not exist, the human command is required to be used for checking in a Linux command line, static grammar check and code formatting do not exist, and the development efficiency is influenced.
Disclosure of Invention
The embodiment of the application provides a method for Shell intelligent editing based on VScode integrated development environment, which is used for solving the technical problems that the common development method does not support the prompt function of grammar automatic completion and completion, does not have the meaning content of command usage and operation options, needs to use man commands to view in a linux command line, and does not have the defects of static grammar check and code formatting when the Shell script is edited.
In view of this, an aspect of the present application provides a method for Shell intelligent editing based on a VSCode integrated development environment, where the method includes the following steps: developing a Shell intelligent editing plug-in a VSCode integrated development environment; when the Shell script file enters a text editor, the Shell intelligent editing plug-in is activated and operated; the Shell intelligent editing plug-in receives the content input by the text editor; the Shell intelligent editing plug-in automatically completes and completes the Shell grammar in the content input by the text editor, automatically floats the window to preview the meaning of the usage and command operation options, automatically checks the code formatting and static grammar, adds or deletes the code template and automatically inserts the template code.
Optionally, the Shell grammar performs auto-completion and completion, auto-floating window previews meanings of usage and command operation options thereof, adds or deletes a code template, and automatically inserts a template code, including the following steps: s1, VSCode creates a Shell script file and automatically generates a file header; s2, when a user inputs a character string into the Shell script file, receiving the character string by a grammar automatic completion and completion module, judging whether the character string is a Shell grammar keyword, and popping up a grammar completion prompt suspension box if the character string is the Shell grammar keyword; s3, when the condition S2 is not met, receiving the character string by a command usage prompting module, judging whether the command is a Linux system command, and popping up a floating window to prompt the usage, use cases or a specific parameter usage method if the command is the Linux system command; s4, pressing a shortcut key by a user, automatically completing the shortcut key if the shortcut key is a template code block, popping the template code block by a template code management module according to a keyword of a cursor position, and selecting a popup window, and inserting the template code block into the text editor after the user selects; and S5, repeating the steps S2, S3 and S4 until the Shell script is edited.
Optionally, the automatically formatting the code comprises the steps of: pressing a formatting shortcut key by a user; a code formatting module reads the content in the text editor; and updating the content in the text editor according to formatting rules.
Optionally, the automatically checking the static grammar includes the following steps: a user presses a grammar checking shortcut key; the content of the text editor is automatically input into a static grammar checking module; and the static grammar checking module checks the content and outputs a checking result.
On the other hand, the application provides a plug-in tool based on VSCode integrated development environment Shell intelligent editing, which comprises the following steps: grammar autocomplete and completion module: the system comprises a Shell statement analysis module, a response module and a response module, wherein the Shell statement analysis module is used for analyzing a Shell statement according to a built-in Shell grammar rule and outputting a completion or automatic completion response when a response event is triggered by a vscode editor; a static grammar checking module: the module adopts a shellcheck command carried by the system, the shellcheck command can check grammar in a script and POSIX compatibility, and provides warning or suggestion for grammar problems in the script; the command usage prompting module: the method is mainly used for realizing command completion by adopting the self-contained Bash-completion of the command after the user inputs the command, and prompting the use method, use cases or the use method of specific parameters of the command through the floating window; shell code formatting module: the system is used for indenting the Shell code and arranging a template code block; a template code management module: when the method is used for triggering the shortcut key, a template code block with a specific use method or repeatability is automatically output to the cursor position of the text editor according to the input keywords.
According to the technical scheme, the embodiment of the application has the following advantages:
compared with the prior art, the method based on the VScode integrated development environment Shell intelligent editing comprises the following steps: developing a Shell intelligent editing plug-in a VSCode integrated development environment; when the Shell script file enters a text editor, activating and running the Shell intelligent editing plug-in; the Shell intelligent editing plug-in receives the content input by the text editor; the Shell intelligent editing plug-in automatically completes and completes the Shell grammar in the content input by the text editor, previews the meaning of the usage and command operation options of the automatic floating window, automatically checks the code formatting and static grammar, adds or deletes the code template and automatically inserts the template code; the method comprises the steps of automatically completing and complementing Shell grammar in the content input by the text editor through a Shell intelligent editing plug-in, previewing the meaning of usage and command operation options of the Shell grammar through an automatic floating window, automatically checking code formatting and static grammar, adding or deleting a code template and automatically inserting template codes, further helping a developer write out correct sentences, automatically outputting specific usage or repeated code blocks to the cursor position of the text editor, improving development efficiency, and enabling the codes to be more standard by utilizing the function of one-key code formatting so as to be convenient to read.
Drawings
In order to express the technical scheme of the embodiments of the present application more clearly, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic method flow diagram of a method for Shell intelligent editing based on a VSCode integrated development environment provided in an embodiment of the present application;
fig. 2 is a schematic flow chart of a method for automatically completing and complementing Shell syntax, previewing meanings of usage and command operation options of the Shell syntax, adding or deleting a code template, and automatically inserting a template code in the method for Shell intelligent editing based on a VSCode integrated development environment provided in the embodiment of the present application;
fig. 3 is a schematic flow diagram illustrating the process of automatically completing and complementing Shell syntax, previewing the meaning of usage and command operation options of the Shell syntax through an automatic floating window, adding or deleting a code template, and automatically inserting a template code in the method for Shell intelligent editing based on a VSCode integrated development environment provided in the embodiment of the present application;
fig. 4 is a structural flow chart of automatically formatting a code in the method for Shell intelligent editing based on a VSCode integrated development environment provided in the embodiment of the present application;
fig. 5 is a structural flowchart for automatically checking static syntax in the method for Shell intelligent editing based on VSCode integrated development environment provided in the embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For easy understanding, please refer to fig. 1, the present application provides an embodiment of a method for Shell intelligent editing based on a VSCode integrated development environment, the method comprising the following steps: developing a Shell intelligent editing plug-in a VSCode integrated development environment; when the Shell script file enters the text editor, the Shell intelligent editing plug-in is activated and operated; the Shell intelligent editing plug-in receives the content input by the text editor; the Shell intelligent editing plug-in automatically completes and supplements the Shell grammar in the content input by the text editor, automatically floats the window to preview the use of the Shell grammar and the meaning of command operation options, automatically checks the code formatting and static grammar, adds or deletes a code template and automatically inserts a template code; the method comprises the steps of automatically completing and complementing Shell grammar in content input by a text editor through a Shell intelligent editing plug-in, previewing the meaning of usage and command operation options of the Shell grammar through an automatic floating window, automatically checking code formatting and static grammar, adding or deleting a code template and automatically inserting template codes, further helping a developer write correct sentences, automatically outputting specific usage or repeated code blocks to the cursor position of the text editor, improving development efficiency, and enabling the codes to be more standard by utilizing the function of one-key code formatting, thereby facilitating reading.
Further, referring to fig. 2 and 3, the shell syntax performs automatic completion and completion, automatic floating window previewing the meaning of its usage and command operation options, adding or deleting code templates, and automatically inserting template codes, including the following steps:
s1, VSCode creates a Shell script file and automatically generates a file header;
s2, when a user inputs a character string into the Shell script file, the grammar automatic completion and completion module receives the character string, analyzes a Shell sentence according to a built-in Shell grammar rule, judges whether the character string is a Shell grammar keyword, and pops up a grammar completion prompt suspension frame or automatically completes a response if the character string is the Shell grammar keyword;
s3, when the condition S2 is not met, namely the character string is not a grammar character string (namely the character string is not a shell grammar keyword bar), receiving the character string by a command usage prompting module, judging whether the character string is a Linux system command, and popping up a floating window to prompt a usage method of a command usage, a use case or a specific parameter if the character string is the Linux system command so as to help a developer write a correct statement;
s4, pressing a shortcut key by a user, if the shortcut key is a template code block, automatically completing the shortcut key, popping the template code block by a template code management module according to a keyword of a cursor position to select a popup window, and inserting the template code block into a text editor after the user selects;
s5, repeating the steps S2, S3 and S4 until the Shell script is edited;
by the method, the Shell intelligent editing plug-in automatically completes and completes the Shell grammar in the content input by the text editor, automatically floats the window to preview the meaning of the usage and command operation options, adds or deletes the code template and automatically inserts the template code, further helps a developer write out correct sentences, automatically outputs specific usage or repeated code blocks to the cursor position of the text editor, and greatly improves the development speed.
Further, referring to fig. 4, the automatic formatting of the code includes the following steps: pressing a formatting shortcut key by a user; the code formatting module reads the content in the text editor; updating the content in the text editor according to the formatting rule; by the method, the one-key code formatting function is realized, so that the code becomes more standard and is convenient to read.
Further, referring to fig. 5, the automatic checking of the static syntax includes the following steps: pressing a grammar checking shortcut key by a user; the content of the text editor is automatically input into a static grammar checking module; the static grammar checking module checks the content and outputs a checking result; through the method, the grammar problem is warned or suggested, and necessary help is provided for developers.
The application also provides an embodiment of a plug-in tool based on VScode integrated development environment Shell intelligent editing, which comprises the following steps: grammar autocomplete and completion module: the VSCode code editor is used for analyzing the Shell statement according to the built-in Shell grammar rule and outputting a completion or automatic completion response when the VSCode code editor triggers a response event; a static grammar checking module: the module adopts a shellcheck command carried by the system, the shellcheck command can check the compatibility of grammar and POSIX in the script and provide warning or suggestion for grammar problems in the script; the command usage prompting module: the method is mainly used for completing commands through the Bash-completion of the commands after the commands are input by a user, and prompting the use methods of the commands, use cases or specific parameters through a floating window; shell code formatting module: the method is used for indenting the Shell code and arranging the template code block; a template code management module: when the method is used for triggering the shortcut key, a template code block with a specific use method or repeatability is automatically output to the cursor position of the text editor according to the input keywords.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (5)

1. The method for Shell intelligent editing based on VScode integrated development environment is characterized by comprising the following steps:
developing a Shell intelligent editing plug-in a VSCode integrated development environment;
when the Shell script file enters a text editor, the Shell intelligent editing plug-in is activated and operated;
the Shell intelligent editing plug-in receives the content input by the text editor;
the Shell intelligent editing plug-in automatically completes and completes the Shell grammar in the content input by the text editor, automatically floats the window to preview the meaning of the usage and command operation options, automatically checks the code formatting and static grammar, adds or deletes the code template and automatically inserts the template code.
2. The method for Shell Intelligent editing based on VSCode Integrated development Environment of claim 1, wherein the Shell grammar performs auto-complete and completion, auto-floating window previews the meaning of its usage and command operation options, adds or deletes code templates and inserts template codes automatically, comprising the steps of:
s1, VSCode creates a Shell script file and automatically generates a file header;
s2, a user inputs a character string into the Shell script file, a grammar automatic completion and completion module receives the character string and judges whether the character string is a Shell grammar keyword, and if the character string is the Shell grammar keyword, a grammar completion prompt suspension box pops up;
s3, when the condition S2 is not met, receiving the character string by a command usage prompting module, judging whether the command is a Linux system command, and popping up a floating window to prompt the usage, use cases or a specific parameter using method if the command is the Linux system command;
s4, pressing a shortcut key by a user, automatically completing the shortcut key if the shortcut key is a template code block, popping the template code block by a template code management module according to a keyword of a cursor position, and selecting a popup window, and inserting the template code block into the text editor after the user selects;
and S5, repeating the steps S2, S3 and S4 until the Shell script is edited.
3. The method for Shell Intelligent editing based on VSCode Integrated development Environment of claim 1, wherein the automatically formatting the code comprises the steps of:
pressing a formatting shortcut key by a user;
a code formatting module reads the content in the text editor;
and updating the content in the text editor according to the formatting rule.
4. The method for Shell Intelligent editing based on VSCode Integrated development Environment of claim 1, wherein the automatic checking of static syntax comprises the following steps:
a user presses a grammar checking shortcut key;
the content of the text editor is automatically input into a static grammar checking module;
and the static grammar checking module checks the content and outputs a checking result.
5. Plug-in tool based on VSCode integrated development environment Shell intelligent editing is characterized by comprising the following components:
grammar autocomplete and completion module: the system is used for analyzing Shell sentences according to built-in Shell grammar rules and outputting completion or automatic completion responses when a response event is triggered by a vscode editor;
a static grammar checking module: the module adopts a shellcheck command carried by the system, the shellcheck command can check the grammar in the script and the POSIX compatibility, and provides warning or suggestion for the grammar problem;
the command usage prompting module: the method is mainly used for realizing command completion by adopting the self-contained Bash-completion of the command after a user inputs the command, and prompting the use method, use cases or use methods of specific parameters of the command through a floating window;
shell code formatting module: the system is used for indenting the Shell code and arranging a template code block;
a template code management module: when the method is used for triggering the shortcut key, a template code block with a specific use method or repeatability is automatically output to the cursor position of the text editor according to the input keywords.
CN202210737458.XA 2022-06-27 2022-06-27 VSCode integrated development environment Shell-based intelligent editing method and plug-in tool Pending CN115202642A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210737458.XA CN115202642A (en) 2022-06-27 2022-06-27 VSCode integrated development environment Shell-based intelligent editing method and plug-in tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210737458.XA CN115202642A (en) 2022-06-27 2022-06-27 VSCode integrated development environment Shell-based intelligent editing method and plug-in tool

Publications (1)

Publication Number Publication Date
CN115202642A true CN115202642A (en) 2022-10-18

Family

ID=83578616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210737458.XA Pending CN115202642A (en) 2022-06-27 2022-06-27 VSCode integrated development environment Shell-based intelligent editing method and plug-in tool

Country Status (1)

Country Link
CN (1) CN115202642A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115374762A (en) * 2022-10-26 2022-11-22 深圳市明源云采购科技有限公司 VS code-based code template sharing method and device, electronic equipment and medium
CN116301471A (en) * 2023-05-18 2023-06-23 深圳前海环融联易信息科技服务有限公司 Method for realizing automatic file insertion and automatic file insertion method
CN117193739A (en) * 2023-11-03 2023-12-08 建信金融科技有限责任公司 Script editing method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115374762A (en) * 2022-10-26 2022-11-22 深圳市明源云采购科技有限公司 VS code-based code template sharing method and device, electronic equipment and medium
CN116301471A (en) * 2023-05-18 2023-06-23 深圳前海环融联易信息科技服务有限公司 Method for realizing automatic file insertion and automatic file insertion method
CN116301471B (en) * 2023-05-18 2023-09-01 深圳前海环融联易信息科技服务有限公司 Method for realizing automatic file insertion and automatic file insertion method
CN117193739A (en) * 2023-11-03 2023-12-08 建信金融科技有限责任公司 Script editing method and device

Similar Documents

Publication Publication Date Title
CN115202642A (en) VSCode integrated development environment Shell-based intelligent editing method and plug-in tool
US10684829B2 (en) System and method for combining text editing and tree encoding for computer programs
KR100650427B1 (en) Integrated development tool for building a natural language understanding application
US6910004B2 (en) Method and computer system for part-of-speech tagging of incomplete sentences
US7761843B2 (en) Computer source code generator
JP2009519534A (en) Text editing apparatus and method
JPH0683772A (en) Method and system for language translation in dialog-type software application
US11158118B2 (en) Language model, method and apparatus for interpreting zoning legal text
KR100745530B1 (en) Browser-independent pop-up windows
CN111124380A (en) Front-end code generation method
WO2023007791A1 (en) Program code automatic generation system
US20050039108A1 (en) Fast tag entry in a multimodal markup language editor
CN116243901A (en) Method and system for rapidly developing multilingual project of front-end page
US7143027B2 (en) Sentence realization system for use with unification grammars
KR102095703B1 (en) An apparatus, method and recording medium for Markup parsing
KR100846203B1 (en) Method for generating mobile application and record media recorded program for realizing the same
JP4869281B2 (en) Machine translation apparatus, program and method
JPH07146785A (en) Method for automatically generating program and device therefor
JPS62271057A (en) Dictionary register system for translation device
CN117687620A (en) File generation method and device, terminal equipment and computer readable storage medium
JPS61234434A (en) Program editing system
CN111984243A (en) General security check and function extension method and device based on annotation
CN111443979A (en) Document processing method and device, computer equipment and storage medium
Blanc et al. Outilex Platform Graphical Interface. User Guide
JPS62271054A (en) Correction system for morpheme analysis result of translation device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination