Associated component retrieval method and device, equipment, storage medium and program product
By reading and traversing component files in the code editor, filtering out associated components with reference relationships with the target component, it solves the problem of widespread impact on module component modification in Vue.js development, improving the accuracy of retrieval and the developer's User experience.
Patent Information
- Application Number
- CN202411517096.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-07
AI Technical Summary
In the front-end development of the Vue.js framework, modifying the interface of a module component may have an impact on the entire project. The existing method manually enters the module component name to search the associated components, resulting in low search accuracy and easy to be realistic A case where a reference but not retrieved or is not actually referenced but retrieved.
Provides a search method for associated components. By displaying the search menu control on the target interface of the code editor, reading the code file of the target component, and traversing the component files in the project, filtering out the associated components that have a reference relationship with the target component. , displayed on the interface.
Improve the retrieval accuracy of associated components, avoid mis-checking and missed detection problems caused by relying solely on component name matching, and enhance the convenience of code modification and debugging.
Smart Images

Figure CN119271193A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular, relates to a method, device, equipment, storage medium and program product for retrieving an associated component. Background Art
[0002] In front-end development, especially when using the Vue.js framework, modular programming can improve code reusability and maintainability. However, as the project scale expands and the functions increase, modifying the interface of a module component may affect the entire project. Therefore, it is crucial to promptly understand all places where the modified module components are used.
[0003] In the existing method, the name of the modified module component is usually manually input by a human, and then all associated components that reference the name of the modified module component are searched according to the name of the modified module component.
[0004] However, matching only by the name of the modified module component may easily result in situations where the component is actually referenced but not retrieved, or is retrieved but not actually referenced, resulting in low retrieval accuracy. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, device, storage medium and program product for searching an associated component, which can improve the accuracy of the search.
[0006] In one aspect of an embodiment of the present application, a method for retrieving an associated component is provided, the method comprising:
[0007] Displaying a target interface of a code editor, the target interface including a search menu control;
[0008] In response to a triggering operation on a search menu control, a first code file of a target component is read from a target interface of a code editor;
[0009] Traversing the second code files of each component in the target project, and screening out the associated components that match the first code files of the target component from the components of the target project, wherein the target project is used to represent the application development project or web page development project to which the target component belongs, and the associated components are used to represent the components that have a reference relationship with the target component;
[0010] Display the associated components corresponding to the target component.
[0011] In one aspect of an embodiment of the present application, a device for retrieving an associated component is provided, the device comprising:
[0012] An interface display module, used for displaying a target interface of the code editor, wherein the target interface includes a search menu control;
[0013] A file reading module, configured to read a first code file of a target component from a target interface of a code editor in response to a triggering operation on a search menu control;
[0014] A component screening module, used to traverse the second code files of each component in the target project, and screen the associated components that match the first code files of the target component from the components of the target project, wherein the target project is used to represent the application development project or web page development project to which the target component belongs, and the associated components are used to represent the components that have a reference relationship with the target component;
[0015] The component display module is used to display the associated components corresponding to the target component.
[0016] In one aspect of an embodiment of the present application, an electronic device is provided, which includes: a memory and a program or instruction stored in the memory and executable on a processor, wherein when the program or instruction is executed by the processor, a method for retrieving associated components as provided in any aspect of the above-mentioned embodiment of the present application is implemented.
[0017] In one aspect of an embodiment of the present application, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, a method for retrieving an associated component provided in any aspect of the above-mentioned embodiment of the present application is implemented.
[0018] According to one aspect of an embodiment of the present application, a computer program product is provided. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method for retrieving associated components as provided in any aspect of the embodiment of the present application described above.
[0019] In the retrieval method of the associated component provided by the embodiment of the present application, the target interface of the code editor is displayed, and the target interface includes a retrieval menu control. When the retrieval menu control is triggered, the first code file of the target component is directly read from the target interface of the code editor. Then the second code files of each component in the target project are traversed, so as to screen and obtain the associated components that match the first code file of the target component. In this way, the embodiment of the present application automatically obtains and reads the first code file of the target component by triggering the retrieval menu control. The first code file of the target component is used as the matching condition, so as to obtain the associated components that match the first code file of the target component. It avoids the situation that only the name of the component is used as the matching condition, which is easy to appear in the actual reference but not retrieved and the situation that it is retrieved but not actually referenced, thereby improving the accuracy of the retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] Figure 1 It is a flowchart of a first method for retrieving an associated component provided in an embodiment of the present application;
[0022] Figure 2 is a schematic diagram of associated components provided in an embodiment of the present application;
[0023] Figure 3 It is a flowchart of a second method for retrieving an associated component provided in an embodiment of the present application;
[0024] Figure 4 It is a flowchart of a third method for retrieving an associated component provided in an embodiment of the present application;
[0025] Figure 5 It is a structural schematic diagram of a retrieval device for an associated component provided in an embodiment of the present application;
[0026] Figure 6 It is a structural diagram of a retrieval device for an associated component provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The features and exemplary embodiments of each aspect of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0028] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0029] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations.
[0030] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0031] In the existing method, the name of the modified module component is usually manually input, and then all associated components that reference the name of the modified module component are searched according to the name of the modified module component. However, matching only by the name of the modified module component is prone to the situation that the actual reference is not retrieved or the retrieved but not actually referenced, resulting in low retrieval accuracy.
[0032] The purpose of the present application is to provide a retrieval method, device, equipment, storage medium and program product of an associated component. In the retrieval method of the associated component provided by the embodiment of the present application, the target interface of the code editor is displayed, and the target interface includes a retrieval menu control. When the retrieval menu control is triggered, the first code file of the target component is directly read from the target interface of the code editor. Then the second code files of each component in the target project are traversed, so as to screen and obtain the associated components that match the first code file of the target component. In this way, the embodiment of the present application automatically obtains and reads the first code file of the target component by triggering the retrieval menu control. The first code file of the target component is used as a matching condition, so as to obtain the associated components that match the first code file of the target component. It avoids the situation that only the name of the component is used as the matching condition, which is easy to appear in the actual reference but not retrieved and the situation that it is retrieved but not actually referenced, thereby improving the accuracy of the retrieval.
[0033] The following describes specific embodiments of the associated component retrieval method, device, equipment, storage medium, and program product provided in the embodiments of the present application.
[0034] First, a specific embodiment of the method for retrieving an associated component provided by the embodiment of the present application is introduced. Figure 1 As shown, a flowchart of a method for retrieving an associated component is provided. The method for retrieving an associated component can be applied to a server, and the method for retrieving an associated component can include the following S101 to S104.
[0035] S101, displaying a target interface of a code editor, wherein the target interface includes a search menu control.
[0036] In this embodiment, the target interface of the code editor is an interface for developers to edit and manage code. For example, the code editor can be a Visual Studio code editor (Visual Studio Code, VScode), and users can expand software functions by using VScode to integrate plug-ins.
[0037] The search menu control is a function button or menu on the target interface, which is used to trigger the associated component search operation of the target component. For example, if it is not triggered, it is always in the monitoring state of the target interface of the code editor.
[0038] S102: In response to a triggering operation on a search menu control, a first code file of a target component is read from a target interface of a code editor.
[0039] In this embodiment, the trigger operation is used to represent the operation of a user interacting with a control on the target interface to activate the corresponding function or behavior of the control. For example, the trigger operation can be a click operation, a double-click operation, or an input operation.
[0040] The first code file is used to represent a file that records the code implementation of the target component and related information.
[0041] As an example, when a user clicks or selects a search menu control, the server responds to the trigger operation and reads the first code file of the target component being edited or displayed in the current target interface from the target interface of the code editor.
[0042] S103, traverse the second code files of each component in the target project, and filter out associated components that match the first code files of the target component from the components of the target project. The target project is used to represent the application development project or web page development project to which the target component belongs, and the associated components are used to represent components that have a reference relationship with the target component.
[0043] In this embodiment, the second code file is used to represent a file that records code implementations of other components and related information.
[0044] The target project refers to the application development project or web development project to which the target component belongs. A development project will contain multiple modular components, and there will be corresponding reference and reference relationships between the components.
[0045] The associated component is used to represent other components that have a reference or referenced relationship with the target component. The associated component can be other components that reference the target component or other components that are referenced by the target component.
[0046] For example, Figure 2 As shown, a schematic diagram of associated components is provided. The target project includes five components, namely, component A, component B, component C, component D, and target component. Component A, component B, and component D all reference the target component, while component C neither references the target component nor is referenced by the target component, that is, component A, component B, and component D are associated components of the target component.
[0047] As an example, the server will traverse the second code files of all components in the entire target project of the code editor. By comparing the contents of the first code file and the second code file, the server can filter out the associated components that have a reference relationship with the target component.
[0048] S104, displaying the associated components corresponding to the target component.
[0049] In this embodiment, after filtering out the associated components, the server displays the information of these associated components in an easy-to-understand manner (such as a list or a tree diagram, etc.) on the target interface of the code editor.
[0050] In this way, developers can intuitively see other components associated with the target component, making it easier to modify and debug the code.
[0051] Through this embodiment, the target interface of the code editor is displayed, and the target interface includes a search menu control. When the search menu control is triggered, the first code file of the target component is directly read from the target interface of the code editor. Then the second code files of each component in the target project are traversed, so as to filter out the associated components that match the first code file of the target component. In this way, the embodiment of the present application automatically obtains the first code file of the target component by triggering the search menu control. The first code file of the target component is used as the matching condition, so as to obtain the associated components that match the first code file of the target component. It avoids the situation that only the name of the component is used as the matching condition, which is easy to appear in the actual reference but not retrieved, and the situation that it is retrieved but not actually referenced, thereby improving the accuracy of the retrieval.
[0052] As an optional embodiment, before S101, the method for retrieving the associated component may further include:
[0053] According to the preset action type corresponding to the retrieval menu control, an instance object is generated on the code editor;
[0054] Calling the application programming interface of the instance object to generate a preset control on the target interface of the code editor;
[0055] Bind the preset control to the search execution command of the code editor to obtain the search menu control.
[0056] In this embodiment, the preset action type is used to represent the corresponding action type predefined according to the purpose and function of the search menu control. For example, the preset action type may include but is not limited to: text search, code snippet search, regular expression search, etc. Each action type corresponds to a set of specific search parameters and display styles.
[0057] An instance object is used to refer to a specific object entity, which can be a specific instance of a class, function, module, etc. created according to the corresponding definition. The instance object contains the properties and methods required to implement the corresponding function.
[0058] As an example, the server creates an instance object of a search menu control in the code editor according to the selected preset action type. This instance object will contain the properties and methods required to implement the search function.
[0059] Then, the server generates a preset control on the target interface of the code editor by calling the application programming interface (Application Programming Interface, API) of the instance object. This preset control can be a drop-down menu, a text box or a button, etc. The specific form depends on the requirements of the preset function type.
[0060] Then, the generated preset control is bound to the search execution command of the code editor to obtain a search menu control. In this way, when the user interacts with the search menu control (such as clicking a button or inputting text), the corresponding search execution command will be triggered to execute the preset search operation.
[0061] Finally, after completing the above steps, the search menu control will be displayed on the target interface of the code editor. Users can perform search operations and view search results by interacting with the search menu control.
[0062] Through this embodiment, a flexible and extensible search function is realized by defining a preset action type, generating an instance object, calling an API to generate a preset control, and binding a search execution command. In this way, not only the search efficiency of the code editor can be improved, but also the developer's experience can be improved.
[0063] As an optional embodiment, Figure 3 As shown, before S103, the retrieval method of the associated component may also include the following S301-S302:
[0064] S301, when cache component information corresponding to the target component exists in the cache, filter out the modified components in the cache component information according to the second code files of each component and the cache component information, wherein the cache component information includes each historical associated component corresponding to the target component obtained in the historical stage;
[0065] S302, determining a component search scope of a target component according to each modified component;
[0066] S103 may specifically include:
[0067] Traversing the second code files of each modified component in the component search range, screening out associated components matching the first code file of the target component from each modified component, and forming a search result list;
[0068] S104 may specifically include:
[0069] Display all unmodified components except the modified components in the search result list and cache component information.
[0070] In this embodiment, the cache component information includes detailed information of the target component and its corresponding historical associated components in the historical stage, which may specifically include the name, version number, cache time, etc. of the component.
[0071] The modified component is used to represent a component that has been modified and updated relative to the historical associated component stored in the cache component information.
[0072] As an example, the server first checks whether there is cache component information corresponding to the target component in the cache.
[0073] If the cache component information of the target component exists in the cache, the server further compares the version number of the historically associated component in the cache component information with the version number corresponding to the current second code file of each component, thereby identifying the modified components that have been modified in the cache component information and the unmodified components that have not been modified.
[0074] Then, the components of the target project, except for the unmodified components corresponding to the cached component information, constitute the component search scope of the target component. The server will traverse the second code files of each component in the component search scope. By comparing the contents of the first code file and the second code file, the server can filter out the associated components that have a reference relationship with the target component to form a search result list.
[0075] Finally, the search result list and cached component information of all unmodified components except the modified components are displayed, so that developers can intuitively see other components associated with the target component, making it easier to modify and debug the code.
[0076] Through this embodiment, by using cached component information, it is possible to more quickly determine which components have been modified, so that only the component search scope of the target component needs to be formed according to the modified components. It is not necessary to search all components of the target project, thereby reducing unnecessary comparison and search operations and improving search efficiency.
[0077] As an optional embodiment, S301 may specifically include:
[0078] If cache component information corresponding to the target component exists in the cache, a cache component list is generated according to the cache component information, wherein the cache component list includes each historically associated component and the corresponding cache time;
[0079] Generate a project component list according to the second code file of each component in the target project, the project component list including each component in the target project and the corresponding latest modification time;
[0080] Compare the cache component list with the project component list, and filter out the modified components whose latest modification time is later than the cache time in each historical associated component.
[0081] In this embodiment, first, the server checks whether there is cache component information corresponding to the target component in the cache. If there is cache component information of the target component in the cache, the information is read. The information includes the historical associated components associated with the target component in the historical stage and the cache time corresponding to the historical associated components. Based on the read cache component information, a cache component list is generated. This list contains the identifier of each historical associated component (such as component name, version number, etc.) and the corresponding cache time.
[0082] Then, all components in the target project are traversed to find the second code file of each component. For each component's second code file, its latest modification time is read. Based on the read modification time, a project component list is generated. This list contains the identifier of each component in the target project and the corresponding latest modification time.
[0083] Finally, compare the cache component list with the project component list. For each historically associated component, check whether its latest modification time in the project component list is later than its cache time in the cache component list. If the latest modification time of a historically associated component is later than its cache time, mark it as a modified component.
[0084] Through this embodiment, the latest modification time of the component and the corresponding cache time are compared, so that the modified components whose latest modification time is later than the cache time can be accurately obtained, so that the component search range of the target component can be accurately constructed according to the modified components. In this way, only the components in the component search range need to be searched, and there is no need to search all the components of the target project, thereby reducing unnecessary comparison and search operations and improving search efficiency.
[0085] As an optional embodiment, Figure 4 As shown, after S103, the retrieval method of the associated component may further include the following S401-S402:
[0086] S401, comparing the search result list with the component search range to obtain a deleted component list, the deleted component list including components in the component search range but not in the search result list;
[0087] S402: Update cache component information according to the deleted component list and the search result list to obtain updated cache information.
[0088] In this embodiment, the deleted component list includes components in the cache component information that no longer belong to the associated components corresponding to the target component.
[0089] As an example, after obtaining the search result list, the server compares the search result list with the component search scope to find out the components that are within the component search scope but not in the search result list, thereby obtaining the components that need to be deleted from the cached component information.
[0090] Finally, the server deletes the corresponding components from the cached component information according to the deleted component list to delete the outdated component information; at the same time, according to the retrieval result list, the updated component information is added to the cached component information, including those components that exist in the retrieval result list but do not exist in the cached component information, to realize the update of new component information.
[0091] Through this embodiment, the component information in the cache can be updated efficiently, ensuring that the information in the cache is always consistent with the actual situation in the project. This helps to improve the efficiency of component retrieval and loading, and reduce the risk of errors and conflicts caused by outdated information.
[0092] As an optional embodiment, S402 may specifically include:
[0093] Filtering each component in the deleted component list from the cache component information to obtain filtered cache component information;
[0094] Each component in the search result list is updated to the filtered cache component information to obtain updated cache information.
[0095] In this embodiment, the server traverses each component information in the cache component information and checks each component one by one. Specifically, during the traversal process, each cached component is matched with the components in the deleted component list. If a matching component is found, it is filtered out from the cache component information. After completing the above steps, the filtered cache component information is obtained, and the cache component information no longer contains any component in the deleted component list.
[0096] Then, for each component in the search result list, check whether it already exists in the filtered cache component information. If not, add it to the cache. At the same time, update the cache time of each component in the cache to the current time. After completing the above steps, the final updated cache information is obtained, which contains the latest information of each associated component currently corresponding to the target component in the target project.
[0097] Through this embodiment, the component information in the cache can be updated efficiently, ensuring that the information in the cache is always consistent with the actual situation in the target project. This helps to improve the efficiency of component retrieval and loading and reduce the risk of errors and conflicts caused by outdated information.
[0098] As an optional embodiment, S104 may specifically include:
[0099] Calling the application programming interface of the code editor to create a first pop-up window;
[0100] The associated components corresponding to the target component are displayed in the first pop-up window.
[0101] In this embodiment, the server first calls the API of the code editor to create a first pop-up window, wherein the first pop-up window may have a custom size, position and style.
[0102] Then, the associated components corresponding to the retrieved target component are displayed in a pop-up window in a list, tree structure or other appropriate form. At the same time, operation buttons such as edit, delete or view detailed information can be provided in the window.
[0103] Users can view the information of the associated components through the pop-up window and perform operations such as editing or deleting. After the operation is completed, the pop-up window can be closed or minimized.
[0104] Through this embodiment, the application programming interface of the code editor is called to create a first pop-up window, so that the associated components corresponding to the target component are displayed in the first pop-up window. In this way, through the pop-up window reminder, the user can more intuitively know the associated components corresponding to the target component, which can improve the developer's use experience.
[0105] As an optional embodiment, after displaying the associated components corresponding to the target component in the first pop-up window, the associated component retrieval method may further include:
[0106] Bind target operation events to each associated component in the first pop-up window to obtain operable components;
[0107] In response to a triggering operation on the operable component, displaying a second code file of the operable component;
[0108] In response to an editing operation on the second code file of the operational component, the second code file of the operational component is modified.
[0109] In this embodiment, the server first binds a target operation event to each associated component in the first pop-up window. The target operation event may be a click event, a double-click event, a hover event, etc. When these events are triggered, the corresponding operation will be performed. Specifically, a function may be bound to the click event, which is responsible for displaying the corresponding second code file when clicked.
[0110] Then, when a certain associated component is triggered (e.g., clicked), the API or file system interface of the code editor is called according to the identification information of the associated component to open and display the second code file corresponding to the associated component. Specifically, the file can be displayed in a new tab, split view, or another pop-up window of the code editor.
[0111] At the same time, standard editing functions are provided in the code editor, such as copy, paste, undo, etc. When the developer edits the second code file, the file content is updated in real time. After the editing is completed, a save button or automatic save mechanism is provided to save the modified code file back to the code library.
[0112] Through this embodiment, the user clicks the logo of the associated component, and can quickly open the second code file of the associated component in the code editor, which can provide standard editing functions and saving mechanisms. In this way, developers can easily modify and save code files, which can improve the developer's usage experience.
[0113] As an optional embodiment, in response to a trigger operation on the operable component, displaying the second code file of the operable component may specifically include:
[0114] In response to a trigger operation on the operable component, obtaining path information corresponding to a second code file of the operable component;
[0115] According to the path information, obtain a second code file of the operable component;
[0116] Calling the code editor's application programming interface to create a second pop-up window;
[0117] The second code file of the operable component is displayed in a second pop-up window.
[0118] In this embodiment, the server sets the path information of the second code file associated with each operable component. The path information can be stored in the configuration file of the project, or can be specified in a code editor in some way.
[0119] At the same time, add event listeners to the operable components to capture the user's triggering operations. When the component is triggered, the corresponding callback function is executed.
[0120] In the callback function, firstly, the corresponding path information is obtained according to the identification information of the operable component. Then, the content of the second code file is read using the file system interface or the code library access interface. Finally, the API of the code editor is called to create a new pop-up window, and the read code file content is loaded into the window for display.
[0121] Through this embodiment, by quickly acquiring and displaying the specified code file, the time for developers to find and open files in the project is reduced. In this way, developers can easily modify and save the code file, which can improve the developer's experience.
[0122] Retrieval method based on associated components. Accordingly, the present application also provides a specific embodiment of a retrieval device for associated components.
[0123] like Figure 5 As shown, the retrieval device for associated components provided in the embodiment of the present application includes an interface display module 510 , a file reading module 520 , a component screening module 530 and a component display module 540 .
[0124] An interface display module 510, used to display a target interface of the code editor, the target interface including a search menu control;
[0125] The file reading module 520 is used to read the first code file of the target component from the target interface of the code editor in response to the triggering operation of the search menu control;
[0126] A component screening module 530 is used to traverse the second code files of each component in the target project, and screen the associated components that match the first code files of the target component from the components of the target project, wherein the target project is used to represent the application development project or web page development project to which the target component belongs, and the associated components are used to represent the components that have a reference relationship with the target component;
[0127] The component display module 540 is used to display the associated components corresponding to the target component.
[0128] As an optional embodiment, before displaying the target interface of the code editor, the retrieval device of the association component may further include the following modules:
[0129] The object generation module is used to generate an instance object on the code editor according to the preset action type corresponding to the search menu control;
[0130] A control generation module is used to call the application programming interface of the instance object to generate a preset control on the target interface of the code editor;
[0131] The control binding module is used to bind the preset control with the search execution command of the code editor to obtain the search menu control.
[0132] As an optional embodiment, before traversing the second code files of each component in the target project and screening the associated components that match the first code files of the target components from the components of the target project, the associated component retrieval device may further include the following modules:
[0133] A component screening module, for screening, when cache component information corresponding to the target component exists in the cache, the modified components that have been modified in the cache component information according to the second code files of each component and the cache component information, wherein the cache component information includes each historical associated component corresponding to the target component obtained in the historical stage;
[0134] A scope determination module, used for determining a component retrieval scope of a target component according to each of the modified components;
[0135] The component screening module 530 is specifically used for:
[0136] Traversing the second code files of each modified component in the component search range, screening out associated components matching the first code file of the target component from each modified component, and forming a search result list;
[0137] The component display module 540 is specifically used for:
[0138] Display all unmodified components except the modified components in the search result list and cache component information.
[0139] As an optional embodiment, the component screening module specifically includes the following units:
[0140] A list generating unit, configured to generate a cache component list according to the cache component information when there is cache component information corresponding to the target component in the cache, wherein the cache component list includes each historically associated component and a corresponding cache time;
[0141] The list generating unit is further used to generate a project component list according to the second code files of each component in the target project, wherein the project component list includes each component in the target project and the corresponding latest modification time;
[0142] The list comparison unit is used to compare the cache component list with the project component list, and filter out the modified components whose latest modification time is later than the cache time in each historical associated component.
[0143] As an optional embodiment, after traversing the second code files of each modified component in the component search range, screening out associated components matching the first code file of the target component from each modified component, and forming a search result list, the associated component search device may further include the following modules:
[0144] A list generation module, used for comparing the search result list with the component search range to obtain a deleted component list, wherein the deleted component list includes components that are in the component search range but not in the search result list;
[0145] The cache update module is used to update the cache component information according to the deleted component list and the search result list to obtain updated cache information.
[0146] As an optional embodiment, the cache update module specifically includes the following units:
[0147] A component screening unit, used to screen out each component in the deleted component list from the cache component information to obtain the cache component information after screening;
[0148] The component updating unit is used to update each component in the search result list to the cache component information after screening, so as to obtain updated cache information.
[0149] As an optional embodiment, the component display module 540 specifically includes the following units:
[0150] A window creation unit, used for calling an application programming interface of the code editor to create a first pop-up window;
[0151] The component display unit is used to display the associated components corresponding to the target component in the first pop-up window.
[0152] As an optional embodiment, after displaying the associated components corresponding to the target component in the first pop-up window, the component display module 540 may further include the following units:
[0153] An event binding unit, used to bind target operation events to each associated component in the first pop-up window to obtain an operable component;
[0154] A file display unit, configured to display a second code file of the operable component in response to a trigger operation on the operable component;
[0155] The file modification unit is used to modify the second code file of the operable component in response to an editing operation on the second code file of the operable component.
[0156] As an optional embodiment, the file display unit specifically includes the following subunits:
[0157] A path acquisition subunit, configured to acquire path information corresponding to a second code file of the operable component in response to a trigger operation on the operable component;
[0158] A file acquisition subunit, used for acquiring a second code file of the operable component according to the path information;
[0159] A window creation subunit, used for calling an application programming interface of a code editor to create a second pop-up window;
[0160] The file display subunit is used to display the second code file of the operable component in the second pop-up window.
[0161] Retrieval method based on associated components. Accordingly, the present application also provides a specific embodiment of a retrieval device for associated components.
[0162] Figure 6 A schematic diagram of the hardware structure of a retrieval device for an associated component provided in an embodiment of the present application is shown.
[0163] The retrieval device of the associated component may include a processor 601 and a memory 602 storing computer program instructions.
[0164] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0165] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 602 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 602 is a non-volatile solid-state memory.
[0166] The processor 601 implements any one of the associated component retrieval methods in the above embodiments by reading and executing the computer program instructions stored in the memory 602 .
[0167] In one example, the retrieval device of the associated component may also include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.
[0168] The communication interface 603 is mainly used to implement communication between each module, device, unit and / or equipment in the embodiment of the present application.
[0169] Bus 610 includes hardware, software or both, and the parts of the retrieval device of the associated component are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In suitable cases, bus 610 may include one or more buses. Although the present application embodiment describes and shows specific bus, the application considers any suitable bus or interconnection.
[0170] In addition, in combination with the method for retrieving the associated components in the above embodiments, the present application embodiment may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the methods for retrieving the associated components in the above embodiments is implemented.
[0171] In addition, in combination with the retrieval method for associated components in the above-mentioned embodiments, the embodiments of the present application may provide a computer program product for implementation. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the retrieval method for associated components provided in any aspect of the above-mentioned embodiments of the present application.
[0172] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiment, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make each kind of change, modification and addition, or change the order between the steps after understanding the spirit of the present application.
[0173] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0174] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0175] Each aspect of the present disclosure is described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0176] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of each equivalent modification or replacement within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application.
Claims
1. A method for retrieving an associated component, characterized in that: include: Displaying a target interface of a code editor, wherein the target interface includes a search menu control; In response to a triggering operation on the search menu control, reading a first code file of a target component from a target interface of the code editor; Traversing the second code files of each component in the target project, and screening out associated components that match the first code file of the target component from the components of the target project, wherein the target project is used to represent the application development project or web page development project to which the target component belongs, and the associated components are used to represent components that have a reference relationship with the target component; The associated components corresponding to the target component are displayed.
2. The method according to claim 1, characterized in that Before displaying the target interface of the code editor, the method further includes: Generate an instance object on the code editor according to the preset action type corresponding to the search menu control; Calling the application programming interface of the instance object to generate a preset control on the target interface of the code editor; The preset control is bound to the search execution command of the code editor to obtain a search menu control.
3. The method according to claim 1, characterized in that Before traversing the second code files of each component in the target project and screening the components of the target project to obtain associated components that match the first code files of the target components, the method further includes: In the case where cache component information corresponding to the target component exists in the cache, the modified components in the cache component information are screened and obtained according to the second code files of the components and the cache component information, wherein the cache component information includes the historical associated components corresponding to the target component obtained in the historical stage; Determining a component search scope of the target component according to each of the modified components; The traversing the second code files of each component in the target project and screening the components of the target project to obtain associated components that match the first code files of the target components include: Traversing the second code files of each of the modified components in the component search range, screening out associated components matching the first code file of the target component from each of the modified components, and forming a search result list; The displaying of each of the associated components corresponding to the target component includes: The search result list and each unmodified component in the cache component information except the modified component are displayed.
4. The method according to claim 3, characterized in that In the case that cache component information corresponding to the target component exists in the cache, filtering and obtaining the modified component in the cache component information according to the second code file of each component and the cache component information includes: In the case that cache component information corresponding to the target component exists in the cache, generating a cache component list according to the cache component information, wherein the cache component list includes each of the historically associated components and the corresponding cache time; Generate a project component list according to the second code file of each component in the target project, wherein the project component list includes each component in the target project and the corresponding latest modification time; The cache component list is compared with the project component list, and the modified components whose latest modification time is later than the cache time in each of the historical associated components are screened.
5. The method according to claim 3, characterized in that: After traversing the second code files of each of the modified components in the component search range, screening out associated components matching the first code file of the target component from each of the modified components, and forming a search result list, the method further includes: Compare the search result list with the component search range to obtain a deleted component list, wherein the deleted component list includes components that are in the component search range but not in the search result list; The cache component information is updated according to the deleted component list and the search result list to obtain updated cache information.
6. The method according to claim 5, characterized in that The updating of the cache component information according to the deleted component list and the search result list to obtain updated cache information includes: Filtering each component in the deleted component list from the cache component information to obtain filtered cache component information; Each component in the search result list is updated to the filtered cache component information to obtain updated cache information.
7. The method according to any one of claims 1 to 6, characterized in that: The displaying of each of the associated components corresponding to the target component includes: Calling the application programming interface of the code editor to create a first pop-up window; The associated components corresponding to the target component are displayed in the first pop-up window.
8. The method according to claim 7, characterized in that After displaying each of the associated components corresponding to the target component in the first pop-up window, the method further includes: Binding a target operation event to each of the associated components in the first pop-up window to obtain an operable component; In response to a triggering operation on the operable component, displaying a second code file of the operable component; In response to an editing operation on the second code file of the operational component, the second code file of the operational component is modified.
9. The method according to claim 8, characterized in that The step of displaying the second code file of the operable component in response to a triggering operation on the operable component comprises: In response to a triggering operation on the operable component, obtaining path information corresponding to a second code file of the operable component; According to the path information, obtaining a second code file of the operable component; Calling the application programming interface of the code editor to create a second pop-up window; The second code file of the operable component is displayed in the second pop-up window.
10. A retrieval device for an associated component, characterized in that: include: An interface display module, used for displaying a target interface of the code editor, wherein the target interface includes a search menu control; A file reading module, configured to read a first code file of a target component from a target interface of the code editor in response to a triggering operation on the search menu control; A component screening module, used to traverse the second code files of each component in the target project, and screen the associated components that match the first code file of the target component from the components of the target project, wherein the target project is used to represent the application development project or web page development project to which the target component belongs, and the associated components are used to represent the components that have a reference relationship with the target component; The component display module is used to display each of the associated components corresponding to the target component.
11. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for retrieving the associated components as described in any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for retrieving an associated component according to any one of claims 1 to 9 is implemented.
13. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for retrieving associated components as described in any one of claims 1 to 9.