CN-121996218-A - Data preview processing method and device
Abstract
The invention discloses a data preview processing method and device, and relates to the technical field of computers. The method comprises the steps of responding to selection operation of a target item, opening a code of the target item by using a preset plug-in, monitoring the current hovering position of a cursor, determining a code row, obtaining each character string in the code row, responding to the existence of each character string in a preset mapping table, determining that each character string is a variable name, obtaining variable configuration data corresponding to each character string from the preset mapping table, creating a preview window for each character string, adding the variable configuration data to the preview window, responding to the hovering position of the cursor for each character string, displaying the preview window corresponding to each character string, and displaying the variable configuration data through the preview window. According to the embodiment, a developer can clearly check and compare variable value data in different configuration files in the same interface, quickly identify configuration differences, and improve the efficiency and accuracy of configuration management.
Inventors
- PENG BO
- LI SONG
- WANG MINGXIN
Assignees
- 北京京东远升科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241107
Claims (10)
- 1. A data preview processing method, comprising: responding to the selection operation of the target item, opening the code of the target item by using a preset plug-in, and monitoring the current hovering position of the cursor to determine the code row where the current hovering position of the cursor is located; Acquiring each character string in a code line, and determining each character string as a variable name in response to the existence of each character string in a preset mapping table; Obtaining variable configuration data corresponding to each character string from a preset mapping table, creating a preview window for each character string, and adding the variable configuration data to the preview window; And responding to the cursor hovering position for each character string, displaying a preview window corresponding to each character string, and displaying the variable configuration data through the preview window.
- 2. The method of claim 1, wherein prior to the listening for the current hover position of the cursor, the method further comprises: the method comprises the steps of locally reading screening information configured for a preset plug-in advance, and scanning a catalog of target items and configuration files under the catalog to determine a target configuration file set conforming to the screening information; analyzing each target configuration file in the target configuration file set to obtain variable name and variable value data; and generating variable configuration data based on the variable name, the variable value data and the file path of the target configuration file, and storing the variable configuration data into a preset mapping table.
- 3. The method of claim 2, wherein the screening information includes one or more of a prefix name, a suffix name, an extension, a scan-prohibited directory, and wherein the determining a set of target profiles that meet the screening information includes one or more of: screening a target configuration file with a file name comprising a prefix name; screening a target configuration file with a file name comprising a suffix name; Screening a target configuration file with a file name comprising an extension; Target configuration files under other directories than the scan-prohibited directory are determined.
- 4. The method of claim 2, wherein generating variable configuration data based on the variable name, variable value data, and a file path of the target configuration file comprises: the file path of the target configuration file is used as a key name, the variable value data is used as a key value, and the variable value data and the file path of the target configuration file are associated to obtain associated data; and integrating the associated data corresponding to the same variable name, and generating variable configuration data by taking the same variable name as a key name and the integrated associated data as a key value.
- 5. The method of claim 1 or 2, wherein the variable configuration data comprises a variable name, variable value data, and a file path of a configuration file; The adding the variable configuration data to a preview window includes: acquiring a file name corresponding to a file path of the configuration file, and taking the file path as a hyperlink of the file name; and adding the file name as a key name and variable value data as a key value into the preview window.
- 6. The method of claim 5, wherein after the exposing the variable configuration data through a preview window, the method further comprises: In response to a selection operation of one file name in the variable configuration data, a file path is determined through a hyperlink of the one file name to access a configuration file located under the file path.
- 7. A data preview processing apparatus, comprising: The code line module is used for responding to the selection operation of the target item, opening the code of the target item by using a preset plug-in, and monitoring the current hovering position of the cursor so as to determine the code line where the current hovering position of the cursor is located; the variable name module is used for acquiring each character string in the code line, and determining that each character string is a variable name in response to the existence of each character string in a preset mapping table; The preview window module is used for acquiring variable configuration data corresponding to each character string from a preset mapping table, creating a preview window for each character string and adding the variable configuration data to the preview window; and the display module is used for responding to the cursor hovering position to display a preview window corresponding to each character string so as to display the variable configuration data through the preview window.
- 8. An electronic device, comprising: One or more processors; Storage means for storing one or more programs, When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-6.
- 9. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
- 10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-6.
Description
Data preview processing method and device Technical Field The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing data preview. Background In current front-end development dotenv is a common tool that allows a developer to manage different variables through a configuration file so that the developer can directly reference these variable names in code, thereby achieving isolation of the configuration. However, using these variable names directly in the code may reduce the readability of the code and increase the risk of errors. To solve this problem, the VS Code (full Visual Studio Code) plug-in dotenv-vscode can be used, so that the management and application of variables are more efficient, and the development experience is improved. In the process of realizing the invention, the inventor finds that the prior art has some limitations that the plug-in only supports the data preview of the default configuration file, and the variable differences in a plurality of configuration files cannot be displayed and compared at the same time, so that the method is not convenient enough in a plurality of projects, and the development efficiency of developers is influenced. Disclosure of Invention In view of this, the embodiments of the present invention provide a method and an apparatus for processing data preview, which at least can solve the problem in the prior art that a plug-in cannot simultaneously display and compare variable differences in a plurality of configuration files. To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data preview processing method including: responding to the selection operation of the target item, opening the code of the target item by using a preset plug-in, and monitoring the current hovering position of the cursor to determine the code row where the current hovering position of the cursor is located; Acquiring each character string in a code line, and determining each character string as a variable name in response to the existence of each character string in a preset mapping table; Obtaining variable configuration data corresponding to each character string from a preset mapping table, creating a preview window for each character string, and adding the variable configuration data to the preview window; And responding to the cursor hovering position for each character string, displaying a preview window corresponding to each character string, and displaying the variable configuration data through the preview window. Optionally, before the monitoring the current hovering position of the cursor, the method further comprises: the method comprises the steps of locally reading screening information configured for a preset plug-in advance, and scanning a catalog of target items and configuration files under the catalog to determine a target configuration file set conforming to the screening information; analyzing each target configuration file in the target configuration file set to obtain variable name and variable value data; and generating variable configuration data based on the variable name, the variable value data and the file path of the target configuration file, and storing the variable configuration data into a preset mapping table. Optionally, the filtering information includes one or more of prefix name, suffix name, extension name and forbidden scan directory, and the determining the target configuration file set conforming to the filtering information includes one or more of the following: screening a target configuration file with a file name comprising a prefix name; screening a target configuration file with a file name comprising a suffix name; Screening a target configuration file with a file name comprising an extension; Target configuration files under other directories than the scan-prohibited directory are determined. Optionally, the generating variable configuration data based on the variable name, the variable value data and the file path of the target configuration file includes: the file path of the target configuration file is used as a key name, the variable value data is used as a key value, and the variable value data and the file path of the target configuration file are associated to obtain associated data; and integrating the associated data corresponding to the same variable name, and generating variable configuration data by taking the same variable name as a key name and the integrated associated data as a key value. Optionally, the variable configuration data includes a variable name, variable value data and a file path of a configuration file; The adding the variable configuration data to a preview window includes: acquiring a file name corresponding to a file path of the configuration file, and taking the file path as a hyperlink of the file name; and adding the file name as a key name and variable value data a