Function jump method and device of non-same name symbol and computer readable storage medium
By adding hyperlinks to functions and automatically searching for peer function information, the problem of low jump efficiency for non-identical symbol functions in the IDE is solved, automatic jump is achieved, and development efficiency is improved.
Patent Information
- Application Number
- CN202110143762.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-02
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2041-02-02
AI Technical Summary
Existing integrated development environments (IDEs) cannot automatically jump between functions with different symbolic names, resulting in low development efficiency and requiring manual search.
By adding a hyperlink to the function, the hyperlink takes the name of the opposite function as a parameter, automatically searches for function information in response to a jump instruction, and automatically jumps between non-identical symbol functions.
Automatic jumps between symbolic functions with different names are realized, which improves software development efficiency.
Smart Images

Figure CN114840204B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and in particular to a function jump method and device for non-same-name symbols and a computer readable storage medium. BACKGROUND
[0002] Code jump is one of the most commonly used functions in the software development process, which refers to the process of jumping from one code segment (such as a function, class, variable, method, etc.) to another code segment. Taking a function as an example, it can jump from the use position of the function to the definition position of the function, or it can find all code segments that use the function from the definition position of the function. The function of code jump can help developers better understand the code and speed up the development efficiency.
[0003] IDE (Integrated Development Environment) is an integrated development software service set that integrates code writing functions, analysis functions, compilation functions, debugging functions, etc. IDE helps developers simplify the software development process by providing tools and various features. Based on this, developers often use IDE to complete software development.
[0004] In the process of writing code using IDE, the implementation of the code jump function requires that the current position code and the jumped code have the same name symbol (the symbol can include functions / interfaces / classes), for example, the jump of the function is from the jump of the function declaration in the interface to the jump of the same name function in the interface implementation class.
[0005] The existing jump technology in the IDE cannot realize the jump of non-same-name symbols. When it is necessary to jump between different name functions associated with each other, only manual search can be used, which hinders the development efficiency. SUMMARY
[0006] In order to solve the problems existing in the prior art, the embodiments of the present application show a function jump method and device for non-same-name symbols and a computer readable storage medium.
[0007] In a first aspect, the embodiments of the present application provide a function jump method for non-same-name symbols, comprising:
[0008] In response to a jump instruction of a paired function, function information of the paired function is searched, and the function information includes a peer function name, the peer function name being a function name of a peer function having a jump relationship with the paired function;
[0009] A hyperlink is added for the paired function, and the hyperlink takes the peer function name as a parameter;
[0010] In response to triggering of the hyperlink, a reference corresponding to the peer function name is searched.
[0011] In the present implementation, in response to a jump instruction of a pairing function, function information is automatically searched, the function information including a pairing function name of a pairing function having a jump relationship with the pairing function. Then, a hyperlink is added to the pairing function with the pairing function name as a parameter. The jump of the function can be triggered by clicking the hyperlink, and the reference corresponding to the pairing function name is searched. In the present implementation, automatic jump can be realized even between functions of non-identical symbols, and the efficiency of software development is improved to a certain extent.
[0012] With reference to the first aspect, in a first possible implementation of the first aspect, the step of searching for the function information of the pairing function comprises:
[0013] traversing the comment information of the pairing function;
[0014] if the comment information contains a pairing label, parsing the pairing label to obtain function information, the pairing label including a preset identifier, the preset identifier being used to mark that the pairing function has a jumpable pairing function.
[0015] In the present implementation, a pairing label is added to the comment information of the function having a jump relationship, the pairing label having a preset format so that the pairing label can be identified. Based on this, in the present implementation, if the comment information contains the pairing label, only the pairing label is parsed, and the amount of data processing is less.
[0016] With reference to the first aspect, in a second possible implementation of the first aspect, if the comment information does not contain the pairing label, a prompt information is popped up, the prompt information being used to remind the developer that the pairing function has no matching pairing function.
[0017] In the present implementation, a pairing label is added to the comment information of the function having a jump relationship, the pairing label having a preset format so that the pairing label can be identified. Based on this, in the present implementation, if the comment information does not contain the pairing label, a prompt information is popped up, and the popped-up prompt information can prompt the developer.
[0018] With reference to the first aspect, in a third possible implementation of the first aspect, the pairing label further includes a first identifier, the first identifier being used to mark that the pairing function is a transmitting-side function or a receiving-side function.
[0019] In the present implementation, the first identifier used to mark that the pairing function is a transmitting-side or a receiving-side function is added to the pairing label, and the range of the pairing function can be limited.
[0020] In a fourth possible implementation of the first aspect, if the pairing function supports cross-device calling, the pairing label further comprises a second identifier.
[0021] In the present implementation, the second identifier added in the pairing label can further limit the range of the peer function.
[0022] In a fifth possible implementation of the first aspect, after the step of searching for the function information of the pairing function, the method further comprises:
[0023] configuring an identification document for the alternative device, the identification document comprising function information and a device name, the alternative device being a device that implements mutual communication with the device of the pairing function;
[0024] adding hyperlinks to the pairing function, each of the hyperlinks corresponding to an identification document.
[0025] In the present implementation, an identification document is configured for each type / each alternative device, and then multiple hyperlinks are configured for the pairing function, each of the hyperlinks corresponding to an identification document. When the developer selects the alternative device to be jumped to, the reference corresponding to the peer function name can be searched for in the alternative device by clicking the hyperlink corresponding to the alternative device. In the above process, the alternative device to be jumped to does not need to be located from the results of global search.
[0026] In a sixth possible implementation of the first aspect, in response to the triggering of the hyperlink, the step of searching for the reference corresponding to the peer function name comprises:
[0027] In response to the triggering of the hyperlink, searching for the reference corresponding to the peer function name in a code module corresponding to a target device name, the target device name being the device name corresponding to the triggered hyperlink.
[0028] In the present implementation, each alternative corresponds to a hyperlink. When the developer selects the alternative device to be jumped to, the developer can search for the reference corresponding to the peer function name in the alternative device by clicking the hyperlink corresponding to the alternative device. In the above process, the alternative device to be jumped to does not need to be located from the results of global search.
[0029] In a second aspect, the embodiments of the present application provide a function jump device of non-identical symbols, comprising:
[0030] an information processing module, configured to search for function information of a pairing function in response to a jump instruction of the pairing function, the function information comprising a peer function name, the peer function name being a function name of a peer function having a jump relationship with the pairing function;
[0031] a link adding module, configured to add a hyperlink to the pairing function, the hyperlink taking the opposite function name as a parameter;
[0032] a reference searching module, configured to search for a reference corresponding to the opposite function name in response to a trigger of the hyperlink.
[0033] In this implementation, the information processing module automatically searches for function information in response to a jump instruction of a pairing function, the function information including an opposite function name of a function having a jump relationship with the pairing function. Then, the link adding module adds a hyperlink to the pairing function, the hyperlink taking the opposite function name as a parameter. When a user clicks the hyperlink to trigger a jump of the function, the reference searching module searches for a reference corresponding to the opposite function name. In this implementation, automatic jump can be realized between functions of non-identical symbols, and the efficiency of software development is improved to a certain extent.
[0034] With reference to the first aspect, in a second possible implementation of the second aspect, the information processing module includes:
[0035] a traversal submodule, configured to traverse the comment information of the pairing function;
[0036] a parsing submodule, configured to parse the pairing tag to obtain function information if the comment information contains the pairing tag.
[0037] In this implementation, a pairing tag is added in the comment information of a function having a jump relationship in advance, the pairing tag having a preset format so that the pairing tag can be identified. Based on this, in this implementation, the traversal submodule can directly identify the pairing tag in the comment information, and the parsing submodule can only parse the pairing tag if the comment information contains the pairing tag, so that the amount of data processing is less.
[0038] With reference to the first aspect, in a second possible implementation of the second aspect, the parsing submodule is further configured to pop up a prompt information if the comment information does not contain the pairing tag, the prompt information being used to remind a developer that the pairing function has no matching opposite function.
[0039] In this implementation, the parsing submodule pops up a prompt information if the comment information does not contain the pairing tag, and the popped-up prompt information can prompt the developer.
[0040] With reference to the first aspect, in a third possible implementation of the second aspect, the pairing tag further includes a first identifier, the first identifier being used to mark the opposite function as a transmitting-side function or a receiving-side function.
[0041] In the present implementation, the first identifier is added in the pairing label to mark the pairing function as the transmitting side or the receiving side, so as to limit the range of the peer function.
[0042] In combination with the first aspect, in a fourth possible implementation of the second aspect, if the pairing function supports cross-device jumping, the pairing label further includes a second identifier.
[0043] In the present implementation, the second identifier is added in the pairing label to further limit the range of the peer function.
[0044] In combination with the first aspect, in a fifth possible implementation of the second aspect, the information processing module is further configured to: configure an identifier document for the alternative device, the identifier document including the function information and the device name, the alternative device being a device that realizes mutual communication with the device of the pairing function.
[0045] The pairing function is added with a hyperlink, and each of the hyperlinks corresponds to an identifier document.
[0046] In the present implementation, the information processing module configures an identifier document for each type / each alternative device, and then configures multiple hyperlinks for the pairing function, each of the hyperlinks corresponding to an identifier document. When the developer selects an alternative device to jump to, the corresponding hyperlink of the alternative device is clicked to find the reference corresponding to the peer function name in the alternative device. In the above process, the alternative device to jump to does not need to be located from the global search result.
[0047] In combination with the first aspect, in a sixth possible implementation of the second aspect, the reference finding module is further configured to find the reference corresponding to the peer function name in a code module corresponding to the target device name, the target device name being a device name corresponding to the triggered hyperlink.
[0048] The calling submodule is configured to call the target device name in response to the triggering of the hyperlink, the target device name being a device name corresponding to the triggered hyperlink.
[0049] The selecting submodule is configured to select the target device, the target device being an alternative device corresponding to the target device name.
[0050] The finding submodule is configured to find the reference corresponding to the peer function name in the code loaded by the target device.
[0051] In the present implementation, each alternative corresponds to a hyperlink. When the developer selects an alternative device to jump to, the developer can find the reference corresponding to the opposite function name in the alternative device by clicking the hyperlink corresponding to the alternative device. In the above process, the alternative device to jump to does not need to be located from the global search result.
[0052] In a third aspect, an embodiment of the present application provides a computer system, which comprises a processor and a memory. The memory is configured to store a computer program. The processor is configured to execute the computer program to implement the method provided by the embodiment of the present application.
[0053] In the present implementation, in response to a jump instruction of a pairing function, function information is automatically found. The function information comprises an opposite function name of a function having a jump relationship with the pairing function. Then, a hyperlink is added to the pairing function with the opposite function name as a parameter. The jump of the function can be triggered by clicking the hyperlink to find the reference corresponding to the opposite function name. In the present implementation, automatic jump can be realized even between functions with non-identical symbols, which improves the efficiency of software development to a certain extent.
[0054] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is configured to be executed by a processor to implement the method provided by the embodiment of the present application.
[0055] In the present implementation, in response to a jump instruction of a pairing function, function information is automatically found. The function information comprises an opposite function name of a function having a jump relationship with the pairing function. Then, a hyperlink is added to the pairing function with the opposite function name as a parameter. The jump of the function can be triggered by clicking the hyperlink to find the reference corresponding to the opposite function name. In the present implementation, automatic jump can be realized even between functions with non-identical symbols, which improves the efficiency of software development to a certain extent. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 A structural schematic diagram of the device provided by the embodiment of the present application is shown in the figure;
[0057] Figure 2 A flowchart of the function jump method with non-identical symbols according to an embodiment is shown in the figure;
[0058] Figure 3 A flowchart of finding function information of a pairing function according to an embodiment is shown in the figure;
[0059] Figure 4a schematic diagram of a device display interface;
[0060] Figure 5 a structural schematic diagram of a function jump device of non-same name symbols provided according to an available embodiment. DETAILED DESCRIPTION
[0061] The technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments of the present application.
[0062] The plurality referred to in the embodiments of the present application refers to two or more. In addition, it should be understood that in the description of the present application, the words "first", "second", etc. are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating or implying order.
[0063] Figure 1 a structural schematic diagram of a device 100. The device 100 can include an application layer including one or more application programs 101, an operating system 102 including a kernel 104, and a hardware layer 103 including a processor 106, a memory 105, and a communication interface 107. The operating system 102 is system software for managing hardware and software resources.
[0064] The processor 106 is the control center of the device 100, and connects various components of the device 100 through various interfaces and buses. In some embodiments, the processor 106 can include one or more processing units, or physical cores, for example Figure 1 The processor 106 includes core 0 and core 1. The processor 106 can also include registers, which can be used to store addresses of functions of the kernel 104. The processor 106 can be a central processing unit (CPU), and the processor 106 can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor 106 can also be any conventional processor.
[0065] The memory 105 stores computer programs. The processor 106 is configured to execute the computer programs in the memory 105, thereby realizing the functions defined by the computer programs. The memory 105 is a non-volatile storage medium, and generally includes an internal memory and an external memory. The internal memory includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), or a cache, etc. The external memory includes, but is not limited to, a flash memory, a hard disk, an optical disk, a universal serial bus (USB) disk, etc. The computer programs are generally stored in the external memory, and the processor loads the computer programs from the external memory to the internal memory before executing the computer programs. The memory 105 can be independent, and connected to the processor 106 through a bus. The memory 105 can also be integrated with the processor 106 into a chip subsystem.
[0066] The communication interface 107 uses a transceiving device such as a transceiver to realize the communication between the device 100 and other devices or communication networks.
[0067] In an implementation manner, the device 100 can be a physical device, such as a server or a terminal device. The terminal device can be a handheld device with a wireless connection function, or another processing device connected to a wireless modem. For example, it can be a mobile phone, a computer, a tablet computer, a personal digital assistant (PDA), a mobile Internet device (MID), a wearable device, and an e-book reader, etc. It can also be a portable, pocket-sized, handheld, built-in computer, or vehicle-mounted mobile device.
[0068] Software development is a process of building a software system or a software part in the system according to user requirements. Software development is a system engineering including requirement capturing, requirement analysis, design, implementation, and testing. Code jumping is one of the most commonly used functions in the software development process, which refers to the process of jumping from one code segment (such as a function, a class, a variable, a method, etc.) to another code segment. Taking a function as an example, it can jump from the use position of the function to the definition position of the function, or find all code segments using the function from the definition position of the function. The function of code jumping can help developers better understand the code and speed up the development efficiency.
[0069] In the process of writing code in the IDE, the implementation of the code jump function requires that the current position code and the jumped code have the same name symbol (the symbol can include functions / interfaces / classes), for example, the jump of the function is from the function declaration in the interface to the jump of the same function in the interface implementation class.
[0070] The existing jump technology in the IDE cannot realize the jump of non-same name symbol functions, and when it is necessary to jump between different name functions associated with each other, only manual search can be used, which hinders the development efficiency.
[0071] Based on the above technical problems, the embodiment of the present application provides a non-same name symbol function jump method, specifically, can refer to Figure 2 ; Figure 2 The flowchart of the non-same name symbol function jump method provided according to a feasible embodiment, as can be seen from the figure, the method comprises:
[0072] Step S201 responds to the jump instruction of the paired function, and finds the function information of the paired function. The function information includes the opposite function name, and the opposite function name is the function name of the opposite function having a jump relationship with the paired function.
[0073] The function involved in the embodiment refers to a program or code that can be directly referenced by another program or code. A larger program should generally be divided into several modules, and each module is used to implement a specific function. All high-level languages have the concept of subprogram, which implements the function of the module. In C language, the function of the subprogram is composed of a main function and several functions. The main function jumps to other functions, and other functions can also jump to each other.
[0074] The implementation of the function jump function requires that the current position function and the jumped function have the same name symbol. For example, the function with the function name sendMsg and the function with the function name sendMsg belong to the same name function, and therefore, the function with the function name sendMsg and the function with the function name sendMsg can jump to each other.
[0075] In order to realize the jump between non-same name symbol functions, the scheme provided by the embodiment pre-labels a plurality of functions having a jump function to be implemented. The labeled function can be a same name symbol function or a non-same name symbol function, so that the non-same name symbol functions can jump to each other.
[0076] The functions in the application that need to realize the jump function can be collectively referred to as a function pair. In the function pair, the function corresponding to the cursor stay position can be referred to as a matching function, and the function having a jump relationship with the matching function can be referred to as a counterpart function. It is worth noting that in the scheme provided by the embodiment, the matching function and the counterpart function are a concept equivalent to each other. For example, for a function pair including two functions, a function named sendMsg and a function named subscribeMsg, if it is predetermined that the function named sendMsg is the matching function, then the function named subscribeMsg is the counterpart function. If it is predetermined that the function named subscribeMsg is the matching function, then the function named sendMsg is the counterpart function. The embodiment only exemplarily introduces a case in which a function pair includes two functions. In actual application, the number of functions included in a function pair can be configured according to requirements, and the applicant does not make too many limitations.
[0077] The specific annotation process can be that the annotation information of the functions having a jump relationship is added with function information that can be generated, and the function information at least includes the counterpart function name having a jump relationship with the function. For example, the function named sendMsg and the function named subscribeMsg are a function pair having a jump relationship, and the function information of the function named sendMsg at least includes subscribeMsg.
[0078] It is worth noting that the number of counterpart function names included in the function information is not limited in the embodiment. In some feasible embodiments, the function information of one function can include one counterpart function name. In some feasible embodiments, the function information of one function can include multiple counterpart function names.
[0079] There are multiple implementation manners for finding the function information of the matching function.
[0080] For example, the function information can be directly found in the annotation information of the matching function, and then the function information found.
[0081] Specifically, each function is configured with annotation information corresponding to the function. The annotation information is helpful for reading and understanding the function. The annotation information can include explanatory files, such as the content of the function, the function of the function, the relationship between the function and other files, the modification date of the function, and the like. In the scheme shown in the embodiment, the annotation information further includes a label or symbol that can generate function information.
[0082] In a feasible embodiment, the function information can be directly obtained by parsing the annotation information.
[0083] The specific implementation process is that: initially, the annotation information exists in the form of source code, and the annotation information needs to be parsed into computer-readable code. In a feasible embodiment, an AST (abstract syntax code) tool can be used to parse the annotation information into computer-readable code. The parsing process can be: (1) lexical analysis scanner, this process will decompose the annotation information composed of characters into meaningful code blocks, which are collectively referred to as lexical units. (2) generating an AST tree, this process is to convert the lexical unit stream into a tree composed of element nesting representing the syntax structure of the program, which is called an abstract syntax tree, and the function information is subsequently searched in the AST tree. The implementation of searching for function information in the AST tree can use the information searching method commonly used in the art, and the applicant does not make too many limitations here.
[0084] For example, in order to reduce the data processing amount of the device, the embodiment of the application provides an implementation method for searching for function information of a paired function, and the specific implementation can be referred to in Figure 3 , Figure 3 A flowchart for searching for function information of a paired function according to a feasible embodiment is provided, and the method comprises:
[0085] S301 traversing the annotation information of the paired function;
[0086] S302 determining whether the annotation information contains a paired label;
[0087] There are tens of thousands of functions stored in the device, and not every function has a jumpable non-identical symbol function. Generally, the annotation information needs to be parsed to know whether the annotation information of the paired function currently operated contains function information, and the parsing of the annotation information will occupy the computing amount of the device.
[0088] In the embodiment, a paired label that can parse the function information can be added in the annotation information. The paired label has a preset format, so that the paired function can be identified in the annotation information.
[0089] The paired label format has multiple types, and any format that can identify the paired function in the annotation information can be applied to the scheme shown in the embodiment. In a feasible embodiment, a preset identifier is added in the paired label. The style of the preset identifier is not limited in the embodiment. For example, the preset identifier can be @pair, and the corresponding paired label can be: { @pair packageName.className#methodName}.
[0090] S303 if the annotation information contains the paired function, parsing the paired label to obtain the function information.
[0091] If the annotation information contains the pairing label, it indicates that the pairing function has a peer function having a jump relationship with it, in this case, the pairing label can be parsed to obtain the function information. Then, the pairing function is configured with a hyperlink based on the function information.
[0092] In the present implementation, the pairing label can be parsed by using the AST tool, and the specific parsing process can refer to the parsing process of the annotation information described above, which will not be described herein.
[0093] S304If the annotation information does not contain the pairing function, a prompt information is popped up, and the prompt information is used to remind the developer that the pairing function has no matching peer function.
[0094] If the annotation information does not contain the pairing function, it indicates that the pairing function has no peer function having a jump relationship with it, in this case, in order to play a prompting role, a prompt information can be popped up on the UI (User Interface, user interface) interface of the device, and the prompt information is used to remind the developer that the pairing function has no matching peer function. The present embodiment does not limit the display mode of the prompt information, and any display mode that can play a prompting role for the developer can be applied to the scheme shown in the present application. For example, in a feasible embodiment, the prompt information can be displayed in the form of a prompt window on the UI interface.
[0095] The present embodiment is only an example of two implementation modes of finding the function information of the pairing function, and in actual application, the implementation mode of finding the function information of the pairing function can be but not limited to the above two modes.
[0096] S202Adding a hyperlink to the pairing function, and the hyperlink takes the peer function name as a parameter;
[0097] In the present embodiment, the hyperlink refers to the connection relationship from the pairing function to the peer function. The parameters of the hyperlink at least include the href attribute, wherein the Href attribute is used to indicate the peer function, and in the present application, the peer function name is taken as the href attribute. In some feasible embodiments, the parameters of the hyperlink can also include the title attribute, the title attribute can set some introduction information for the hyperlink, and when the mouse moves to the hyperlink with the set title attribute, the content of the title attribute value will be displayed; in some feasible embodiments, the parameters of the hyperlink can also include the target attribute for controlling the opening position of the linked function. In some feasible embodiments, the parameters of the hyperlink can also include other attributes, which will not be enumerated herein.
[0098] S203In response to the triggering of the hyperlink, the reference corresponding to the peer function name is found.
[0099] The scheme shown in the embodiment is further described below with reference to specific examples.
[0100] In a feasible embodiment, the scheme is applicable to a phone device, which can include an information processing module, a link adding module and a reference searching module. During software development, the cursor is located at the FeatureAbility.sendmsg position in the 6th line of phone / sender.js, and the developer triggers the jump instruction of the pairing function. The information processing module determines that phone / sender.js is a FeatureAbility.sendMsg function. The information processing module obtains the annotation information corresponding to the FeatureAbility.sendmsg function, and determines that the FeatureAbility.sendmsg annotation information obtained contains the pairing tag of {pair FeatureAbility#subscribeMsg}. The information processing module parses the pairing tag to obtain the function information of the pairing function at the current position, and the function information contains the function name of the opposite function as FeatureAbility#subscribeMsg. The link adding module adds a hyperlink to the pairing function, and the hyperlink takes the function name of the opposite function as a parameter. The hyperlink can be displayed in the form of a floating window. In response to the triggering of the hyperlink by the developer, the reference searching module searches for all references of the function name FeatureAbility#subscribeMsg in the computer program in the storage, and each reference has a corresponding file path and a corresponding line number and column number. In this embodiment, the reference searched is the 6th line in receiver.js.
[0101] The scheme provided in the embodiment automatically calls function information in response to the jump instruction of the pairing function, the function information includes the function name of the opposite function, and the function name of the opposite function is the function name of the opposite function having a jump relationship with the pairing function. Then, a hyperlink is added to the pairing function with the function name of the opposite function as a parameter. The jump of the function can be triggered by clicking the hyperlink, and the reference corresponding to the function name of the opposite function is searched out. In this implementation, automatic jump can be realized even between functions with non-identical symbols, and the efficiency of software development is improved to a certain extent.
[0102] As a feasible embodiment, the pairing tag can further include a first identifier, and the first identifier is used to mark the pairing function as a transmitting side function or a receiving side function.
[0103] In this embodiment, the first identifier is used to mark the peer function as a sending side or a receiving side, which can be send / receive, publish / subscribe, etc. The technical solution shown in this embodiment can further limit the range of the peer function by adding the first identifier for marking the pairing function as a sending side or a receiving side in the pairing tag.
[0104] For example, in a feasible embodiment, the pairing tag of the pairing function is { @ pairFeatureAbility.sendMsg}. In response to the triggering of the hyperlink, the reference lookup module looks up all the references corresponding to the function name sendMsg of the send side and the receive side. In a feasible embodiment, the function information of the pairing function is { @ pairFeatureAbility.sendMsg send}. In response to the triggering of the hyperlink, the reference lookup module looks up all the references corresponding to the function name sendMsg of the send side. It can be seen that the addition of the first identifier for marking the pairing function as a sending side or a receiving side in the pairing tag can limit the range of the peer function.
[0105] In some feasible embodiments, other identifiers can be added in the pairing tag to further limit the range of the peer function. For example, in some feasible embodiments, the scopeName.className can be used to limit the function range. In different languages, scopeName has different meanings. In Java, scopeName represents the package name. In Javascript and C++, scopeName is the command space name. className is the class name, and methodName is the function name.
[0106] As a feasible embodiment, the pairing tag further includes a second identifier, and the second identifier is used to indicate that cross-device lookup is supported in the reference lookup process. If the pairing function supports cross-device jump, the pairing tag further includes the second identifier.
[0107] In this embodiment, the second identifier is used to indicate that cross-device lookup is supported in the reference lookup process. The style of the second identifier is not limited in this embodiment. For example, in a feasible embodiment, the second identifier can be cross. For example, if the current pairing function does not support cross-device lookup, the pairing tag of the pairing function can be { @ pairFeatureAbility.sendMsg send}. If the current pairing function supports cross-device lookup, the pairing tag of the pairing function can be { @ pairFeatureAbility.sendMsg send, cross}.
[0108] The technical solution shown in the embodiment can further limit the range of the peer function by adding the second identifier in the pairing label.
[0109] For example, in a possible embodiment, the pairing label of the pairing function is {pairFeatureAbility.sendMsg}. In response to the triggering of the hyperlink, the reference lookup module looks up all the references corresponding to the function named sendMsg stored locally. In a possible embodiment, the function information of the pairing function is {pairFeatureAbility.sendMsg cross}, and in response to the triggering of the hyperlink, the reference lookup module looks up all the references corresponding to the function named sendMsg globally, where the global includes the functions stored in the device currently operated by the developer and the functions stored in the devices that can communicate with the device currently operated by the developer. It can be seen that adding the second identifier in the pairing label can further limit the range of the peer function.
[0110] As a possible embodiment, if the pairing label contains the second identifier, after the step of looking up the function information of the pairing function, the method further includes: configuring an identifier document for the alternative device, the identifier document including the function information and the device name, the alternative device being a device that can realize mutual communication with the device of the pairing function; and adding a hyperlink to the pairing function, each hyperlink corresponding to an identifier document.
[0111] In the solution shown in the embodiment, an identifier document is configured for the alternative device, and the identifier document includes the function information and the device name. For example, in a possible embodiment, the identifier document can be [tv](command:goToPeer(tv,receive,FeatureAbility#subscribeMsg,cross)), where tv is the device name, and (receive,FeatureAbility#subscribeMsg,cross) is the function information.
[0112] In some feasible embodiments, one identification document can be configured for each alternative device. For example, the alternative devices that the currently operating device can connect to are tvl, tv2 and watch. Three identification documents can be configured for the three alternative devices, which are respectively: [tvl] (command:goToPeer(tvl, receive, FeatureAbility#subscribeMsg, cross)); [tv2] (command:goToPeer(tv2, receive, FeatureAbility#subscribeMsg, cross)); [watch] (command:goToPeer(watch, receive, FeatureAbility#subscribeMsg, cross)).
[0113] In some feasible embodiments, one identification document can be configured for each type of alternative device. For example, in a feasible embodiment, the alternative devices that the currently operating device can connect to are tvl, tv2 and watch. Two identification documents can be configured for the two types of alternative devices, which are respectively: [tv] (command:goToPeer(tv, receive, FeatureAbility#subscribeMsg, cross)); [watch] (command:goToPeer(watch, receive, FeatureAbility#subscribeMsg, cross)).
[0114] It is worth noting that the embodiments of the present application only exemplarily show two configuration schemes of the identification documents, and the configuration scheme of the identification document in the actual application can be but is not limited to the above two.
[0115] As a feasible embodiment, if the second identification is contained in the pairing tag, in response to the triggering of the hyperlink, the step of finding the reference corresponding to the opposite function name is specifically:
[0116] In response to the triggering of the hyperlink, the reference corresponding to the opposite function name is found in the code module corresponding to the target device name, and the target device name is the device name corresponding to the triggered hyperlink.
[0117] The code module is used to record the code loaded in the device corresponding to the logger.
[0118] In the present implementation, each alternative corresponds to a hyperlink. When the developer selects the alternative device to be jumped to, the developer clicks the hyperlink corresponding to the alternative device, so that the reference finding module finds the reference corresponding to the peer function name in the alternative device. In the above process, it is not necessary to locate the alternative device to be jumped to from the results of the global search.
[0119] The above scheme is further described in combination with a specific example. In a feasible embodiment, the above scheme is applicable to a phone device. The phone device can include an information processing module, a link adding module, and a reference finding module. When the cursor stays at the FeatureAbility.sendmsg position in the phone / sender.js in the software development, the developer triggers the jump instruction of the pairing function. The information processing module determines that the phone / sender.js is a FeatureAbility.sendMsg function. The information processing module obtains the annotation information corresponding to the FeatureAbility.sendmsg function. It is determined that the FeatureAbility.sendmsg annotation information obtained has a pairing tag of {pair FeatureAbility#subscribeMsg receive cross-device}. The information processing module parses the pairing tag to obtain the function information of the pairing function corresponding to the current position: (1) the pairing function name is FeatureAbility#subscribeMsg, and (2) the receive identifier indicates that the pairing function is located as a parameter, and the identifier document is [tv](command:goToPeer(tv, receive, FeatureAbility#subscribeMsg, cross)), [watch](command:goToPeer(watch, receive, FeatureAbility#subscribeMsg, cross)). The link adding module adds a self-defined command hyperlink to each device, and the hyperlink takes the identifier document as a parameter. The hyperlink can be displayed on the UI interface, and the display effect can be referred to Figure 4: the developer clicks the hyperlink [tv] corresponding to the device tv (command:goToPeer(tv, receive, FeatureAbility#subscribeMsg, cross)), the reference lookup module obtains the function FeatureAbility#subscribeMsg to be jumped to, and the function stored in the memory of the device of the device type tv. The reference lookup module looks up all references of FeatureAbility#subscribeMsg in the memory of the device of the tv device type, and each reference has a corresponding file path and a corresponding line number and column number. In this embodiment, the tv / receiver.js in the 6th line is obtained. The display interface of the UI interface is switched to the 6th line in the receiver.js function, so that the jump from FeatureAbility.sendMsg in the 6th line of the sender.js of the phone to the 6th line of the receiver.js of the tv is completed.
[0120] The embodiment of the application provides a function jump device of non-same-name symbols, and specifically, the function jump device of non-same-name symbols can be referred to Figure 5 , Figure 5 FIG. 1 is a schematic diagram of a function jump device of non-same-name symbols according to an embodiment, which comprises:
[0121] The code editor 401 is configured to receive a jump instruction of a pair function.
[0122] The information processing module 402 is configured to, in response to the jump instruction of the pair function, look up function information of the pair function, wherein the function information comprises a peer function name, and the peer function name is a function name of a peer function having a jump relationship with the pair function.
[0123] The link adding module 403 is configured to add a hyperlink to the pair function, and the hyperlink takes the peer function name as a parameter.
[0124] The command processing module 404 is configured to, in response to triggering of the hyperlink, call a reference lookup module.
[0125] The reference lookup module 405 is configured to, in response to triggering of the hyperlink, look up a reference corresponding to the peer function name.
[0126] In the present implementation, in response to a jump instruction of a pairing function, the information processing module automatically searches for function information, the function information including a peer function name of a peer function having a jump relationship with the pairing function. Then, the link adding module adds a hyperlink to the pairing function with the peer function name as a parameter. When a user clicks the hyperlink to trigger a jump of the function, the reference searching module searches for a reference corresponding to the peer function name. In the present implementation, automatic jump can be realized even between functions with non-identical symbols, and the efficiency of software development is improved to a certain extent.
[0127] In a possible implementation, the information processing module includes:
[0128] The traversal submodule is configured to traverse the comment information of the pairing function.
[0129] The parsing submodule is configured to, if the comment information contains a pairing tag, parse the pairing tag to obtain function information.
[0130] In the present implementation, a pairing tag is added in the comment information of a function having a jump relationship, and the pairing tag has a preset format so that the pairing tag can be identified. Based on this, in the present implementation, the traversal submodule can directly identify the pairing tag in the comment information, and in the case where the comment information contains the pairing tag, the parsing submodule can only parse the pairing tag, and the data processing amount is small.
[0131] In a possible implementation, the parsing submodule is further configured to, if the comment information does not contain the pairing tag, pop up a prompt information, the prompt information being used to remind a developer that the pairing function has no matching peer function.
[0132] In the present implementation, in the case where the comment information does not contain the pairing tag, the parsing submodule pops up a prompt information, and the popped-up prompt information can prompt the developer.
[0133] In a possible implementation, the pairing tag further includes a first identifier, the first identifier being used to mark the peer function as a transmitting side function or a receiving side function.
[0134] In the present implementation, the first identifier is added in the pairing tag to mark the pairing function as a transmitting side or a receiving side, and the range of the peer function can be limited.
[0135] In a possible implementation, if the pairing function supports cross-device jump, the pairing tag further includes a second identifier.
[0136] In the present implementation, the second identifier is added in the pairing tag, and the range of the peer function can be further limited.
[0137] In a possible implementation, the information processing module is further configured to configure an identification document for each candidate device, the identification document comprising function information and a device name, the candidate device being a device that can communicate with the device implementing the pairing function;
[0138] adding hyperlinks to the pairing function, each of the hyperlinks corresponding to an identification document.
[0139] In this implementation, the information processing module configures an identification document for each type of candidate device or each candidate device, and then configures a plurality of hyperlinks to the pairing function, each of the hyperlinks corresponding to an identification document. When the developer selects a candidate device to jump to, the developer can find the reference corresponding to the opposite function name in the candidate device by clicking the hyperlink corresponding to the candidate device. In the foregoing process, the candidate device to jump to does not need to be located from the global search result.
[0140] In a possible implementation, the reference searching module is further configured to search for the reference corresponding to the opposite function name in a code module corresponding to the target device name, the target device name being the device name corresponding to the triggered hyperlink.
[0141] In this implementation, each candidate device corresponds to a hyperlink. When the developer selects a candidate device to jump to, the developer can find the reference corresponding to the opposite function name in the candidate device by clicking the hyperlink corresponding to the candidate device. In the foregoing process, the candidate device to jump to does not need to be located from the global search result.
[0142] An embodiment of the present application provides a computer system, the computer system comprising a processor and a memory, the memory being configured to store a computer program, and the processor being configured to execute the computer program to implement the method provided in the embodiments of the present application.
[0143] An embodiment of the present application further provides a computer storage medium, which includes computer instructions, when the computer instructions are executed on the electronic device, the electronic device is caused to perform each function or step executed by the electronic device in the method embodiment.
[0144] An embodiment of the present application further provides a computer program product, when the computer program product is executed on a computer, the computer is caused to perform each function or step executed by the electronic device in the method embodiment.
[0145] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is taken as an example, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0146] It is easy to understand that, on the basis of several embodiments provided in the present application, the skilled in the art can combine, split, recombine, etc. the embodiments of the present application to obtain other embodiments, and these embodiments do not exceed the protection scope of the present application.
[0147] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed mutual ones can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0148] The units described as separate components can or can not be physically separated, and the components shown as units can be one physical unit or multiple physical units, that is, can be located in one place, or can be distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0149] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0150] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The software product is stored in a storage medium, including a plurality of instructions to make a device (which can be a single-chip microcomputer, a chip, etc.) or a processor execute all or part of the steps of the various embodiments of the method of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0151] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any change or replacement within the technical scope disclosed in the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for jumping to a function with a non-identical symbol, characterized in that: include: In response to a jump instruction of a paired function, searching for function information of the paired function, the function information including a peer function name, the peer function name being a function name of a peer function having a jump relationship with the paired function; Configuring an identification document for a candidate device, the identification document including function information and a device name, the candidate device being a device that can communicate with the device with the paired function; Adding a hyperlink to the pairing function, wherein the hyperlink takes the identification document as a parameter, and each hyperlink corresponds to one identification document; In response to triggering the hyperlink, a reference corresponding to the peer function name is searched.
2. The function jump method according to claim 1, wherein: The step of searching for function information of the pairing function includes: Traversing the annotation information of the pairing function; If the annotation information includes a pairing tag, the pairing tag is parsed to obtain the function information, and the pairing tag exists in a preset format so that the pairing tag can be identified.
3. The function jump method according to claim 2, characterized in that: If the annotation information does not include a pairing tag, a prompt message is popped up, and the prompt message is used to remind the developer that the pairing function has no matching peer function.
4. The function jump method according to claim 2, wherein: The pairing tag includes a first identifier, and the first identifier is used to mark the peer function as a transmitting side function or a receiving side function.
5. The function jump method according to claim 4, characterized in that: If the pairing function supports cross-device jump, the pairing tag further includes a second identifier, and the second identifier is used to indicate that cross-device search is supported during the reference search process.
6. The function jump method according to claim 1, wherein: In response to triggering the hyperlink, the step of searching for a reference corresponding to the peer function name is specifically as follows: In response to triggering the hyperlink, a reference corresponding to the peer function name is searched in a code module corresponding to a target device name, where the target device name is the device name corresponding to the triggered hyperlink.
7. A function jump device for non-identical symbols, characterized in that: include: an information processing module, configured to, in response to a jump instruction of a pairing function, search for function information of the pairing function, the function information including a peer function name, the peer function name being the function name of a peer function having a jump relationship with the pairing function; and configure an identification document for a candidate device, the identification document including function information and a device name, the candidate device being a device that enables mutual communication with the pairing function device; a link adding module, configured to add a hyperlink to the pairing function, wherein the hyperlink takes the identification document as a parameter, and each hyperlink corresponds to an identification document; The reference search module is used to search for a reference corresponding to the peer function name in response to triggering the hyperlink.
8. The function jump device according to claim 7, characterized in that: The information processing module includes: A traversal submodule, used for traversing the annotation information of the pairing function; The parsing submodule is configured to parse the pairing tag to obtain function information if the annotation information includes the pairing tag, wherein the pairing tag exists in a preset format so that the pairing tag can be identified.
9. The function jump device according to claim 8, characterized in that: The parsing submodule is further configured to pop up a prompt message if the annotation information does not include a pairing tag, wherein the prompt message is configured to remind the developer that the pairing function has no matching counterpart function.
10. The function jump device according to claim 8, characterized in that: The pairing tag further includes a first identifier, and the first identifier is used to mark the peer function as a transmitting side function or a receiving side function.
11. The function jump device according to claim 10, characterized in that: If the pairing function supports cross-device jump, the pairing tag further includes a second identifier, and the second identifier is used to indicate that cross-device search is supported during the reference search process.
12. The function jump device according to claim 7, wherein: The reference search module is also used to: A reference corresponding to the peer function name is searched in a code module corresponding to a target device name, where the target device name is the device name corresponding to the triggered hyperlink.
13. A computer system, characterized in that: The computer system includes a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to implement the method according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is used by a processor to implement the method according to any one of claims 1 to 6.