CN114840204A - Function jump method and device for non-homonymous symbols and computer readable storage medium - Google Patents

Function jump method and device for non-homonymous symbols and computer readable storage medium Download PDF

Info

Publication number
CN114840204A
CN114840204A CN202110143762.7A CN202110143762A CN114840204A CN 114840204 A CN114840204 A CN 114840204A CN 202110143762 A CN202110143762 A CN 202110143762A CN 114840204 A CN114840204 A CN 114840204A
Authority
CN
China
Prior art keywords
function
pairing
name
information
hyperlink
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110143762.7A
Other languages
Chinese (zh)
Inventor
肖剑
李华兵
刘金华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110143762.7A priority Critical patent/CN114840204A/en
Priority to PCT/CN2021/137695 priority patent/WO2022166410A1/en
Publication of CN114840204A publication Critical patent/CN114840204A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/423Preprocessors

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the application provides a function jump method and device of non-homonymous symbols and a computer-readable storage medium. And then, adding a hyperlink for the pairing function by taking the name of the opposite terminal function as a parameter. And searching for the reference corresponding to the opposite terminal function name by clicking the jump of the hyperchain trigger function. According to the scheme provided by the embodiment of the application, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.

Description

Function jump method and device for non-homonymous symbols and computer readable storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for function jump of non-homonymous symbols, and a computer-readable storage medium.
Background
The code jump is one of the most commonly used functions in the software development process, and refers to a process of jumping from one code segment (such as a function, a class, a variable, a method, etc.) to another code segment. The code jumping function can facilitate a developer to better understand the code and accelerate the development efficiency.
An Integrated Development Environment (IDE) integrates a Development software service suite with integration of a code writing function, an analysis function, a compiling function, a debugging function, and the like. The IDE helps developers simplify the software development process by providing tools and various capabilities, based on which the developers mostly use the IDE to complete the development of the software.
In writing code using an IDE, implementing a code jump function requires that the current location code and the code being jumped possess a homonymous symbol (which may include a function/interface/class), e.g., a jump of a function is a jump from a function declaration in an interface to an interface implementing a homonymous function.
The existing jump technology in the IDE can not realize the jump of non-homonymous symbols, and when the jump is needed among different associated homonymous functions, only a manual searching mode can be adopted, thus hindering the development efficiency.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present application illustrate a function hopping method and apparatus for non-homonymous symbols, and a computer-readable storage medium.
In a first aspect, an embodiment of the present application provides a method for function hopping of non-homonymous symbols, including:
responding to a jump instruction of a pairing function, searching function information of the pairing function, wherein the function information comprises an opposite terminal function name, and the opposite terminal function name is the function name of an opposite terminal function having a jump relation with the pairing function;
adding a hyperlink to the pairing function, wherein the hyperlink takes the name of the opposite terminal function as a parameter;
and responding to the trigger of the hyperlink, and searching a reference corresponding to the name of the opposite terminal function.
In this implementation manner, in response to a jump instruction of a pairing function, function information is automatically searched, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function. And then, adding a hyperlink for the pairing function by taking the name of the opposite terminal function as a parameter. The reference corresponding to the name of the opposite terminal function can be found out by clicking the skip of the hyperchain trigger function. According to the implementation mode, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the step of searching for the function information of the pairing function includes:
traversing annotation information of the pairing function;
and if the comment information contains a pairing label, analyzing the pairing label to obtain function information, wherein the pairing label comprises a preset identifier which is used for marking that the pairing function has a skippable opposite terminal function.
In this implementation manner, a pairing tag is added to the annotation information of the function with the jump relationship, and the pairing tag has a preset format, so that the pairing tag can be identified. In this embodiment, when the comment information includes the pair tag, only the pair tag can be analyzed, and the amount of data processing is small.
With reference to the first aspect, in a second possible implementation manner of the first aspect, if the annotation information does not include a pairing tag, a prompt message is popped up, where the prompt message is used to remind a developer that the pairing function does not have a matched peer function.
In this implementation manner, a pairing tag is added to the annotation information of the function having the jump relationship, and the pairing tag has a preset format, so that the pairing tag can be identified. In this embodiment, when the comment information does not include the pairing tag, the prompt information pops up, and the popped-up prompt information can play a role of prompting the developer.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the pairing tag further includes a first identifier, where the first identifier is used to label the peer-to-peer function as a transmitting side function or a receiving side function.
In this implementation manner, a first identifier for labeling the pairing function as the transmitting side or the receiving side is added to the pairing tag, and the range of the peer-to-peer function can be limited.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, if the pairing function supports a cross-device call, the pairing tag further includes a second identifier.
In this implementation, the second identifier is added to the pairing tag, so that the range of the peer-to-peer function can be further limited.
With reference to the first aspect, in a fifth possible implementation manner of the first aspect, after the step of searching for the function information of the pairing function, the method further includes:
configuring an identification document for an alternative device, wherein the identification document comprises function information and a device name, and the alternative device is a device which realizes mutual communication with a device of a pairing function;
and adding hyperlinks to the pairing function, wherein each hyperlink corresponds to an identification document.
In the implementation manner, one identification document is configured for each type/each candidate device, and then a plurality of hyperlinks are configured for the pairing function, wherein each hyperlink corresponds to one identification document. When the developer selects the alternative device to be jumped, the reference corresponding to the name of the terminal function can be searched in the alternative device by clicking the hyperlink corresponding to the alternative device. In the above process, the alternative device to be jumped does not need to be located from the result of the global search.
With reference to the first aspect, in a sixth possible implementation manner 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 specifically includes:
and responding to the triggering of the hyperlink, and searching a reference corresponding to the opposite terminal function name in a code module corresponding to a target device name, wherein the target device name is the device name corresponding to the triggered hyperlink.
In the implementation mode, each alternative corresponds to one hyperlink, when a developer selects the alternative device to be skipped, the developer can search the reference corresponding to the name of the opposite-end function in the alternative device by clicking the hyperlink corresponding to the alternative device, and in the process, the alternative device to be skipped does not need to be located from the result of the global search.
In a second aspect, an embodiment of the present application provides a function jump apparatus for non-homonymous symbols, including:
the information processing module is used for responding to a jump instruction of a pairing function and searching function information of the pairing function, wherein the function information comprises an opposite terminal function name, and the opposite terminal function name is a function name of an opposite terminal function having a jump relation with the pairing function;
a link adding module, configured to add a hyperlink to the pairing function, where the hyperlink uses the opposite-end function name as a parameter;
and the reference searching module is used for responding to the trigger of the hyperlink and searching the reference corresponding to the opposite terminal function name.
In this implementation, in response to a jump instruction of a pairing function, the information processing module automatically searches for function information, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function. And then, the link adding module adds a hyperlink to the pairing function by taking the name of the opposite terminal function as a parameter. When the card clicks the skip of the hyperlink trigger function, the reference searching module searches the reference corresponding to the opposite terminal function name. According to the implementation mode, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.
With reference to the first aspect, in a first possible implementation manner of the second aspect, the information processing module includes:
the traversal submodule is used for traversing the annotation information of the pairing function;
and the analysis submodule is used for analyzing the matching label to obtain function information if the annotation information contains the matching label.
In this implementation manner, a pairing tag is added in advance to the annotation information of the function having the jump relationship, and the pairing tag has a preset format, so that the pairing tag can be identified. Based on the mode, the traversal submodule can directly identify the matching tags in the annotation information, and the analysis submodule can only analyze the matching tags under the condition that the annotation information contains the matching tags, so that the data processing amount is small.
With reference to the first aspect, in a second possible implementation manner of the second aspect, the parsing sub-module is further configured to pop up a prompt message if the annotation information does not include a pairing tag, where the prompt message is used to remind a developer that the pairing function does not have a matching peer function.
In the implementation mode, when the annotation information does not contain the pairing tag, the analysis submodule pops up prompt information, and the popped-up prompt information can play a role in prompting a developer.
With reference to the first aspect, in a third possible implementation manner of the second aspect, the pairing tag further includes a first identifier, where the first identifier is used to mark the peer-to-peer function as a transmitting side function or a receiving side function.
In this implementation manner, a first identifier for labeling the pairing function as the transmitting side or the receiving side is added to the pairing tag, and the range of the peer-to-peer function can be limited.
With reference to the first aspect, in a fourth possible implementation manner of the second aspect, if the pairing function supports cross-device hopping, the pairing tag further includes a second identifier.
In this implementation, the second identifier is added to the pairing tag, so that the range of the peer-to-peer function can be further limited.
With reference to the first aspect, in a fifth possible implementation manner of the second aspect, the information processing module is further configured to: configuring an identification document for an alternative device, wherein the identification document comprises function information and a device name, and the alternative device is a device which realizes mutual communication with a device of a pairing function;
and adding hyperlinks to the pairing function, wherein each hyperlink corresponds to an identification document.
In this implementation, the information processing module configures one identification document for each type/each candidate device, and then configures a plurality of hyperlinks for the pairing function, where each hyperlink corresponds to one identification document. When the developer selects the alternative device to be jumped, the reference corresponding to the name of the terminal function can be searched in the alternative device by clicking the hyperlink corresponding to the alternative device. In the above process, the alternative device to be jumped does not need to be located from the result of the global search.
With reference to the first aspect, in a sixth possible implementation manner of the second aspect, the reference searching module is further configured to search for a reference corresponding to the name of the peer function in a code module corresponding to the name of the target device, where the name of the target device is a device name corresponding to the triggered hyperlink, and the method includes:
the calling submodule is used for calling a target device name in response to the triggering of the hyperlink, and the target device name is a device name corresponding to the triggered hyperlink;
the selection submodule is used for selecting the target equipment, and the target equipment is the alternative equipment corresponding to the name of the target equipment;
and the searching submodule is used for searching the reference corresponding to the opposite terminal function name in the code loaded by the target equipment.
In the implementation mode, each alternative corresponds to one hyperlink, when a developer selects the alternative device to be skipped, the developer can search the reference corresponding to the name of the opposite-end function in the alternative device by clicking the hyperlink corresponding to the alternative device, and in the process, the alternative device to be skipped does not need to be located from the result of the global search.
In a third aspect, an embodiment of the present application provides a computer system, where the computer system includes a processor and a memory, where the memory is used to store a computer program, and the processor is used to execute the computer program to implement the method provided in the embodiment of the present application.
In this implementation manner, in response to a jump instruction of a pairing function, function information is automatically searched, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function. And then, adding a hyperlink for the pairing function by taking the name of the opposite terminal function as a parameter. And searching for the reference corresponding to the opposite terminal function name by clicking the jump of the hyperchain trigger function. According to the implementation mode, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.
In a fourth aspect, the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program is used by a processor to implement the method as provided in the present application.
In this implementation manner, in response to a jump instruction of a pairing function, function information is automatically searched, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function. And then, adding a hyperlink for the pairing function by taking the name of the opposite terminal function as a parameter. And searching for the reference corresponding to the opposite terminal function name by clicking the jump of the hyperchain trigger function. According to the implementation mode, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.
Drawings
Fig. 1 is a schematic structural diagram of an apparatus provided in an embodiment of the present application;
FIG. 2 is a flow chart of a method of function hopping of non-homonymous symbols provided in accordance with a possible embodiment;
FIG. 3 is a flow chart of finding function information of a pairing function provided according to a possible embodiment;
FIG. 4 is a schematic view of a device display interface;
fig. 5 is a schematic structural diagram of a function jump apparatus of non-homonymous symbols according to a possible embodiment.
Detailed Description
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, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments.
In the embodiments of the present application, the plural number means two or more. In addition, it is to be understood that the terms first, second, etc. in the description of the present application are used for distinguishing between the descriptions and not necessarily for describing a sequential or chronological order.
Fig. 1 is a schematic diagram of the structure of the apparatus 100. Device 100 may 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, operating system 102 being system software for managing hardware and software resources.
The processor 106 is the control center for the device 100 and connects the various components of the device 100 using various interfaces and buses. In some embodiments, processor 106 may include one or more processing units, otherwise referred to as physical cores, such as processor 106 includes core 0 and core 1 in FIG. 1. Processor 106 may also include registers that may be used to store addresses of functions of core 104. The Processor 106 may be a Central Processing Unit (CPU), and the Processor 106 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), off-the-shelf Programmable gate arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor 106 may be any conventional processor or the like.
The memory 105 stores therein a computer program. The processor 106 is configured to execute the computer program in the memory 105, thereby implementing the functions defined by the computer program. The storage 105 is a non-volatile storage medium, and typically includes both internal and external memory. The Memory includes, but is not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), or cache. External memory includes, but is not limited to, flash memory (flash memory), hard disk, optical disk, Universal Serial Bus (USB) disk, and the like. The computer program is typically stored on an external memory, from which the processor loads the program into the internal memory before executing the computer program. The memory 105 may be independent and connected to the processor 106 through a bus; memory 105 may also be integrated with processor 106 into a chip subsystem.
The communication interface 107 implements communication between the execution apparatus 100 and other apparatuses or a communication network using a transmitting and receiving means such as a transceiver.
In one implementation, the device 100 may be a physical device, such as a server or a terminal device. The terminal device may be a handheld device having wireless connection capability or other processing device connected to a wireless modem. For example, it may be a mobile phone, a computer, a tablet computer, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), a wearable device, an electronic book reader (e-book), etc.; or may be a portable, pocket, hand-held, computer-included, or vehicle-mounted mobile device.
Software development is the process of building a software system or software parts in a system according to user requirements. Software development is a system engineering that includes requirement capture, requirement analysis, design, implementation, and testing. The code jump is one of the most commonly used functions in the software development process, and refers to a process of jumping from one code segment (such as a function, a class, a variable, a method, etc.) to another code segment. The code jumping function can facilitate a developer to better understand the code and accelerate the development efficiency.
In writing code in an IDE, implementing a code jump function requires that the current location code and the code being jumped possess the same-name symbol (the symbol may include a function/interface/class), for example, a jump of a function is a jump from a function declaration in an interface to an interface implementing the same-name function.
The existing jump technology in the IDE can not realize the jump of non-homonymous symbolic functions, and when the jump is needed among different associated homonymous functions, only a manual searching mode can be adopted, thus hindering the development efficiency.
Based on the above technical problem, an embodiment of the present application provides a function jump method for non-homonymous symbols, and specifically, refer to fig. 2; fig. 2 is a flowchart of a function jump method of non-homonymous symbols according to a feasible embodiment, and it can be seen from the diagram that the method includes:
step S201 searches function information of the pairing function in response to the jump instruction of the pairing function, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function.
A function as referred to in this embodiment refers to a piece of program or code that can be directly referenced by another piece of program or code. A larger program is typically divided into several modules, each of which is used to implement a particular function. All high-level languages have a concept of a subprogram, and the functions of a module are realized by the subprogram. In C language, the function of a subroutine is composed of a main function and several functions. Jump from the main function to other functions, and other functions can jump to each other.
The function jump function is realized by requiring that the current position function and the jumped function have the same name symbols. For example, the function named sendMsg and the function named sendMsg belong to the same-name function, and thus, the function named sendMsg and the function named sendMsg may jump to each other.
In order to implement the jump between functions with non-homonymous symbols, the scheme provided in this embodiment labels a plurality of functions that need to implement the jump function in advance, where the labeled functions may be homonymous symbol functions or non-homonymous symbol functions, so as to obtain the mutual jump between the functions with non-homonymous symbols.
In the application, a plurality of functions which need to realize the jump function can be collectively referred to as a function pair, in the function pair, a function corresponding to the cursor stopping position can be referred to as a pairing function, and a function having a jump relation with the pairing function can be referred to as an opposite terminal function. It should be noted that, in the solution provided in this embodiment, the pairing function and the peer-to-peer function are equivalent concepts. For example, for a function pair, the function pair includes two functions, namely a function with a function name sendMsg and a function with a function name subscriptmsg, and if it is predetermined that the function with the function name sendMsg is a pairing function, the function with the function name subscriptmsg is an opposite-end function; if the function with the function name of subscribeMsg is determined to be a pairing function in advance, the function with the function name of sendMsg is the opposite-end function. The embodiment merely describes an exemplary case where the function pair includes two functions, and the number of the functions included in the function pair may be configured according to requirements in an actual process, which is not limited by the applicant herein.
The specific labeling process can be; and adding information such as labels or symbols capable of generating function information into the annotation information of the functions with the jump relationship, wherein the function information at least comprises opposite terminal function names with the jump relationship with the functions. For example, the function with the function name sendMsg and the function with the function name subscriptmsg are a function pair with a jump relationship, and the function information of the function with the function name sendMsg at least includes subscriptmsg.
It should be noted that, in this embodiment, the number of terminal function names included in the function information is not limited, and in some feasible embodiments, the function information of one function may include one terminal function name; in some feasible embodiments, the function information of one function may include a plurality of peer function names.
There are various ways to find the function information of the pairing function;
for example, function information may be directly found in the annotation information of the pairing function, and then the found function information may be found.
Specifically, each function is configured with annotation information corresponding to the function, the annotation information is helpful for reading and understanding the function, and the annotation information may include an explanatory file, such as: the content of the function, the function of the function, the relationship of the function to other files, the date the function was modified, etc. In the solution shown in this embodiment, the annotation information further includes information such as a label or a symbol that can generate the function information. .
In a feasible embodiment, the annotation information can be directly parsed to obtain the function information.
The specific implementation process is as follows: the annotation information initially exists in the form of source code, which needs to be parsed into code in a computer-readable form. In a possible embodiment, the annotation information may be parsed into code in a computer-readable form using an AST (abstract syntax tree) tool. The parsing process may be: (1) lexical analysis scanner, this process decomposes annotation information consisting of characters into meaningful code blocks, collectively referred to as lexical units. (2) And generating the AST tree, wherein the lexical unit flow is converted into a tree which is formed by nesting elements and represents a program syntax structure, the tree is called an abstract syntax tree, and function information is searched in the AST tree. The method for searching for function information in the AST tree may be an information searching method commonly used in the art, and the applicant does not make much limitation herein.
For another example, in order to reduce the data processing amount of the device, an embodiment of the present application provides an implementation manner of finding function information of a pairing function, specifically, referring to fig. 3, where fig. 3 is a flowchart of finding function information of a pairing function provided according to a feasible embodiment, and the method includes:
s301, traversing annotation information of the pairing function;
s302, judging whether the annotation information contains a pairing tag;
the device stores thousands of functions, but each function does not have a skippable non-homonymous symbolic function, and usually, after the annotation information is analyzed, whether the annotation information of the currently operated pairing function contains the function information or not can be known, and the calculation amount of the device is occupied in the analysis process of the annotation information.
In this embodiment, a pairing tag capable of analyzing the function information may be added to the annotation information. The pairing tag has a preset format so that the pairing function can be identified in the annotation information.
There are various pairing tag formats, and any format that can identify the pairing function in the annotation information can be applied to the scheme shown in this embodiment. In a possible embodiment, a preset identifier is added to the pairing tag. The pattern of the preset identifier is not limited in this embodiment. For example, the preset identifier may be @ pair, and the corresponding pairing tag may be: { @ pair packagName.
S303, if the annotation information contains the pairing function, the pairing label is analyzed to obtain function information.
If the comment information contains the pairing tag, it indicates that the pairing function has an opposite-end function with a skip relation with the pairing function, and in this case, the pairing tag can be analyzed to obtain function information. And then configure hyperlinks for the pairing functions based on the function information.
In this implementation manner, the pairing tag may be analyzed by using an AST tool, and the specific analysis process may refer to the analysis process of the annotation information, which is not described herein again.
S304, if the comment information does not contain the pairing function, a prompt message is popped up, and the prompt message is used for reminding a developer that the pairing function does not have a matched opposite terminal function.
If the comment information does not include the pairing function, it is indicated that the pairing function does not have an opposite-end function having a skip relation with the pairing function, in this case, in order to play a prompt role, prompt information may be popped up on a UI (User Interface) Interface of the device, where the prompt information is used to remind a developer of an opposite-end function for which the pairing function does not have a match. The embodiment does not limit the display mode of the prompt information, and all display modes which can play the effect of prompting the developer can be applied to the scheme shown in the application. For example, in one possible embodiment, the reminder information may be presented on the UI interface in the form of a reminder window.
The embodiment is only an exemplary implementation manner showing two manners of finding the function information of the pairing function, and in the actual application process, the implementation manner of finding the function information of the pairing function may be, but is not limited to, the two manners.
S202, adding a hyperlink to the pairing function, wherein the hyperlink takes an opposite-end function name as a parameter;
in this embodiment, the hyperlink refers to a connection relationship from the pairing function to the peer function. The parameters of the hyperlink at least comprise an Href attribute, wherein the Href attribute is used for indicating a peer function, and the name of the peer function is used as the Href attribute in the application. In some feasible embodiments, the parameters of the hyperlink may further include a title attribute, which may set some introduction information for the hyperlink, and when a mouse moves to the hyperlink with the title attribute set, the content of the title attribute value may be displayed; in some possible embodiments, the parameters of the hyperlink may also include a target attribute for controlling the location at which the link function opens. In some feasible embodiments, the parameters of the hyperlink may also include other attributes, not listed herein by the applicant.
S203, responding to the trigger of the hyperlink, searching the reference corresponding to the name of the terminal function.
The scheme shown in this embodiment is further described below with reference to specific examples:
in a possible embodiment, the above solution is applied to a phone device, which may comprise: the system comprises an information processing module, a link adding module and a reference searching module. During software development, the cursor stays at line 6 FeatureAbility.sendmsg of phone/sender.js, and the developer triggers a jump instruction of the pairing function. Js is determined by the message processing module to be a featureability sendmsg function. The information processing module acquires annotation information corresponding to FeatureAbility.sendmsg function; determining that the acquired FeatureAbility.sendmsg annotation information carries a { @ pair FeatureAbility # subscriptmsg } pairing tag; the information processing module analyzes the pairing label to obtain function information of a pairing function at the current position, wherein the function information comprises a FeatureAbility # descriptor Msg of a function name at an opposite end. The link adding module adds a hyperlink for the pairing function, and the hyperlink takes the name of the opposite-end function as a parameter, wherein the hyperlink can be displayed in a floating window mode. In response to the trigger of the developer on the hyperlink, the reference search module stores all references named as FeatureAbility # describe msg of the computer program search function in the memory, each reference has a corresponding file path and a corresponding row number, and the reference found in this embodiment is row 6 in receiver.
In the scheme provided by this embodiment, in response to a jump instruction of a pairing function, function information is automatically called, where the function information includes a function name of an opposite terminal, and the function name of the opposite terminal is a function name of an opposite terminal function having a jump relationship with the pairing function. And then, adding a hyperlink for the pairing function by taking the name of the opposite terminal function as a parameter. And searching for the reference corresponding to the opposite terminal function name by clicking the jump of the hyperchain trigger function. According to the implementation mode, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.
As a feasible embodiment, the pairing tag may further include a first identifier, and the first identifier is used for marking the pairing function as a transmitting side function or a receiving side function.
In this embodiment, the first identifier is used to mark that the peer-to-peer function is a transmitting side or a receiving side, and may be send/receive, publish/describe, or the like. The technical solution shown in this embodiment adds the first identifier for labeling the pairing function as the transmitting side or the receiving side in the pairing tag, which can further limit the range of the peer-to-peer function.
For example, in one possible embodiment, the pairing tag of the pairing function is { @ pair FeatureAbility. sendMsg }. In response to the triggering of the hyperlink, the reference searching module searches all references corresponding to the functions named sendMsg at the send end and the receive end. In a feasible embodiment, the function information of the pairing function is { @ pair FeatureAbility.sendMsg send }, and in response to the triggering of the hyperlink, the reference searching module searches all references corresponding to the function name sendMsg at the send end. It can be seen that adding the first identifier for marking the pairing function as the transmitting side or the receiving side in the pairing tag can define the range of the peer-to-peer function.
In some feasible embodiments, other identifiers may be added to the pairing tag to further define the scope of the peer function. To illustrate, in some feasible embodiments, the function scope can be defined using a scope name, which has different meaning in different languages, in Java represents the package name, in Javascript and C + +, the scope name is the command space name; className is the class name and methodName is the function name.
As a feasible embodiment, the pairing tag further includes a second identifier, the second identifier is used to indicate that cross-device lookup is supported in the referenced lookup process, and if the pairing function supports cross-device hopping, the pairing tag further includes the second identifier.
In this embodiment, the second identifier is used to indicate that cross-device lookup is supported in the lookup process of the reference. The second mark pattern is not limited in this embodiment. For example, in one possible embodiment, the second identifier may be cross. For example, if the current pairing function does not support cross-device lookup, the pairing tag of the pairing function may be { @ pair FeatureAbility. sendMsg send }; if the current pairing function supports cross device lookup, the pairing tag of the pairing function may be { @ pair FeatureAbility. sendMsg send, cross }.
The technical solution shown in this embodiment may further limit the range of the peer function by adding the second identifier to the pairing tag.
For example, in one possible embodiment, the pairing tag of the pairing function is { @ pair FeatureAbility. sendMsg }. And responding to the trigger of the hyperlink, and completely finding out the reference corresponding to the locally stored function name sendMsg by the reference searching module. In a feasible embodiment, the function information of the pairing function is { @ pair FeatureAbility.sendMsg cross }, and in response to the triggering of the hyperlink, all references corresponding to the global function name sendMsg of the reference lookup module are found out, wherein the global function includes functions stored by the device currently operated by the developer and functions stored by the devices capable of communicating with the device currently operated by the developer. It can be seen that adding a second identifier to the pairing tag can further define the scope of the peer function.
As a feasible embodiment, if the pairing tag includes the second identifier, after the step of searching for the function information of the pairing function, the method further includes: configuring an identification document for the alternative equipment, wherein the identification document comprises function information and an equipment name, and the alternative equipment is equipment which realizes mutual communication with equipment of a pairing function; and adding hyperlinks to the pairing function, wherein each hyperlink corresponds to one identification document.
In the scheme shown in the embodiment of the application, an identification document is configured for the alternative device, and the identification document includes function information and a device name. For example, in a possible embodiment, the identification document may be [ tv ] (command: gotoPeer (tv, receive, feature # subscriptibesMsg, cross)), where tv is the device name and (receive, feature # subscriptibesMsg, cross) is the function information.
In some feasible embodiments, one identification document may be configured for each alternative device. For example, the alternative devices to which the currently operating device may connect are tv1, tv2, and watch. 3 identification documents can be configured for 3 alternative devices, respectively: [ tv1] (command: goToPeer (tv1, receive, FeatureAbility # subscriptMsg, cross)); [ tv2] (command: goToPeer (tv2, receive, FeatureAbility # subscriptMsg, cross)); [ watch ] (command: go Peer (watch, receive, feature # subscriptmsg, cross)).
In some feasible embodiments, one identification document may be configured for each type of alternative device. For example, in a possible embodiment, the alternative devices to which the currently operating device may connect are tv1, tv2, and watch. 2 identification documents can be configured for 2 types of alternative devices, which are respectively: [ tv ] (command: go Peer (tv, receive, FeatureAbiliity # subscriptMsg, cross)); [ watch ] (command: go Peer (watch, receive, feature # subscriptmsg, cross)).
It should be noted that the embodiments of the present application are merely exemplary to illustrate two configurations of the markup document, and the configurations of the markup document in the process of practical application may be, but are not limited to, the two configurations.
As a feasible embodiment, if the pairing tag includes the second identifier, in response to the triggering of the hyperlink, the step of searching for the reference corresponding to the peer function name specifically includes:
and responding to the triggering of the hyperlink, and searching the reference corresponding to the opposite terminal function name in a code module corresponding to the target equipment name, wherein the target equipment name is the equipment name corresponding to the triggered hyperlink.
The code module is used for recording codes loaded in equipment used by the recorder.
In the implementation manner, each alternative corresponds to one hyperlink, and when the developer selects the alternative device to be skipped, the developer clicks the hyperlink corresponding to the alternative device, so that the reference searching module searches the reference corresponding to the opposite-end function name in the alternative device. In the above process, the alternative device to be jumped does not need to be located from the result of the global search.
The scheme shown in this embodiment is further described below with reference to specific examples: in a possible embodiment, the above solution is applied to a phone device, which may include: the system comprises an information processing module, a link adding module and a reference searching module. During software development, when the cursor stays at line 6 FeatureAbility.sendmsg of phone/sender.js, the developer triggers a jump instruction of the pairing function. Js is determined by the message processing module to be a featureability sendmsg function. The information processing module acquires annotation information corresponding to FeatureAbility.sendmsg function; determining that the acquired FeatureAbility.sendmsg annotation information carries the { @ pair FeatureAbiliity # subscript receiving cross-device } pairing tag. The information processing module analyzes the pairing label to obtain function information of a pairing function corresponding to the current position: (1) the pairing function name is: FeatureAbiliity # subscripteMsg, (2) the receive identity pairing function is located as a parameter, and the identity document is: [ tv ] (command: gotoPeer (tv, receive, FeatureAbiliity # subsscrimbeMsg, cross)), [ watch ] (command: gotoPeer (watch, receive, FeatureAbiliity # subsscrimbeMsg, cross)); the link addition module adds a hyperlink containing a custom command to each device, the hyperlink having an identification document as a parameter. The hyperlink may be displayed on the UI interface, and the display effect may refer to fig. 4: when a developer clicks a hyperlink [ tv ] (command: gotoPeer (tv, receive, FeatureAbiliity # subsscrimbemsg, cross)) corresponding to the device tv, the reference and search module obtains a function needing to jump, namely FeatureAbiliity # subsscrimbemsg, and a function stored in a device memory with the device type of tv. The reference searching module searches all references of feature extraction # describe msg in a memory of a device corresponding to the tv device type, each reference has a corresponding file path and a corresponding row number column number, and a row 6 in tv/receiver. The presentation interface of the UI interface switches to line 6 in the receiver.js function, completing the jump from featureabilitysendmsg of line 6 of sender.js of phone to receiver.js line 6 of tv.
The embodiment of the present application provides a function jump apparatus with non-homonymous symbols, specifically, refer to fig. 5, where fig. 5 is a schematic diagram of a function jump apparatus with non-homonymous symbols according to a feasible embodiment, where the schematic diagram includes:
a code editor 401, configured to receive a jump instruction of a pairing function;
an information processing module 402, configured to, in response to a jump instruction of a pairing function, search function information of the pairing function, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function;
a link adding module 403, configured to add a hyperlink to the pairing function, where the hyperlink uses the name of the peer function as a parameter;
the command processing module 404 is configured to invoke a reference search module in response to triggering the hyperlink;
and a reference searching module 405, configured to search, in response to the triggering of the hyperlink, a reference corresponding to the name of the peer function.
In this implementation, in response to a jump instruction of a pairing function, the information processing module automatically searches for function information, where the function information includes an opposite-end function name, and the opposite-end function name is a function name of an opposite-end function having a jump relationship with the pairing function. And then, the link adding module adds a hyperlink to the pairing function by taking the name of the opposite terminal function as a parameter. When the card clicks the skip of the hyperlink trigger function, the reference searching module searches the reference corresponding to the opposite terminal function name. According to the implementation mode, automatic skip can be realized even among functions with non-homonymous symbols, and the software development efficiency is improved to a certain extent.
In one possible implementation, the information processing module includes:
the traversal submodule is used for traversing the annotation information of the pairing function;
and the analysis submodule is used for analyzing the matching label to obtain function information if the annotation information contains the matching label.
In this implementation manner, a pairing tag is added to the annotation information of the function having the jump relationship in advance, and the pairing tag has a preset format, so that the pairing tag can be identified. Based on the mode, the traversing sub-module can directly identify the matching tags in the annotation information, and the analyzing sub-module can only analyze the matching tags under the condition that the annotation information contains the matching tags, so that the data processing amount is small.
In a possible implementation manner, the parsing sub-module is further configured to pop up prompt information if the annotation information does not include a pairing tag, where the prompt information is used to remind a developer that the pairing function does not have a matched peer function.
In the implementation mode, the analysis sub-module pops up prompt information under the condition that the annotation information does not contain the pairing tag, and the popped-up prompt information can play a role in prompting a developer.
In a possible implementation manner, the pairing tag further includes a first identifier, where the first identifier is used to mark the peer-to-peer function as a transmitting side function or a receiving side function.
In this implementation manner, a first identifier for labeling the pairing function as the transmitting side or the receiving side is added to the pairing tag, and the range of the peer-to-peer function can be limited.
In one possible implementation, if the pairing function supports cross-device hopping, the pairing tag further includes a second identifier.
In this implementation, the second identifier is added to the pairing tag, so that the range of the peer-to-peer function can be further limited.
In one possible implementation, the information processing module is further configured to: configuring an identification document for an alternative device, wherein the identification document comprises function information and a device name, and the alternative device is a device which realizes mutual communication with a device of a pairing function;
and adding hyperlinks to the pairing function, wherein each hyperlink corresponds to an identification document.
In this implementation, the information processing module configures one identification document for each type/each candidate device, and then configures a plurality of hyperlinks for the pairing function, where each hyperlink corresponds to one identification document. When the developer selects the alternative device to be jumped, the reference corresponding to the name of the terminal function can be searched in the alternative device by clicking the hyperlink corresponding to the alternative device. In the above process, the alternative device to be jumped does not need to be located from the result of the global search.
In a possible implementation manner, the reference searching module is further configured to search for a reference corresponding to the name of the peer function in a code module corresponding to the name of the target device, where the name of the target device is a device name corresponding to the triggered hyperlink.
In the implementation mode, each alternative corresponds to one hyperlink, when a developer selects the alternative device to be skipped, the developer can search the reference corresponding to the name of the opposite-end function in the alternative device by clicking the hyperlink corresponding to the alternative device, and in the process, the alternative device to be skipped does not need to be located from the result of the global search.
The embodiment of the application provides a computer system, which comprises a processor and a memory, wherein the memory is used for storing a computer program, and the processor is used for executing the computer program to realize the method provided by the embodiment of the application.
Embodiments of the present application further provide a computer storage medium, where the computer storage medium includes computer instructions, and when the computer instructions are run on the electronic device, the electronic device is caused to perform each function or step performed by the electronic device in the foregoing method embodiments.
Embodiments of the present application further provide a computer program product, which, when running on a computer, causes the computer to perform each function or step performed by the electronic device in the above method embodiments.
Through the description of the above embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
It is understood that a person skilled in the art can combine, split, recombine and the like the embodiments of the present application to obtain other embodiments on the basis of several embodiments provided by the present application, and the embodiments do not depart from the scope of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A function jump method of non-homonymous symbols is characterized by comprising the following steps:
responding to a jump instruction of a pairing function, searching function information of the pairing function, wherein the function information comprises an opposite terminal function name, and the opposite terminal function name is the function name of an opposite terminal function having a jump relation with the pairing function;
adding a hyperlink to the pairing function, wherein the hyperlink takes the name of the opposite terminal function as a parameter;
and responding to the trigger of the hyperlink, and searching a reference corresponding to the name of the opposite terminal function.
2. The function hopping method according to claim 1, wherein the step of finding the function information of the pairing function includes:
traversing annotation information of the pairing function;
and if the annotation information contains a pairing tag, analyzing the pairing tag to obtain the function information, wherein the pairing tag exists in a preset format so that the pairing tag can be identified.
3. The function hopping method according to claim 2, wherein if the comment information does not include a pairing tag, a prompt message for reminding a developer that the pairing function does not have a matching counterpart function pops up.
4. The function hopping method according to claim 3, wherein the pairing tag includes a first identifier, and the first identifier is used for marking the peer-to-peer function as a transmitting side function or a receiving side function.
5. The function hopping method of claim 4, wherein if the pairing function supports cross-device hopping, the pairing tag further comprises a second identifier indicating that cross-device lookup is supported in a reference lookup process.
6. The function hopping method according to claim 5, wherein after the step of finding function information of the pairing function, the method further comprises:
configuring an identification document for an alternative device, wherein the identification document comprises function information and a device name, and the alternative device is a device which realizes mutual communication with a device of a pairing function;
and adding hyperlinks to the pairing function, wherein each hyperlink corresponds to an identification document.
7. The function hopping method according to claim 6, wherein the step of searching for the reference corresponding to the opposite-end function name in response to the triggering of the hyperlink specifically includes:
and responding to the triggering of the hyperlink, and searching a reference corresponding to the opposite terminal function name in a code module corresponding to a target device name, wherein the target device name is the device name corresponding to the triggered hyperlink.
8. A function jump apparatus for non-homonymous symbols, comprising:
the information processing module is used for responding to a jump instruction of a pairing function and searching function information of the pairing function, wherein the function information comprises an opposite terminal function name, and the opposite terminal function name is a function name of an opposite terminal function having a jump relation with the pairing function;
a link adding module, configured to add a hyperlink to the pairing function, where the hyperlink uses the opposite-end function name as a parameter;
and the reference searching module is used for responding to the trigger of the hyperlink and searching the reference corresponding to the opposite terminal function name.
9. The function jump apparatus according to claim 8, wherein said information processing module comprises:
the traversal submodule is used for traversing the annotation information of the pairing function;
and the analysis submodule is used for analyzing the pairing label to obtain function information if the annotation information contains the pairing label, and the pairing label exists in a preset format so as to be identified.
10. The function jump apparatus according to claim 9, wherein the parsing sub-module is further configured to pop up a prompt message if the annotation information does not include a pairing tag, where the prompt message is used to remind a developer that the pairing function does not have a matching peer function.
11. The function jump apparatus according to claim 8, wherein the pairing tag further comprises a first identifier for marking the peer function as a transmitting side function or a receiving side function.
12. The function hopping apparatus of claim 11, wherein if the pairing function supports cross-device hopping, the pairing tag further comprises a second identifier indicating that cross-device lookup is supported in a reference lookup process.
13. The function hopping apparatus as claimed in claim 12, wherein the information processing module is further configured to:
configuring an identification document for an alternative device, wherein the identification document comprises function information and a device name, and the alternative device is a device which realizes mutual communication with a device of a pairing function;
and adding hyperlinks to the pairing function, wherein each hyperlink corresponds to an identification document.
14. The function hopping apparatus of claim 13, wherein the reference lookup module is further configured to:
and searching the reference corresponding to the opposite terminal function name in a code module corresponding to the target equipment name, wherein the target equipment name is the equipment name corresponding to the triggered hyperlink.
15. A computer system, characterized in that the computer system comprises a processor and a memory for storing a computer program, the processor being adapted to execute the computer program to implement the method according to any of the claims 1-7.
16. A computer-readable storage medium, in which a computer program is stored which is used by a processor for implementing the method according to any one of the preceding claims 1 to 7.
CN202110143762.7A 2021-02-02 2021-02-02 Function jump method and device for non-homonymous symbols and computer readable storage medium Pending CN114840204A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110143762.7A CN114840204A (en) 2021-02-02 2021-02-02 Function jump method and device for non-homonymous symbols and computer readable storage medium
PCT/CN2021/137695 WO2022166410A1 (en) 2021-02-02 2021-12-14 Method and apparatus for jumping between functions having symbols with different names, and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110143762.7A CN114840204A (en) 2021-02-02 2021-02-02 Function jump method and device for non-homonymous symbols and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114840204A true CN114840204A (en) 2022-08-02

Family

ID=82561074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110143762.7A Pending CN114840204A (en) 2021-02-02 2021-02-02 Function jump method and device for non-homonymous symbols and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN114840204A (en)
WO (1) WO2022166410A1 (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080039080A (en) * 2006-10-31 2008-05-07 에스케이 텔레콤주식회사 Terminal having an interfacing function of the heterogeneity language compile library, api calling method and compile function generating method
CN103294457B (en) * 2012-02-27 2017-02-01 百度在线网络技术(北京)有限公司 Method and device for dynamically substituting C/C + + function in main program
CN106126235B (en) * 2016-06-24 2019-05-07 中国科学院信息工程研究所 A kind of multiplexing code base construction method, the quick source tracing method of multiplexing code and system
CN110362356B (en) * 2018-04-09 2022-06-24 腾讯科技(深圳)有限公司 Function data processing method and device, computer equipment and storage medium
CN112015491B (en) * 2019-05-30 2022-08-09 华为技术有限公司 Method, device and computer storage medium for realizing function jump
CN110321118A (en) * 2019-07-05 2019-10-11 深圳市智慧郎数码科技有限公司 The generation method and relevant device of function code

Also Published As

Publication number Publication date
WO2022166410A1 (en) 2022-08-11

Similar Documents

Publication Publication Date Title
KR102436987B1 (en) Method and terminal device for extracting web page content
KR102497463B1 (en) Mini-program execution method, mini-program execution device, electronic device and storage medium
EP3605324B1 (en) Application development method and tool, and storage medium thereof
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
CN102741812B (en) Execution of dynamic languages via metadata extraction
CN111142988B (en) Page test method and device, storage medium and electronic equipment
CN109062563B (en) Method and device for generating page
CN110688307B (en) JavaScript code detection method, device, equipment and storage medium
CN111291374B (en) Application program detection method, device and equipment
CN111736840A (en) Compiling method and running method of applet, storage medium and electronic equipment
KR20150132161A (en) Javascript debugging using just my code
CN108494762A (en) Web access method, device and computer readable storage medium, terminal
JP2023541186A (en) Visualization page rendering method, device, equipment and storage medium
CN111191171A (en) Multi-Fragment loading method and device based on android and electronic equipment
CN112527386B (en) Application program issuing method and device
CN107797996B (en) Entry translation method and device
CN113268245A (en) Code analysis method, device and storage medium
CN111913741B (en) Object interception method, device, medium and electronic equipment
CN111158777B (en) Component calling method, device and computer readable storage medium
US20130151945A1 (en) Processing Published and Subscribed Events
CN113127776A (en) Breadcrumb path generation method and device and terminal equipment
CN114840204A (en) Function jump method and device for non-homonymous symbols and computer readable storage medium
CN112162954B (en) User operation log generation and path positioning method, device, equipment and medium
CN112800078A (en) Lightweight text labeling method, system, equipment and storage medium based on javascript
CN109213502B (en) Application updating method and device

Legal Events

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