CN116301471B - Method for realizing automatic file insertion and automatic file insertion method - Google Patents

Method for realizing automatic file insertion and automatic file insertion method Download PDF

Info

Publication number
CN116301471B
CN116301471B CN202310557962.6A CN202310557962A CN116301471B CN 116301471 B CN116301471 B CN 116301471B CN 202310557962 A CN202310557962 A CN 202310557962A CN 116301471 B CN116301471 B CN 116301471B
Authority
CN
China
Prior art keywords
file
function
target
path
relative path
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.)
Active
Application number
CN202310557962.6A
Other languages
Chinese (zh)
Other versions
CN116301471A (en
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.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service 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 Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN202310557962.6A priority Critical patent/CN116301471B/en
Publication of CN116301471A publication Critical patent/CN116301471A/en
Application granted granted Critical
Publication of CN116301471B publication Critical patent/CN116301471B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/04812Interaction techniques based on cursor appearance or behaviour, e.g. being affected by the presence of displayed objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0482Interaction with lists of selectable items, e.g. menus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to a method for realizing automatic file insertion and a method for realizing automatic file insertion, wherein the method for realizing automatic file insertion comprises the following steps: setting a file insertion operation command to pop up a file insertion function item at the current cursor position of the target item code; using a dialogue opening function, calling a file selection popup when the file insertion function item is triggered, and transmitting an absolute path of a target file selected by a user in the file selection popup to a file relative path acquisition function; determining the relative path of the target file according to the absolute path of the target file by using the file relative path acquisition function; and inserting the relative path into the position of the current cursor by using an active file editing function. The application obviously improves the convenience and accuracy of file insertion of developers in the software development process, and greatly improves the efficiency of software project development.

Description

Method for realizing automatic file insertion and automatic file insertion method
Technical Field
The application relates to the technical field of computers, in particular to a method for realizing automatic file insertion and a method for automatically inserting files.
Background
When software development projects are carried out, various files are often required to be introduced, but file reference paths are places which are easy to make mistakes, and a layer of folders are often required to be checked, so that great trouble and burden are brought to developers.
The file insertion tool currently used in the industry has two types of plug-ins, path Autocomplete and the related Path. However, path Autocomplete requires a user to select a file directory first and second, and once the user selects the file directory by mistake, the user needs to delete the previously selected path, and then select the designated file first and second, which is complicated; the related Path requires the user to input the file name, which requires the user to memorize the file name or copy the name of the designated file, which is inconvenient; and the detailed information of the selected file can not be seen by both tools, and the problem of easy error selection exists for the similar files.
Disclosure of Invention
In order to solve the above problems, embodiments of the present application provide a method for implementing automatic file insertion and a method for implementing automatic file insertion, so as to overcome or partially overcome the defects in the prior art.
In a first aspect, an embodiment of the present application provides a method for implementing automatic file insertion, where the method for implementing automatic file insertion includes:
Setting a file insertion operation command to pop up a file insertion function item at the current cursor position of the target item code;
using a dialogue opening function, calling a file selection popup when the file insertion function item is triggered, and transmitting an absolute path of a target file selected by a user in the file selection popup to a file relative path acquisition function;
determining the relative path of the target file according to the absolute path of the target file by using the file relative path acquisition function;
and inserting the relative path into the position of the current cursor by using an active file editing function.
In a second aspect, an embodiment of the present application further provides a method for automatically inserting a file, where the method for automatically inserting a file includes:
responding to a first starting operation of a user on a file inserting operation command at the current position of a cursor of a target project code, and popping up a file inserting function item;
based on a dialogue opening function, responding to a second starting operation of a user on the file inserting function item, popping up a file selecting popup window, responding to a file selecting operation of the user on the file selecting popup window, and transmitting an absolute path of a target file indicated by the file selecting operation to a file relative path obtaining function;
Determining the relative path of the target file according to the absolute path of the target file based on a file relative path acquisition function;
and inserting the relative path into the position of the current cursor based on an active file editing function.
In a third aspect, an embodiment of the present application further provides an apparatus for implementing automatic file insertion, where the apparatus for implementing automatic file insertion includes:
a first setting unit for setting a file insertion operation command to pop up a file insertion function item at a current cursor position of a target item code;
a second setting unit, configured to call a file selection popup when the file insertion function item is triggered by using a session opening function, and transfer an absolute path of a target file selected by a user at the file selection popup to a file relative path acquisition function;
a third setting unit, configured to determine a relative path of the target file according to an absolute path of the target file by using the file relative path acquisition function;
and the fourth setting unit is used for inserting the relative path into the position of the current cursor by using an active file editing function.
In a fourth aspect, an embodiment of the present application further provides an automatic document insertion apparatus, including:
A function item ejecting unit for ejecting a file insertion function item in response to a first start operation of a user on a file insertion operation command at a current cursor position of a target item code;
a popup unit for popup the file selection popup in response to the second start operation of the user on the file insertion function item based on the dialogue opening function, and transmitting the absolute path of the target file indicated by the file selection operation to a file relative path acquisition function in response to the file selection operation of the user on the file selection popup;
a path acquisition unit, configured to determine a relative path of the target file according to an absolute path of the target file based on the file relative path acquisition function;
and the path insertion unit is used for inserting the relative path into the position of the current cursor based on the active file editing function.
In a fifth aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement a method for implementing automatic insertion of a file of any of the above and a method for automatically inserting a file.
In a sixth aspect, there is provided a computer-readable storage medium storing a computer program, which when instructed by a processor, implements a method of implementing automatic insertion of a file of any one of the above, and a method of automatically inserting a file.
The above at least one technical scheme adopted by the embodiment of the application can achieve the following beneficial effects:
the application provides a method for realizing automatic file insertion, which comprises the steps of ejecting a file insertion function item through a user-defined insertion operation command, calling a file selection popup window when the file insertion function item is triggered by utilizing a dialogue opening function, acquiring a relative path address of a selected file relative to a current file by utilizing a file relative path acquisition function after the user selects the file, and finally inserting the relative path into a designated place where a cursor is positioned by utilizing an active file editing function. According to the method for realizing automatic file insertion, a user can select the file to be introduced in the file selection frame, the first-level and first-level selection directory is not needed to find the file, meanwhile, if the user selects the file by mistake, the user directly returns to the upper-layer file directory, and the code input before deletion is not needed to be input again; the file name does not need to be copied or memorized, and the method is simple and convenient; and the detailed information of the file can be seen when the file is selected, and the similar file is not easy to select wrong. The application obviously improves the convenience and accuracy of file insertion of developers in the software development process, and greatly improves the efficiency of software project development.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 illustrates a flow diagram of a method for implementing automatic insertion of files according to one embodiment of the application;
FIG. 2 illustrates an effect diagram of a file insertion function item pop-up according to one embodiment of the application;
FIG. 3 illustrates a schematic view of the effects of a document selection popup being evoked, according to one embodiment of the present application;
FIG. 4 illustrates an effect diagram of a file after relative path insertion according to one embodiment of the application;
FIG. 5 shows a flow diagram of a method for automatic insertion of files according to one embodiment of the application;
FIG. 6 is a schematic diagram showing a structure of an implementation apparatus for automatic file insertion according to an embodiment of the present application;
FIG. 7 is a schematic view showing the structure of an automatic document inserting apparatus according to one embodiment of the present application;
FIG. 8 shows a schematic structural diagram of a computer device according to one embodiment of the application;
fig. 9 shows a schematic structural diagram of a computer device according to another embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Currently, two tools, path Autocomplete and related Path, are commonly used in the industry to insert files during project development. The Path Autocomplete automatically prompts the next-level file directory for the user to select, and the manual input of the user is not needed; and the related Path calls a popup window through a shortcut key, so that a user inputs the name of the file, and after the file is selected, the Relative Path of the file is automatically reflected to a designated place.
Path Autocomplete it is cumbersome to remove the path that has been previously selected, and to select the designated file again.
The related Path requires the user to input the file name, which is inconvenient because the user needs to memorize the file name or copy the name of the designated file.
And both of the above plugins are not able to see the details of the selected file, and may be misplaced for a more similar file.
Fig. 1 is a flow chart illustrating a method for implementing automatic file insertion according to an embodiment of the present application, and as can be seen from fig. 1, the present application at least includes steps S110 to S140:
step S110: setting a file inserting operation command to pop up the file inserting function item at the current cursor position of the target item code.
The main conception of the application is that an inserting operation command is customized through a menu expansion function of a development framework of the plug-in development project, so that a file selection popup window is aroused, then after a user selects a file, a relative path address of the selected file is obtained, and finally, the relative path is inserted into a designated place by utilizing a function provided by the development framework of the plug-in development project, so that a target file is inserted into the current position of a cursor of a target project code.
The method for realizing automatic file insertion can be applied to scaffolds (software frameworks) for various software development, such as UVE, spring, vscode (which are scaffolds and have no unified Chinese name in the industry) and the like. Preferably, in some embodiments of the present application, the method for implementing automatic file insertion uses a vscode as a scaffold, and for convenience of description, the method uses the vscode as a scaffold.
The method for realizing automatic file insertion can form an independent tool, such as a business logic which is deployed in a code of a target project in a project plug-in mode to realize the method for realizing automatic file insertion.
Firstly, after a plug-in development project is newly built through a scaffold provided by a vscore authority, setting a file inserting operation command in the plug-in development project, for example, clicking a right mouse button, and after the file inserting operation command is triggered, popping up a file inserting function item at the current cursor position of a target project code.
Specifically, in some embodiments of the present application, in the above method, the setting a file insertion operation command to pop up a file insertion function item at a current cursor position of a target item code includes: and newly adding a attributes field in a package file of an insert development project of the vscore scaffold, and defining a designated operation as an insert operation command in the attributes field, wherein the file insert function item is popped up at the current cursor position when the insert operation command is triggered.
Namely, newly adding a control field in a package. Json file of a plug-in development project, defining a specified operation in the control field, for example, clicking a right mouse button as an inserting operation command, triggering the inserting operation command by clicking the right mouse button in the process of developing a target project, and popping up a file inserting function item at the current position of a cursor at the front end of a user, wherein the specified operation can be any operation, such as pressing an Alt+J key and the like, and is preferably different from the existing shortcut key and shortcut key combination.
Specifically, in the attributes field, the add-on item function may be defined by the command field under commands, which may be defined as "filepath-auto input. Select file" in some embodiments, and the name of the file insert function item is defined as "insert file" by the title field; the file insert function is then implemented by defining when, command, group fields under the editor/context under muenus, where the logic implemented by defining when, command, group fields is "pop-up file insert function when the user performs a specified operation". Fig. 2 is a schematic diagram showing the effect of the ejection of the file inserting function according to one embodiment of the present application, and as can be seen from fig. 2, when the user wants to insert a file during the development of the project code, the user can click on the right mouse button, and the file inserting function is included in the drop-down menu of the right button, which is named as "insert file" (indicated by arrow), and of course, other functions of the right button are included in the drop-down menu of the right button.
Step S120: and calling a file selection popup when the file inserting function item is triggered by using a dialogue opening function, and transmitting the absolute path of the target file selected by the user at the file selection popup to a file relative path acquisition function.
And defining a dialogue opening function to call a file selection popup when the user clicks the file insertion function item.
In some embodiments of the present application, the using a dialogue opening function, when the file inserting operation command is triggered, arouses a file selecting popup, and transfers an absolute path of a target file selected by a user at the file selecting popup to a file relative path acquiring function, including: setting a vscode window open dialog function in an extension/ts file of an insert development project of a vscode scaffold to call a file selection popup window when the file insertion function item is triggered, wherein the file selection popup window defines that only a single file can be selected; and after the vscode window open dialog function acquires the absolute path of the target file, transmitting the absolute path of the target file to a file relative path acquisition function. In extension.ts files, the file selection popup is evoked by the vscore.window.showopendialog function of the vscore scaffold itself, and only a single file is restricted to be selected. After a user selects one target file, the absolute path of the selected target file is automatically transferred to a self-defined file relative path acquisition function getpath.
The logic defined in the extension.ts file is: under the 'filepath-automatic input.select file', if the 'insert file' function item is clicked, popping up a 'file selection popup window', responding to the selection operation of a user on the 'file selection popup window', acquiring an absolute path of a target file, and if the acquisition fails, popping up a prompt, prompting the user that the absolute path of the target file cannot be acquired; if the acquisition is successful, the acquired absolute path of the target file is transferred to a file relative path acquisition function getrelated path. Fig. 3 is a schematic view showing the effect that the file selection popup window is evoked according to an embodiment of the present application, referring to fig. 2 and fig. 3, after the user clicks "insert file" on the interface shown in fig. 2, the interface shown in fig. 3 is displayed, and the location of the file selection popup window is the path of the current file. In the interface of fig. 3, the user may select files, and it should be noted here that one file can be selected at a time. After the user selects a target file, the absolute path of the target file is automatically transferred to the file relative path acquisition function getpath, and then step S130 is performed.
When a user selects a file, the user can select the file to be introduced in the file selection frame, the first-level selection directory is not needed to find the file, and meanwhile, if the user selects the file by mistake, the user directly returns to the file directory on the upper layer, and the code input before the user does not need to be input again.
Here, the process that the vscore.
Step S130: and determining the relative path of the target file according to the absolute path of the target file by using a file relative path acquisition function.
The file relative path acquisition function, which may be referred to as getpath, is a custom function that determines the relative path of the target file based on the absolute path of the target file.
Specifically, in some embodiments, the obtaining the function using the file relative path includes: setting a getrativepoth function in an extension.ts file of an insert development project of a vscode scaffold to acquire a first absolute path of the target file through the getrativepoth function; comparing the first absolute path of the target file with the second absolute path of the current file, and cutting off the same parts of the first absolute path and the second absolute path to obtain the relative path of the target file.
In the getrelated path function, the absolute path (denoted as a first absolute path) of the selected target file is compared with the absolute path (denoted as a second absolute path) of the file where the user is currently located, and finally the relative path of the selected target file relative to the current file of the user is obtained.
The absolute path is a path from the disk symbol, such as C \windows\systems 32\cmd.exe, the relative path is a path from the current path, and if the current path is C \windows, only the system32\cmd.exe is input or more strict relative path writing is performed, wherein, the current path is represented and can be omitted in the case of a channel.
The first absolute path of the target file is compared with the second absolute path of the current file, and the same parts of the first absolute path and the second absolute path are cut off to obtain the relative path of the target file. The user is also blind to this process.
Step S140: and inserting the relative path into the position of the current cursor by using an active file editing function.
Finally, the relative path value is inserted into the position of the cursor by using an active file editing function vscore.
In some embodiments, in the above method, the inserting the relative path to the current cursor position using an active file editing function includes: setting a vscore.window.activetexteditor.init function in a package.json file of a plug-in development project of the vscore scaffold, so as to write the relative path into the current cursor position of the editor through the vscore.window.activetexteditor.init function.
The logic defined in the vscode.window.activetexteditor.wait function is where the current cursor writing the relative path of the target file to the editor is located.
The user selects the file in the file selection popup window, and the point is opened, so that the relative path is automatically reflected to the position of the cursor. The effect is shown in fig. 4, fig. 4 shows an effect diagram of a file after the insertion of a relative path according to an embodiment of the present application, and as can be seen from fig. 4, the effect diagram shows the relative addresses of 3 target files inserted, and as can be seen from fig. 4, the target files inserted into the file can be in various formats, such as a PNG format, json format, html format, and so on. As can be seen from the implementation method of automatic file insertion shown in FIG. 1, the present application provides an implementation method of automatic file insertion, which pops up a file insertion function item by customizing an insertion operation command, and arouses a file selection popup window when the file insertion function item is triggered by using a dialogue opening function, then obtains a relative path address of a selected file relative to a current file by using a file relative path obtaining function after a user selects the file, and finally inserts the relative path to a designated place where a cursor is located by using an active file editing function. According to the method for realizing automatic file insertion, a user can select the file to be introduced in the file selection frame, the first-level and first-level selection directory is not needed to find the file, meanwhile, if the user selects the file by mistake, the user directly returns to the upper-layer file directory, and the code input before deletion is not needed to be input again; the file name does not need to be copied or memorized, and the method is simple and convenient; and the detailed information of the file can be seen when the file is selected, and the similar file is not easy to select wrong. The application obviously improves the convenience and accuracy of file insertion of developers in the software development process, and greatly improves the efficiency of software project development.
The business logic of the method for implementing automatic file insertion forms a tool, such as an plugin, for example, a vscore plugin formed under the condition that the vscore is a scaffold is deployed in a target project, and when a user develops the target project, the automatic file insertion can be implemented.
Step S510: and responding to a first starting operation of the user on the file inserting operation command at the current position of the cursor of the target project code, and popping up the file inserting function item.
When the user performs code development of a target item, if a file needs to be inserted, a cursor is placed at a place where the file needs to be inserted, and then a first starting operation is performed on a file insertion operation command, for example, a right click is performed, so that an interface shown in fig. 2 is displayed, namely, a right click pull-down menu is popped up, wherein the interface comprises a function item of "inserting a file".
Specifically, in some embodiments, under the vscore framework, the popping up the file insertion function item in response to the first start operation of the user on the file insertion operation command at the current position of the cursor of the target item code includes: and receiving and responding to a first starting operation of a user at the current cursor position of a target project code, calling an inserting operation command under a categories field in a package.json development file of a vscore plug-in of the target project, and popping up a file inserting function item.
I.e. the user executes a first starting operation at the current position of the cursor of the target project code, if clicking the right button, then the first starting operation is responded, an inserting operation command under the attributes field in the package. Json development file of the vscore plug-in is called, a right button drop-down menu is displayed, and a file inserting function item, i.e. an 'insert file' option in fig. 2, is displayed in the right button drop-down menu.
Step S520: based on a dialogue opening function, in response to a second starting operation of a user on the file inserting function item, a file selecting popup window is popped up, and in response to a file selecting operation of the user on the file selecting popup window, an absolute path of a target file indicated by the file selecting operation is transferred to a file relative path obtaining function.
The user performs a second start operation on the file insertion function item, that is, clicking the "insert file" function item in the right-click drop-down menu will pop up the file selection popup window, please refer to fig. 3.
Specifically, the step of popup file selection popup window based on the dialogue opening function in response to the second starting operation of the user on the file insertion function item comprises the following steps: and receiving and responding to a second starting operation of the user on the file inserting function item, and calling a vscore.window.showopendialog function in a vscore insert development file of the target item, wherein the file selecting popup defines a selectable single file.
After the user selects the target file in the file selection popup, the session opening function obtains the absolute path of the target file and passes to the file relative path obtaining function.
Step S530: and determining the relative path of the target file according to the absolute path of the target file based on a file relative path acquisition function.
After the absolute path of the target file is acquired by the file relative path acquisition function, determining the relative path of the target file according to the absolute path and the absolute path of the current file where the user is located.
Specifically, after receiving the first absolute path of the target file, the file relative path obtaining function determines the relative path of the target file according to the absolute path of the target file based on the file relative path obtaining function, including: calling a getrelated path function under a vscode plugin extension.ts development file of a target item, and receiving a first absolute path of the target file transferred by the dialogue opening function; comparing the first absolute path of the target file with the second absolute path of the current file, and cutting off the same parts of the first absolute path and the second absolute path to obtain the relative path of the target file.
Step S540: and inserting the relative path into the position of the current cursor based on an active file editing function.
Finally, the relative path is written to the current cursor position.
Specifically, in some embodiments, a vscore.window.active text editor.wait function under a package.json development file of a vscore plug-in of the target item may be invoked, and the relative path is written to the current cursor location of the scaffold.
As can be seen from the automatic file inserting method shown in FIG. 5, the user-defined inserting operation command of the application pops up the file inserting function item, and the dialogue opening function is utilized to call the file selecting popup window when the file inserting function item is triggered, then the file relative path obtaining function is utilized to obtain the relative path address of the selected file relative to the current file after the user selects the file, and finally the relative path is inserted into the appointed place where the cursor is located by utilizing the active file editing function. According to the method for realizing automatic file insertion, a user can select the file to be introduced in the file selection frame, the first-level and first-level selection directory is not needed to find the file, meanwhile, if the user selects the file by mistake, the user directly returns to the upper-layer file directory, and the code input before deletion is not needed to be input again; the file name does not need to be copied or memorized, and the method is simple and convenient; and the detailed information of the file can be seen when the file is selected, and the similar file is not easy to select wrong. The application obviously improves the convenience and accuracy of file insertion of developers in the software development process, and greatly improves the efficiency of software project development.
Fig. 6 shows a schematic structural diagram of an implementation apparatus for automatic file insertion according to an embodiment of the present application, and as can be seen from fig. 6, the implementation apparatus 600 for automatic file insertion includes:
a first setting unit 610, configured to set a file insertion operation command to pop up a file insertion function item at a position where a current cursor of the add-on development project code is located;
a second setting unit 620 for calling a file selection popup when the file insertion function item is triggered by using a session opening function, and transferring an absolute path of a target file selected by a user at the file selection popup to a file relative path acquisition function;
a third setting unit 630, configured to determine, using the file relative path acquisition function, a relative path of the target file according to an absolute path of the target file;
and a fourth setting unit 640, configured to insert the relative path into the current position of the cursor by using an active file editing function.
In some embodiments of the present application, in the above-mentioned device for implementing automatic file insertion, the method for implementing automatic file insertion uses a vscode as a scaffold and is deployed in a plug-in form in a target item.
In some embodiments of the present application, in the above-mentioned implementation apparatus for automatically inserting a file, the first setting unit 610 is configured to add a configuration field to a package. Json file of a plug-in development project of a vscore scaffold, and define a specified operation as an inserting operation command in the configuration field, where the inserting operation command pops up the file inserting function item at a location where the current cursor is located when triggered.
In some embodiments of the present application, in the above-mentioned implementation apparatus for automatic file insertion, the second setting unit 620 is configured to set a vscode. Window. Showopendialog function in an extension. Ts file of a plug-in development project of a vscode scaffold, so as to invoke a file selection popup when the file insertion function is triggered, where the file selection popup defines that only a single file can be selected; and after the vscode window open dialog function acquires the absolute path of the target file, transmitting the absolute path of the target file to a file relative path acquisition function.
In some embodiments of the present application, in the above-mentioned implementation apparatus for automatic file insertion, the third setting unit 630 is configured to set a getr_failed_path function in an extension_ts file of a plug-in development project of a vscode scaffold, so as to obtain a first absolute path of the target file through the getr_failed_path function; comparing the first absolute path of the target file with the second absolute path of the current file, and cutting off the same parts of the first absolute path and the second absolute path to obtain the relative path of the target file.
In some embodiments of the present application, in the above-mentioned implementation apparatus for automatic file insertion, the fourth setting unit 640 is configured to set a vscode, window, active text editor, and wait function in a package, json file of a plug-in development project of a vscode scaffold, so as to write the relative path to a current cursor location of an editor through the vscode, window, active text editor, and wait function.
It should be noted that, the above-mentioned implementation device 600 for automatic file insertion may implement the above-mentioned method for automatic file insertion, which is not described herein.
Fig. 7 shows a schematic structural view of an automatic document inserting apparatus according to an embodiment of the present application, and as can be seen from fig. 7, the automatic document inserting apparatus 700 includes:
a function item ejecting unit 710 for ejecting a file insertion function item in response to a first start operation of a file insertion operation command by a user at a current cursor position of a target item code;
a pop-up unit 720, configured to pop up a file selection pop-up in response to a second start operation of the file insertion function item by a user based on a session open function, and transfer an absolute path of a target file indicated by the file selection operation to a file relative path acquisition function in response to a file selection operation of the user at the file selection pop-up;
A path acquisition unit 730, configured to determine, based on the file relative path acquisition function, a relative path of the target file according to an absolute path of the target file;
and a path insertion unit 740, configured to insert the relative path to the current position of the cursor based on the active file editing function.
In some embodiments of the present application, in the above-mentioned automatic file inserting apparatus, the method for implementing automatic file insertion uses a vscode as a scaffold and is deployed in a plug-in form in a target item.
In some embodiments of the present application, in the above-mentioned automatic file inserting apparatus, the function item pop-up unit 710 is configured to receive and respond to a first start operation of a user at a current cursor location of a target item code, invoke an inserting operation command under a attributes field in a package.
In some embodiments of the present application, in the above-mentioned automatic file inserting apparatus, the popup unit 720 is configured to receive and respond to a second start operation of the file inserting function item by a user, call a vscode.window.showopendialog function in a vscode plug-in development file of the target item, and call a file selection popup, where the file selection popup defines a selectable single file; and after the vscode window open dialog function acquires the absolute path of the target file, transmitting the absolute path of the target file to a file relative path acquisition function.
In some embodiments of the present application, in the above-mentioned automatic file inserting apparatus, the path obtaining unit 730 is configured to call a getr device function under an extension.ts development file of a vscode plug-in of the target item, and receive a first absolute path of the target file transferred by the session opening function; comparing the first absolute path of the target file with the second absolute path of the current file, and cutting off the same parts of the first absolute path and the second absolute path to obtain the relative path of the target file.
In some embodiments of the present application, in the above-mentioned automatic file inserting apparatus, the path inserting unit 740 is configured to call a vscore/window/activetexteditor/edit function under a package/json development file of a vscore plug-in of the target item, and write the relative path to a current cursor location of the scaffold.
It should be noted that the automatic file inserting apparatus 700 may implement the automatic file inserting method, which is not described herein.
Fig. 8 shows a schematic structural diagram of a computer device according to an embodiment of the present application, and according to fig. 8, the internal structure of the computer device may include a processor, a memory, a network interface, and a database connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes non-volatile and/or volatile storage media and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is for communicating with an external client via a network connection. The computer program, when executed by a processor, is executed by a function or step of a service side of an implementation method of automatic file insertion or an automatic file insertion method.
In one embodiment, the computer device provided by the application comprises a memory and a processor, wherein the memory stores a database and a computer program capable of running on the processor, and the processor executes the computer program to realize the function or the step of the method for realizing the automatic file insertion or the method for realizing the automatic file insertion.
In one embodiment, a computer device is also provided, which may be a user side, and the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is for communicating with an external server via a network connection. The computer program, when executed by a processor, performs the functions or steps of a method for implementing automatic insertion of a file or a method for automatic insertion of a file.
In one embodiment, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method for implementing the automatic insertion of a file or the functions or steps of the method for automatic insertion of a file in the present application.
It should be noted that, the functions or steps that can be implemented by the computer device or the computer readable storage medium may correspond to the descriptions of the service side and the user side in the foregoing method embodiments, and are not described herein one by one for avoiding repetition.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (16)

1. The method for realizing automatic file insertion is characterized by comprising the following steps:
setting a file insertion operation command to pop up a file insertion function item at the current cursor position of the target item code;
Using a dialogue opening function, calling a file selection popup when the file insertion function item is triggered, and transmitting an absolute path of a target file selected by a user in the file selection popup to a file relative path acquisition function;
determining the relative path of the target file according to the absolute path of the target file by using the file relative path acquisition function;
and inserting the relative path into the position of the current cursor by using an active file editing function.
2. The method for automatically inserting files according to claim 1, wherein the method for automatically inserting files is implemented by taking a vscode as a scaffold and deploying the scaffold in a plug-in mode in a target project.
3. The method for implementing automatic file insertion according to claim 2, wherein the setting the file insertion operation command to pop up the file insertion function item at the current cursor position of the target item code comprises:
and newly adding a attributes field in a package file of an insert development project of the vscore scaffold, and defining a designated operation as an insert operation command in the attributes field, wherein the file insert function item is popped up at the current cursor position when the insert operation command is triggered.
4. The method for implementing automatic file insertion according to claim 2, wherein the using a session open function to call up a file selection popup when the file insertion operation command is triggered, and passing the absolute path of the target file selected by the user at the file selection popup to a file relative path acquisition function comprises:
setting a vscode window open dialog function in an extension/ts file of an insert development project of a vscode scaffold to call a file selection popup window when the file insertion function item is triggered, wherein the file selection popup window defines that only a single file can be selected;
and after the vscode window open dialog function acquires the absolute path of the target file, transmitting the absolute path of the target file to a file relative path acquisition function.
5. The method according to claim 2, wherein determining the relative path of the target file according to the absolute path of the target file using the file relative path acquisition function comprises:
setting a getrativepoth function in an extension.ts file of an insert development project of a vscode scaffold to acquire a first absolute path of the target file through the getrativepoth function;
Comparing the first absolute path of the target file with the second absolute path of the current file, and cutting off the same parts of the first absolute path and the second absolute path to obtain the relative path of the target file.
6. The method for implementing automatic file insertion according to claim 2, wherein the inserting the relative path to the current cursor position using an active file editing function includes:
setting a vscore.window.activetexteditor.init function in a package.json file of a plug-in development project of the vscore scaffold, so as to write the relative path into the current cursor position of the editor through the vscore.window.activetexteditor.init function.
7. An automatic file insertion method, characterized in that the automatic file insertion method comprises the steps of:
responding to a first starting operation of a user on a file inserting operation command at the current position of a cursor of a target project code, and popping up a file inserting function item;
based on a dialogue opening function, responding to a second starting operation of a user on the file inserting function item, popping up a file selecting popup window, responding to a file selecting operation of the user on the file selecting popup window, and transmitting an absolute path of a target file indicated by the file selecting operation to a file relative path obtaining function;
Determining the relative path of the target file according to the absolute path of the target file based on a file relative path acquisition function;
and inserting the relative path into the position of the current cursor based on an active file editing function.
8. The automatic file inserting method according to claim 7, wherein the automatic file inserting method is implemented by taking a vscode as a scaffold and arranging the scaffold in a target project in a plug-in mode.
9. The method of claim 8, wherein the ejecting the file insertion function item in response to a first start operation of the file insertion operation command by the user at the current cursor position of the target item code comprises:
and receiving and responding to a first starting operation of a user at the current cursor position of a target project code, calling an inserting operation command under a categories field in a package.json development file of a vscore plug-in of the target project, and popping up a file inserting function item.
10. The method according to claim 8, wherein the step of ejecting a file selection popup in response to a second start operation of the file insertion function item by a user based on the session opening function, and transferring an absolute path of a target file indicated by the file selection operation to a file relative path acquisition function in response to a file selection operation of the user at the file selection popup, comprises:
Receiving and responding to a second starting operation of a user on the file inserting function item, and calling a vscore.window.showopendialog function in a vscore plug-in extension.ts development file of the target item, and calling a file selecting popup, wherein the file selecting popup defines a selectable single file;
and after the vscode window open dialog function acquires the absolute path of the target file, transmitting the absolute path of the target file to a file relative path acquisition function.
11. The method of automatic document insertion according to claim 8, wherein the determining the relative path of the target document from the absolute path of the target document based on the document relative path acquisition function includes:
calling a getrelated path function under an extension.ts development file of a vscode plug-in of the target item, and receiving a first absolute path of the target file transferred by the dialogue opening function;
comparing the first absolute path of the target file with the second absolute path of the current file, and cutting off the same parts of the first absolute path and the second absolute path to obtain the relative path of the target file.
12. The method for automatically inserting files according to claim 8, wherein inserting the relative path to the current cursor position based on the active file editing function comprises:
and calling a vscore.window.activetexteditor.edit function under a package.json development file of the vscore plug-in of the target item, and writing the relative path into the current position of the cursor of the scaffold.
13. An implementation device for automatically inserting a file, which is characterized in that the implementation device for automatically inserting the file comprises:
a first setting unit for setting a file insertion operation command to pop up a file insertion function item at a current cursor position of a target item code;
a second setting unit, configured to call a file selection popup when the file insertion function item is triggered by using a session opening function, and transfer an absolute path of a target file selected by a user at the file selection popup to a file relative path acquisition function;
a third setting unit, configured to determine a relative path of the target file according to an absolute path of the target file by using the file relative path acquisition function;
and the fourth setting unit is used for inserting the relative path into the position of the current cursor by using an active file editing function.
14. An automatic document insertion apparatus, characterized in that the automatic document insertion apparatus includes:
a function item ejecting unit for ejecting a file insertion function item in response to a first start operation of a user on a file insertion operation command at a current cursor position of a target item code;
a popup unit for popup the file selection popup in response to the second start operation of the user on the file insertion function item based on the dialogue opening function, and transmitting the absolute path of the target file indicated by the file selection operation to a file relative path acquisition function in response to the file selection operation of the user on the file selection popup;
a path acquisition unit, configured to determine a relative path of the target file according to an absolute path of the target file based on the file relative path acquisition function;
and the path insertion unit is used for inserting the relative path into the position of the current cursor based on the active file editing function.
15. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims 1-6 or any one of claims 7-12 when the computer program is executed.
16. A computer readable storage medium storing a computer program, characterized in that the computer program when instructed by a processor implements the method of any one of claims 1-6 or any one of claims 7-12.
CN202310557962.6A 2023-05-18 2023-05-18 Method for realizing automatic file insertion and automatic file insertion method Active CN116301471B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310557962.6A CN116301471B (en) 2023-05-18 2023-05-18 Method for realizing automatic file insertion and automatic file insertion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310557962.6A CN116301471B (en) 2023-05-18 2023-05-18 Method for realizing automatic file insertion and automatic file insertion method

Publications (2)

Publication Number Publication Date
CN116301471A CN116301471A (en) 2023-06-23
CN116301471B true CN116301471B (en) 2023-09-01

Family

ID=86792783

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310557962.6A Active CN116301471B (en) 2023-05-18 2023-05-18 Method for realizing automatic file insertion and automatic file insertion method

Country Status (1)

Country Link
CN (1) CN116301471B (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101241466A (en) * 2007-02-08 2008-08-13 深圳迈瑞生物医疗电子股份有限公司 Embedded software test method and system
CN103064752A (en) * 2011-09-27 2013-04-24 奇智软件(北京)有限公司 Method and device of repairing document
CN103399812A (en) * 2013-07-22 2013-11-20 西安电子科技大学 Magnetic disc file operation monitoring system and monitoring method based on Xen hardware virtualization
KR20140011495A (en) * 2012-06-07 2014-01-29 주식회사 케이티 Conversion device, conversion method and user terminal
CN106776687A (en) * 2016-11-10 2017-05-31 国云科技股份有限公司 The preparation method that a kind of webpage picks up color device
CN106814938A (en) * 2016-12-26 2017-06-09 深圳云创享网络有限公司 Threedimensional model file imports control method and client
CN111104377A (en) * 2018-10-26 2020-05-05 伊姆西Ip控股有限责任公司 File management method, electronic device and computer-readable storage medium
CN112364580A (en) * 2020-11-13 2021-02-12 上海兆芯集成电路有限公司 Method and device for automatically inserting specific code into register transmission level design file
CN113239672A (en) * 2021-05-18 2021-08-10 北京京东振世信息技术有限公司 Target file editing method and device, electronic equipment and storage medium
CN113392346A (en) * 2021-06-16 2021-09-14 北京豆萌信息技术有限公司 Path processing method and device for resource file, electronic equipment and storage medium
CN114463045A (en) * 2021-12-31 2022-05-10 深圳市东信时代信息技术有限公司 Material file uploading method, device, equipment and storage medium
CN114996126A (en) * 2022-05-17 2022-09-02 电子科技大学 Vulnerability detection method and system for EOSIO intelligent contract
CN115202642A (en) * 2022-06-27 2022-10-18 麒麟软件有限公司 VSCode integrated development environment Shell-based intelligent editing method and plug-in tool
CN115454785A (en) * 2022-08-19 2022-12-09 麒麟软件有限公司 VScode-based graphical real-time monitoring and management method for host performance

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8635591B2 (en) * 2008-12-18 2014-01-21 International Business Machines Corporation Embedding software developer comments in source code of computer programs
IL269897B2 (en) * 2018-11-15 2023-08-01 Sternum Ltd Applying control flow integrity verification in intermediate code files

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101241466A (en) * 2007-02-08 2008-08-13 深圳迈瑞生物医疗电子股份有限公司 Embedded software test method and system
CN103064752A (en) * 2011-09-27 2013-04-24 奇智软件(北京)有限公司 Method and device of repairing document
KR20140011495A (en) * 2012-06-07 2014-01-29 주식회사 케이티 Conversion device, conversion method and user terminal
CN103399812A (en) * 2013-07-22 2013-11-20 西安电子科技大学 Magnetic disc file operation monitoring system and monitoring method based on Xen hardware virtualization
CN106776687A (en) * 2016-11-10 2017-05-31 国云科技股份有限公司 The preparation method that a kind of webpage picks up color device
CN106814938A (en) * 2016-12-26 2017-06-09 深圳云创享网络有限公司 Threedimensional model file imports control method and client
CN111104377A (en) * 2018-10-26 2020-05-05 伊姆西Ip控股有限责任公司 File management method, electronic device and computer-readable storage medium
CN112364580A (en) * 2020-11-13 2021-02-12 上海兆芯集成电路有限公司 Method and device for automatically inserting specific code into register transmission level design file
CN113239672A (en) * 2021-05-18 2021-08-10 北京京东振世信息技术有限公司 Target file editing method and device, electronic equipment and storage medium
CN113392346A (en) * 2021-06-16 2021-09-14 北京豆萌信息技术有限公司 Path processing method and device for resource file, electronic equipment and storage medium
CN114463045A (en) * 2021-12-31 2022-05-10 深圳市东信时代信息技术有限公司 Material file uploading method, device, equipment and storage medium
CN114996126A (en) * 2022-05-17 2022-09-02 电子科技大学 Vulnerability detection method and system for EOSIO intelligent contract
CN115202642A (en) * 2022-06-27 2022-10-18 麒麟软件有限公司 VSCode integrated development environment Shell-based intelligent editing method and plug-in tool
CN115454785A (en) * 2022-08-19 2022-12-09 麒麟软件有限公司 VScode-based graphical real-time monitoring and management method for host performance

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
authorware 巧妙调用flash技巧详解;查德清;《中国教育信息化》(第第12期期);第62页第1段-第63页倒数第1段 *

Also Published As

Publication number Publication date
CN116301471A (en) 2023-06-23

Similar Documents

Publication Publication Date Title
US6968509B1 (en) Recording of user-driven events within a computer application
JP3444471B2 (en) Form creation method and apparatus readable storage medium for causing digital processing device to execute form creation method
RU2349952C2 (en) Method of file replication management in applications
US20030164855A1 (en) Content management system
US7454660B1 (en) System and method for testing applications at the business layer
US7778968B2 (en) Systems and methods for compiling applications on a test server
US20060101404A1 (en) Automated system for tresting a web application
US20090132919A1 (en) Appending Hover Help to Hover Help for a User Interface
US20070288850A1 (en) Application sharing
JP2010504591A (en) Common component framework
CN110955428A (en) Page display method and device, electronic equipment and medium
EP2340494A2 (en) One-click sharing for screenshots and related documents
KR20080041234A (en) Command user interface for displaying selectable functionality controls in a database application
JPH1165795A (en) Information processor and method for activating program in the same device
US6978218B1 (en) System and method for testing applications at the presentation layer
CN110659197B (en) Application test case generation method and device and software test system
US20090132937A1 (en) Modifying Hover Help for a User Interface
CN112445994A (en) Method for carrying out automatic operation in opened Chrome browser
CN112988605A (en) Method and device for realizing WEB application automatic test
JP2008529160A (en) How to automate the management of resources in computer applications
CN106815010B (en) Method and device for operating database
CN116301471B (en) Method for realizing automatic file insertion and automatic file insertion method
JP3348430B2 (en) Automatic environment setting method of preinstalled application and storage medium
CN113590564B (en) Data storage method, device, electronic equipment and storage medium
WO2018040439A1 (en) Document processing method and apparatus

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
GR01 Patent grant
GR01 Patent grant