Skip control method and device, electronic equipment and storage medium

By identifying and jumping to the location of SDK source code elements, the problem of developers being unable to directly jump to editable source code is solved, thus improving development efficiency.

CN121387294APending Publication Date: 2026-01-23GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511386919.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

In existing technologies, developers cannot directly jump to the editable SDK source code, resulting in low development efficiency, as they cannot directly jump to the declared source code location through the integrated development environment.

Method used

By identifying whether the target element originates from the target compiled file, the location of its corresponding source code element is determined, and jump control is performed after determination to ensure that the jump to the location of the source code element is achieved.

Benefits of technology

It improves development efficiency, enabling developers to directly edit source code elements and reducing the time cost of manual searching and decompiling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121387294A_ABST
    Figure CN121387294A_ABST
Patent Text Reader

Abstract

The invention discloses a jump control method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining element information of a target element and a file path corresponding to the target element after jump through responding to an element jump operation of the target element in a code of a target item; under the condition that the file path indicates that the target element comes from a target compiling file of the target project, position information of a target source code element corresponding to the target element is determined in a source code file of the target project based on the element information, and the target compiling file is obtained by compiling at least part of the source code file of the target project; and performing jump control based on the position information of the target source code element. Therefore, when the jump control is carried out on the element, the position of the corresponding source code element can be accurately jumped to instead of only the position of a decompiled file obtained after the target compiled file is decompiled, so that a developer can edit the source code element, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to a jump control method and device, electronic equipment and a storage medium. BACKGROUND

[0002] In the existing project design, the component-based acceleration idea is adopted, and the exposed source code is placed under ${moduleName} / src / main / sdk. The source code under this directory is compiled into a ${moduleName}.jar package in advance, and then the source code in ** / src / main / java is dependent. That is, when other modules use the Software Development Kit (SDK) code, the actual use is the Jar package instead of the source code of the SDK.

[0003] This results in that when the source code is queried using the "jump to declaration" function of Android Studio, the developer can only jump to the bytecode (i.e., the.class file) of the decompiled Jar package, and cannot directly jump to the editable SDK source code, which seriously affects the development efficiency. SUMMARY

[0004] The embodiments of the present application provide a jump control method and device, electronic equipment and a storage medium. By identifying whether an element that needs to be controlled to jump is from a target compiled file, the position of a source code element corresponding to the element is determined in the case that the element is from the target compiled file, so that when the element is controlled to jump, it can be accurately jumped to the position of the corresponding source code element instead of only being jumped to the position of a decompiled file obtained by decompiling the target compiled file, so that the developer can edit the source code element and improve the development efficiency.

[0005] In a first aspect, the embodiments of the present application provide a jump control method, which comprises:

[0006] In response to an element jump operation on a target element in the code of a target project, element information of the target element and a file path after jumping of the target element are obtained;

[0007] In the case that the file path indicates that the target element is from a target compiled file of the target project, position information of a target source code element corresponding to the target element is determined in a source code file of the target project based on the element information, wherein the target compiled file is a file obtained by compiling at least part of the source code file of the target project;

[0008] Based on the position information of the target source code element, jump control is performed.

[0009] In a second aspect, an embodiment of the present application provides a jump control device, comprising:

[0010] an information obtaining module, configured to obtain element information of a target element and a file path after jump of the target element in response to an element jump operation on the target element in a code of a target project;

[0011] a position determining module, configured to determine position information of a target source code element corresponding to the target element in a source code file of the target project based on the element information in a case where the file path indicates that the target element is derived from a target compiled file of the target project, wherein the target compiled file is a file obtained by compiling at least part of source code files of the target project;

[0012] a control module, configured to perform jump control based on the position information of the target source code element.

[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes steps of any jump control method.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes steps of any jump control method.

[0015] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program stored in a computer readable storage medium; when a processor of an electronic device reads the computer program from the computer readable storage medium, the processor executes the computer program, so that the electronic device executes steps of any jump control method provided by an embodiment of the present application.

[0016] By adopting the scheme of the embodiments of the present application, the element information of the target element and the file path after jumping of the target element can be acquired in response to the element jump operation on the target element in the code of the target project; in the case that the file path indicates that the target element is from the target compilation file of the target project, the position information of the target source code element corresponding to the target element is determined in the source code file of the target project based on the element information, wherein the target compilation file is a file obtained by compiling at least part of the source code file of the target project; and the jump control is performed based on the position information of the target source code element. In this way, by identifying whether the element that needs to be subjected to the jump control is from the target compilation file, the position of the source code element corresponding to the element is further determined in the case that the element is determined to be from the target compilation file, so that the corresponding source code element can be accurately jumped to when the element is subjected to the jump control, instead of being only jumped to the position of the decompilation file obtained by decompiling the target compilation file, so that the developer can edit the source code element and the development efficiency is improved. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0018] Figure 1 is an implementation environment scene schematic diagram of the jump control method provided in the embodiments of the present application;

[0019] Figure 2 is a flowchart of the jump control method provided in the embodiments of the present application;

[0020] Figure 3 is a flowchart of a specific embodiment of the jump control method provided in the embodiments of the present application;

[0021] Figure 4 is a flowchart of the query source code element in the specific embodiment of the jump control method provided in the embodiments of the present application;

[0022] Figure 5 is a structural schematic diagram of the jump control device provided in the embodiments of the present application;

[0023] Figure 6 is a structural schematic diagram of the electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION

[0024] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application. Meanwhile, in the description of the embodiments of the present application, the terms "first", "second" and the like are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance. Therefore, the features with "first", "second" can explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.

[0025] The embodiments of the present application provide a jump control method and device, electronic equipment and computer readable storage medium.

[0026] Specifically, the embodiments will be described from the perspective of a jump control device, which can be integrated in electronic equipment, i.e. the jump control method of the embodiments of the present application can be executed by electronic equipment. The electronic equipment can be a server, a terminal or the like.

[0027] The server can be a stand-alone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a device that includes receiving and transmitting hardware, i.e. a device with receiving and transmitting hardware capable of performing bidirectional communication on a bidirectional communication link. The terminal can include but is not limited to mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. The terminal and the server can be connected directly or indirectly through wired or wireless communication, which is not limited in the present application.

[0028] Please refer to Figure 1 For example, the jump control device is integrated in electronic equipment, Figure 1The implementation scenario of the jump control method provided in the embodiments of the present application is shown in the figure, wherein the electronic device can be a terminal device, and the terminal device is configured to, in response to an element jump operation on a target element in a code of a target project, acquire element information of the target element and a file path after jump corresponding to the target element; in a case where the file path indicates that the target element is from a target compilation file of the target project, determine position information of a target source code element corresponding to the target element in a source code file of the target project based on the element information, wherein the target compilation file is a file obtained by compiling at least part of the source code file of the target project; and perform jump control based on the position information of the target source code element. In this way, by identifying whether an element that needs to be subjected to jump control is from a target compilation file, in a case where it is determined that the element is from the target compilation file, the position of a source code element corresponding to the element is further determined, so that when the element is subjected to jump control, the position of the corresponding source code element can be accurately jumped to, instead of being jumped to the position of a decompilation file obtained by decompiling the target compilation file, so that a developer can edit the source code element and the development efficiency is improved.

[0029] It should be noted that, Figure 1 The implementation environment scenario of the jump control method shown in the figure is only an example, and the implementation environment scenario of the jump control method described in the embodiments of the present application is used to more clearly illustrate the technical solutions of the embodiments of the present application, and does not constitute a limitation on the technical solutions provided in the embodiments of the present application. It can be known by those skilled in the art that, with the evolution of data processing and the appearance of new business scenarios, the technical solutions provided in the present application are also applicable to similar technical problems.

[0030] The scheme provided in the embodiments of the present application is described in detail through the following embodiments. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments.

[0031] The present embodiment will be described from the perspective of a jump control device, which can be integrated in an electronic device. The electronic device can be a terminal and / or a server, which is not limited in the present application.

[0032] The embodiments of the present application provide a jump control method, please refer to Figure 2 , Figure 2 The specific flow of the jump control method provided in the embodiments of the present application can be as follows:

[0033] Step 101, in response to an element jump operation on a target element in a code of a target project, acquiring element information of the target element and a file path after jump corresponding to the target element.

[0034] The target project refers to a project started in the integrated development environment. The integrated development environment can be determined according to the specific environment of the started project, and is not limited here. For example, the integrated development environment is an Android Studio environment.

[0035] The target element refers to a code element that needs to be controlled by jumping.

[0036] It can be understood that the integrated development environment provides a function of “jumping to declaration”. The integrated development environment starts the project and displays the code in the project through the interface provided by the integrated development environment. The user can select a certain element in the code of the project in the integrated development environment to trigger the function of “jumping to declaration”. The certain element includes at least one of a class, a variable, a method, and a function, and the specific selection can be selected according to actual conditions, which is not limited here.

[0037] The element jump operation refers to an operation of triggering the function of “jumping to declaration”, and the triggering manner can be various, which can be adjusted according to actual conditions, and the embodiments of the present application are not limited. For example, the element jump operation can be triggered based on a shortcut (such as Ctrl+Click or Ctrl+B). For another example, the element jump operation can also be triggered based on a preset touch manner (such as double-click or triple-click based on a mouse or a finger).

[0038] The element information refers to related information contained in the target element. The element information includes but is not limited to an element name and an element type of the target element, and the specific selection can be adjusted according to actual conditions, which is not limited in the embodiments of the present application.

[0039] The file path refers to a file path for triggering the function of “jumping to declaration” and performing jump control. In the case that the target element is derived from a compiled file of the target project, the file path indicates jumping to a decompiled file obtained by decompiling the compiled file. In the case that the target element is not derived from the compiled file of the target project, the file path indicates jumping to a source code element corresponding to the target element.

[0040] Specifically, the process of obtaining the element information of the target element and the file path after jumping corresponding to the target element in response to the element jump operation on the target element in the code of the target project can include: generating a jump request of the target element in response to the element jump operation on the target element in the code of the target project, the jump request including the element information of the target element and the file path after jumping corresponding to the target element; intercepting the jump request through a preset component, and extracting the file path and the element information from the jump request.

[0041] The preset component can be a plug-in installed in the integrated development environment or other components.

[0042] In step 102, in a case where the file path indicates that the target element is derived from a target compilation file of the target project, location information of a target source code element corresponding to the target element is determined in a source code file of the target project based on the element information, wherein the target compilation file is a file obtained by compiling at least part of source code files of the target project.

[0043] The target compilation file refers to a special compilation file in the target project.

[0044] The target compilation file can be all compilation files in the target project, or part of the compilation files in the target project.

[0045] Specifically, in a case where the target compilation file is all compilation files in the target project, when the target element is derived from a compilation file of the target project and the function of "jumping to declaration" is triggered for the target element, the corresponding source code element is only needed to be jumped to.

[0046] In a case where the target compilation file is part of the compilation files in the target project, when the target element is derived from a target compilation file of the target project and the function of "jumping to declaration" is triggered for the target element, the corresponding source code element is needed to be jumped to, instead of only jumping to a position of a decompiled file obtained by decompiling the target compilation file. When the target element is derived from a compilation file other than the target compilation file of the target project and the function of "jumping to declaration" is triggered for the target element, the decompiled file obtained by decompiling the target compilation file can be directly jumped to.

[0047] The target compilation file can be adjusted according to actual conditions, which is not limited in the embodiments of the present application. For example, the target compilation file includes com.netease.gl.component.jar and com.netease.gl.service.jar, wherein com.netease.gl.component.jar represents that the package name of the jar package to which the target compilation file belongs is com.netease.gl.component, and com.netease.gl.service.jar represents that the package name of the jar package to which the target compilation file belongs is com.netease.gl.service.

[0048] The target source code element refers to a source code element corresponding to the target element. The location information of the target source code element refers to a position of a declaration corresponding to the target element in the target project.

[0049] The source code file refers to a file storing source code elements included in the target project.

[0050] It should be noted that there are various ways to determine whether the target element is derived from the target compilation file of the target project based on the file path, which can be adjusted according to actual conditions, and the embodiments of the present application are not limited.

[0051] In an embodiment, in the case where the target compilation file is a part of the compilation files in the target project, the file name and the file identifier can be extracted from the file path; in the case where the file identifier matches the compilation file identifier and the file name matches the specific compilation file name, it is determined that the file path indicates that the target element is derived from the target compilation file of the target project, otherwise, it is determined that the file path indicates that the target element is not derived from the target compilation file of the target project.

[0052] In an embodiment, in the case where the target compilation file is all the compilation files in the target project, only the file identifier can be extracted from the file path; in the case where the file identifier matches the compilation file identifier, it is determined that the file path indicates that the target element is derived from the target compilation file of the target project, otherwise, it is determined that the file path indicates that the target element is not derived from the target compilation file of the target project.

[0053] The file name refers to the file name of the file contained in the file path. The specific compilation file name refers to the file name of the part of the compilation files in the target project, which is required to jump to the position of the corresponding source code element when the target element is triggered to jump to the declaration function.

[0054] The file identifier is used to identify the type of the file contained in the file path (such as source code file, compilation file, etc.). The compilation file identifier is used to identify that the type of the file contained in the file path is a compilation file.

[0055] In some embodiments, the above process of determining the position information of the target source code element corresponding to the target element in the source code file of the target project based on the element information can include: obtaining the fully qualified name corresponding to the target element, the fully qualified name including the file name and the class name of the class corresponding to the target element; based on the fully qualified name, determining the target source code file in which the target source code element corresponding to the target element is located from the source code file of the target project; based on the element name of the target element, determining the position information of the target source code element in the target source code file from the target source code file.

[0056] The fully qualified name (Fully Qualified Name, FQN) refers to a class name that can contain a complete package path, which can be used to uniquely identify the source code file from which the target element is derived.

[0057] The target source code file refers to a source code file in which the target source code element corresponding to the target element is located.

[0058] The process of determining the fully qualified name can be determined according to the element type of the target element.

[0059] Specifically, in the case of the target element being a class, the fully qualified name is determined according to the element name of the target element and the file name of the compiled file extracted from the file path.

[0060] In the case of the target element being a variable, a method or a function, a target class containing the target element is determined from a plurality of classes contained in the target source code file, and the fully qualified name is determined according to the class name of the target class and the file name of the compiled file extracted from the file path.

[0061] The process of determining the location information of the target source code element in the target source code file based on the element name of the target element from the target source code file can be determined according to the element type of the target element.

[0062] Specifically, in the case of the target element being a class, the location information of the target source code element in the target source code file is determined based on the element name of the target element from the target source code file.

[0063] In the case of the target element being a variable, a method or a function, a target class containing the target element is determined from the target source code file, and the location information of the target source code element in the target source code file is found based on the element name of the target element in the target class.

[0064] It should be noted that the compiled file can be obtained based on different compiled languages, and in different compiled languages, there are some differences in the process of determining the target source code file in which the target source code element corresponding to the target element is located and determining the location information of the target source code element in the target source code file, which can be adjusted according to the compiled language. The embodiments of the present application are not limited.

[0065] The compiled language can include but is not limited to Java language, Kotlin language. Subsequent embodiments will be explained and described taking Java language and Kotlin language as examples, but the feasibility of other programming languages is not excluded.

[0066] Therefore, the process of determining the target source code file in which the target source code element corresponding to the target element is located and determining the location information of the target source code element in the target source code file can be adjusted according to the element type of the target element.

[0067] Specifically, the element types under the Java language include, but are not limited to, Java classes, Java methods, and Java fields. The element types under the Kotlin language include, but are not limited to, Kotlin classes, Kotlin objects, Kotlin functions, and Kotlin properties.

[0068] In an embodiment, in a case where the target element is a class and the compiled file is compiled based on the Kotlin language, that is, the element type of the target element is a Kotlin class.

[0069] Thus, the process of determining the target source code file in which the target source code element corresponding to the target element is located can include: in a case where the target source code file is not determined based on the fully qualified name, obtaining a target index matched with the target element; and determining, based on the target index, the target source code file in which the target source code element corresponding to the target element is located from the source code files of the target project.

[0070] The target index is used to determine, among the plurality of source code files of the target project, a source code file containing the target element.

[0071] The process of obtaining the target index matched with the target element can include: determining the target index matched with the target element based on a correspondence between the plurality of preset elements and the plurality of preset indexes.

[0072] Each preset index is used to determine, among the plurality of source code files of the target project, a source code file containing a corresponding preset element.

[0073] In an embodiment, in a case where the target element is a method or a function, that is, the element type of the target element can be a Kotlin method, a Kotlin function, a Java method, or a Java function.

[0074] Thus, the process of searching for the target source code element in the target class based on the element name of the target element can include: obtaining first parameter information of a parameter corresponding to the target element; determining, in the target class, at least one candidate source code element based on the element name of the target element and second parameter information of candidate parameters corresponding to the candidate source code elements; and searching for the target source code element based on the first parameter information and the second parameter information, wherein the target source code element indicates a candidate source code element corresponding to second parameter information matched with the first parameter information.

[0075] The number of parameters corresponding to the target element can be any integer greater than or equal to 0. For example, the number of parameters corresponding to the target element is 0, that is, the target element has no parameter. For another example, the number of parameters corresponding to the target element is 1, that is, the target element has one parameter. For another example, the number of parameters corresponding to the target element is 2, that is, the target element has two parameters.

[0076] The first parameter information is used to indicate parameter information of a corresponding input parameter. The parameter information includes, but is not limited to, a type reference, a parameter type, and a parameter text.

[0077] The candidate source code element refers to a source code element that matches an element name of the target element. The candidate input parameter refers to an input parameter included in the candidate source code element.

[0078] The number of input parameters corresponding to the candidate source code element can be any integer greater than or equal to 0. For example, the number of input parameters corresponding to the candidate source code element is 0, that is, the candidate source code element has no input parameter. For another example, the number of input parameters corresponding to the candidate source code element is 1, that is, the candidate source code element has one input parameter. For another example, the number of input parameters corresponding to the candidate source code element is 2, that is, the candidate source code element has two input parameters.

[0079] The second parameter information is used to indicate parameter information of a corresponding candidate input parameter. The parameter information includes, but is not limited to, a type reference, a parameter type, and a parameter text.

[0080] The process of searching for the target source code element based on the first parameter information and the second parameter information can include: comparing the contents included in the first parameter information and the second parameter information. If the contents included in the first parameter information and the second parameter information are different, it is determined that the candidate source code element corresponding to the second parameter information is not the target source code element. If the contents included in the first parameter information and the second parameter information are the same, it is determined that the candidate source code element corresponding to the second parameter information is the target source code element.

[0081] It should be noted that the above method is applicable to Java methods and Java functions that carry input parameters.

[0082] In an embodiment, when the target element is a method or a function, and the compiled file is obtained based on Kotlin language compilation, that is, the target element is a Kotlin method or a Kotlin function.

[0083] The process of searching for the target source code element based on the first parameter information and the second parameter information can include: comparing the type reference in the first parameter information and the type reference in the second parameter information to obtain a first comparison result; in the case that the first comparison result indicates that there is a difference, comparing the parameter type in the first parameter information and the parameter type in the second parameter information to obtain a second comparison result; in the case that the second comparison result indicates that there is a difference, comparing the parameter text in the first parameter information and the parameter text in the second parameter information to obtain a third comparison result; in the case that the first comparison result, or the second comparison result, or the third comparison result indicates that they are the same, the candidate source code element corresponding to the second parameter information is taken as the target source code element.

[0084] The first comparison result indicates a comparison result corresponding to a type reference, the second comparison result indicates a comparison result corresponding to a parameter type, and the third comparison result indicates a comparison result corresponding to a parameter text.

[0085] It can be understood that for the Kotlin method or the Kotlin function, three comparison strategies are set for the parameter type comparison. The first comparison strategy is type reference comparison, the second comparison strategy is parameter type comparison, and the third comparison strategy is parameter text comparison.

[0086] In the first comparison strategy, accurate type information is obtained by using the analyze() method of the Kotlin compiler, and accurate type comparison is performed by using BindingContext.TYPE. In the second comparison strategy, when direct type comparison fails, comparison is performed by using the fully qualified name of the type descriptor, and complex situations such as type alias and generic are handled. The third comparison strategy is used as the last fallback solution, and normalized text comparison is used.

[0087] In this way, the three-layer progressive type comparison strategy is adopted, the most accurate and efficient comparison method is used in priority, the matching efficiency is improved, unnecessary repeated calculation is avoided, the processing efficiency is improved, and in addition, in the case of type analysis failure and the like, the text comparison can be automatically returned to ensure the function stability, so that a comparison result can be given in various complex situations.

[0088] In an embodiment, in a case where the file path indicates that the target element is derived from a target compilation file of the target project, and the element type of the target element belongs to a specific element type, the position information of the target source code element corresponding to the target element is determined based on the element information in the source code file of the target project.

[0089] In a case where the file path indicates that the target element is derived from a target compilation file of the target project, and the element type of the target element does not belong to a specific element type, the decompiled file obtained by decompiling the target compilation file is jumped to.

[0090] The specific element type can be adjusted according to actual conditions, and embodiments of the present application are not limited. For example, the specific element type includes a Java class, a Java method, a Java field, a Kotlin class, a Kotlin object, a Kotlin function, and a Kotlin attribute.

[0091] In step 103, the jump control is performed based on the position information of the target source code element.

[0092] The specific operation of the jump control can be set according to actual conditions, and embodiments of the present application are not limited.

[0093] In an embodiment, the process of performing the jump control based on the position information of the target source code element can include: jumping to the target source code element based on the position information of the target source code element.

[0094] In an embodiment, the process of performing the jump control based on the position information of the target source code element can further include: generating a jump option, wherein the jump option includes a first jump option and a second jump option, the first jump option is generated based on a file path, and the second jump option is generated based on the position information of the target source code element; in response to a triggering operation on the first jump option in the jump option, jumping to a decompiled file obtained by decompiling the target compiled file; and in response to a triggering operation on the second jump option in the jump option, jumping to the target source code element.

[0095] It should be noted that the existing project design uses a componentized acceleration idea, and the exposed source code is placed under ${moduleName} / src / main / sdk. The source code in this directory is compiled into a ${moduleName}.jar package in advance, and then the source code in ** / src / main / java is dependent. That is, when other modules use the SDK code, the actual use is the Jar package instead of the source code of the SDK.

[0096] This results in that when the source code is queried using the "jump to declaration" function of Android Studio, the developer can only jump to the decompiled bytecode (i.e..class file) in the Jar package, and cannot directly jump to the editable SDK source code, which seriously affects the development efficiency.

[0097] In addition, the method for solving the existing problems usually includes: the developer manually locates the SDK source code position for viewing and modification, or finds the corresponding source code file through the provided file search function, or manually browses the corresponding SDK source code file in the directory of the project.

[0098] However, the above solution has the problems that the developer needs to manually find the corresponding source code file, which increases unnecessary time cost and cognitive burden, the jump link from the use position to the source code position is interrupted, which affects the coherence of code reading and debugging, and when using the "jump to declaration" function, only the decompiled file in the Jar package can be jumped to, and the editable source code cannot be directly accessed.

[0099] The scheme of the embodiment of the application can obtain element information of the target element and a file path after jumping of the target element by responding to the element jump operation of the target element in the code of the target project; in the case that the file path indicates that the target element is from a target compilation file of the target project, the position information of a target source code element corresponding to the target element is determined in a source code file of the target project based on the element information, wherein the target compilation file is a file obtained by compiling at least part of the source code file of the target project; and the jump control is performed based on the position information of the target source code element. In this way, by identifying whether the element that needs to be controlled to jump is from the target compilation file, the position of the source code element corresponding to the element is further determined in the case that the element is determined to be from the target compilation file, so that the corresponding source code element can be accurately jumped to when the element is controlled to jump, instead of being only jumped to the position of the decompilation file obtained by decompiling the target compilation file, so that the developer can edit the source code element and improve the development efficiency.

[0100] In order to facilitate understanding of the jump control method of the application, a specific embodiment is explained and described below. As shown in Figure 3 The specific steps of the jump control method provided by the application are as follows:

[0101] Step 1: The user selects a target element in the Android Studio integrated development environment.

[0102] The target element is a specific class, method, member variable or the like.

[0103] Step 2: The user triggers the "jump to declaration" function to generate a jump request.

[0104] The "jump to declaration" function is triggered by a shortcut such as Ctrl+Click or Ctrl+B.

[0105] Step 3: The plug-in intercepts the jump request and obtains element information of the target element and a file path from the jump request.

[0106] The element information of the target element includes an element name, an element type of the target element, and argument information contained in the element type in the case that the element type is a method or a function. The element information can also include other contents, which are not limited here.

[0107] Step 4: The plug-in determines whether the target element is from a Jar package of a componentized SDK according to the file path.

[0108] The Jar package is the target compilation file mentioned in the application.

[0109] Step 5: If the target element is from the Jar package of the componentized SDK, the plug-in finds the source code element corresponding to the target element in the source code of the project.

[0110] The specific finding method can be performed according to the above embodiment, which will not be repeated here.

[0111] Step 6: The plug-in combines and returns the jumped Jar package element and the source code element corresponding to the target element.

[0112] The Jar package element indicates the decompiled file obtained by decompiling the target compilation file from which the target element comes.

[0113] The above combination refers to generating a first jump option based on the Jar package element, generating a second jump option based on the source code element corresponding to the target element, and combining the first jump option and the second jump option to obtain a jump option.

[0114] Step 7: The integrated development environment displays the jump option, and the user can choose to jump to the Jar package element or jump to the source code element.

[0115] Before step 4, it can also be judged whether a function switch is enabled, which indicates whether the function of jumping to the source code element corresponding to the target element in the case that the target element is from the Jar package of the componentized SDK is enabled. If the above function switch is not enabled, jump to the Jar package element (i.e. the original target) in the case that the target element is from the Jar package of the componentized SDK.

[0116] Further, in step 5, if the target element is from the Jar package of the componentized SDK, the source code element corresponding to the target element can be found based on the type information of the target element (i.e. the element type mentioned in the present application).

[0117] The way of finding based on the type information of the target element can be as shown in Figure 4 .

[0118] For example, in the case that the element type of the target element indicates a Java class, the corresponding class can be found in the project through the fully qualified name. The found class is matched with the target element to obtain a matching result, and the source code element corresponding to the target element is determined according to the matching result.

[0119] For another example, in the case that the element type of the target element indicates a Java method, the same name method can be found in the project and the parameter type is matched. The found method is matched with the target element to obtain a matching result, and the source code element corresponding to the target element is determined according to the matching result.

[0120] Other similar, will not be repeated here.

[0121] Thus, by identifying whether the element requiring the jump control is from the target compiled file, the position of the source code element corresponding to the element is determined if the element is from the target compiled file, so that the corresponding source code element can be accurately jumped to when the element is controlled to jump, instead of only jumping to the position of the decompiled file obtained by decompiling the target compiled file, so that the source code element can be edited by the developer, and the development efficiency is improved.

[0122] The embodiment also provides a jump control device, which can be integrated in a terminal device. For example, as shown in the figure, the jump control device can include: Figure 5

[0123] The information acquisition module 201 is configured to acquire element information of the target element and a file path after the jump of the target element corresponding to the target element in response to an element jump operation of the target element in the code of the target project.

[0124] The position determination module 202 is configured to determine position information of a target source code element corresponding to the target element based on the element information in a source code file of the target project if the file path indicates that the target element is from a target compiled file of the target project, wherein the target compiled file is a file obtained by compiling at least part of the source code file of the target project.

[0125] The control module 203 is configured to perform jump control based on the position information of the target source code element.

[0126] In an embodiment, the jump control device further includes:

[0127] The first information extraction unit is configured to extract a file name and a file identifier from the file path.

[0128] The first matching unit is configured to determine that the file path indicates that the target element is from the target compiled file of the target project if the file identifier matches the compiled file identifier and the file name matches a specific compiled file name.

[0129] In an embodiment, the element information includes an element name of the target element.

[0130] Based on this, the position determination module 202 includes:

[0131] The second information extraction unit is configured to acquire a fully qualified name corresponding to the target element, and the fully qualified name includes a file name and a class name of a class corresponding to the target element.

[0132] ​The file matching unit is configured to determine, based on the fully qualified name, a target source code file in which a target source code element corresponding to the target element is located from a source code file of the target project.

[0133] The position determining unit is configured to determine, based on the element name of the target element, position information of the target source code element in the target source code file from the target source code file.

[0134] In an embodiment, the target element includes at least one of a class, a variable, a method, and a function.

[0135] Based on this, in a case where the target element is a variable, a method, or a function, the position determining unit is further configured to:

[0136] determine a target class containing the target element from the target source code file;

[0137] find the target source code element based on the element name of the target element in the target class to obtain the position information of the source code element in the target source code file.

[0138] In an embodiment, in a case where the target element is a class and the compiled file is obtained based on Kotlin language compilation, the file matching unit is further configured to:

[0139] in a case where the target source code file is not determined based on the fully qualified name, obtain a target index matched with the target element;

[0140] determine, based on the target index, the target source code file in which the target source code element corresponding to the target element is located from the source code file of the target project.

[0141] In an embodiment, in a case where the target element is a method or a function, the finding of the target source code element based on the element name of the target element in the target class further includes:

[0142] obtaining first parameter information corresponding to an argument of the target element;

[0143] determining, based on the element name of the target element, at least one candidate source code element and second parameter information of candidate arguments corresponding to the candidate source code elements in the target class;

[0144] finding the target source code element based on the first parameter information and the second parameter information, wherein the target source code element indicates a candidate source code element corresponding to second parameter information matched with the first parameter information.

[0145] In an embodiment, the parameter information includes type reference, parameter type, and parameter text.

[0146] Based on this, in the case that the compiling file is compiled based on the Kotlin language, the above-mentioned searching for the target source code element based on the first parameter information and the second parameter information further includes:

[0147] comparing the type reference in the first parameter information with the type reference in the second parameter information to obtain a first comparison result;

[0148] in the case that the first comparison result indicates that there is a difference, comparing the parameter type in the first parameter information with the parameter type in the second parameter information to obtain a second comparison result;

[0149] in the case that the second comparison result indicates that there is a difference, comparing the parameter text in the first parameter information with the parameter text in the second parameter information to obtain a third comparison result;

[0150] in the case that the first comparison result, or the second comparison result, or the third comparison result indicates that they are the same, taking the candidate source code element corresponding to the second parameter information as the target source code element.

[0151] In an embodiment, the above-mentioned information obtaining module 201 includes:

[0152] a request generating unit configured to generate a jump request of the target element in response to an element jump operation of the target element in the code of the target project, the jump request including element information of the target element and a file path after jumping of the target element;

[0153] an information extracting unit configured to extract the file path and the element information from the jump request by intercepting the jump request through a preset component.

[0154] In an embodiment, the above-mentioned control module 203 includes:

[0155] an option generating unit configured to generate a jump option, wherein the jump option includes a first jump option and a second jump option, the first jump option is generated based on the file path, and the second jump option is generated based on position information of the target source code element;

[0156] a first control unit configured to jump to a decompilation file obtained by decompiling the target compiling file in response to a triggering operation on the first jump option in the jump option;

[0157] a second control unit configured to jump to the target source code element in response to a triggering operation on the second jump option in the jump option.

[0158] The solution adopted in this application embodiment can be implemented by the information acquisition module 201 responding to an element jump operation on a target element in the code of the target project, acquiring the element information of the target element and the corresponding jump file path; the position determination module 202, when the file path indicates that the target element originates from the target compiled file of the target project, determines the position information of the target source code element corresponding to the target element in the source code file of the target project based on the element information, wherein the target compiled file is a file obtained by compiling at least a portion of the source code files of the target project; the control module 203 performs jump control based on the position information of the target source code element. Thus, by identifying whether the element requiring jump control originates from the target compiled file, and further determining the position of the corresponding source code element when it is determined that the element originates from the target compiled file, the jump control can accurately jump to the position of the corresponding source code element, rather than just jumping to the position of the decompiled file obtained after decompiling the target compiled file, enabling developers to edit the source code elements and improving development efficiency.

[0159] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.

[0160] like Figure 6 As shown, Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0161] The processor 301 is the control center of the electronic device 300, connects all parts of the electronic device 300 through various interfaces and lines, executes various functions of the electronic device 300 and processes data by running or loading software programs and / or units stored in the memory 302 and calling data stored in the memory 302, thereby overall monitoring the electronic device 300. The processor 301 can be a central processing unit CPU, a graphics processing unit GPU, a network processor NP, etc., and can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application.

[0162] In the embodiments of the present application, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more application programs into the memory 302, and runs the application programs stored in the memory 302 by the processor 301, thereby realizing various functions, for example:

[0163] In response to an element jump operation on a target element in a code of a target project, obtaining element information of the target element and a file path after jumping of the target element corresponding to the target element;

[0164] In a case where the file path indicates that the target element is derived from a target compilation file of the target project, determining position information of a target source code element corresponding to the target element in a source code file of the target project based on the element information, wherein the target compilation file is a file obtained by compiling at least part of source code files of the target project;

[0165] Performing jump control based on the position information of the target source code element.

[0166] By using the electronic device provided in the embodiments of the present application, the element information of the target element and the file path after jumping of the target element corresponding to the target element can be obtained in response to an element jump operation on a target element in a code of a target project; in a case where the file path indicates that the target element is derived from a target compilation file of the target project, the position information of a target source code element corresponding to the target element in a source code file of the target project can be determined based on the element information, wherein the target compilation file is a file obtained by compiling at least part of source code files of the target project; and the jump control can be performed based on the position information of the target source code element. In this way, by identifying whether the element needing jump control is derived from a target compilation file, the position of the source code element corresponding to the element is further determined in a case where it is determined that the element is derived from the target compilation file, so that the corresponding source code element position can be accurately jumped to when the element is jump controlled, instead of being only jumped to the position of a decompilation file obtained by decompiling the target compilation file, so that the developer can edit the source code element and improve the development efficiency.

[0167] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0168] Optional, such as Figure 6 As shown, the electronic device 300 also includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0169] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.

[0170] The radio frequency circuit 304 can be used to transceive radio frequency signals to establish wireless communication with a network device or other electronic device.

[0171] The audio circuit 305 can be used to provide an audio interface between a user and the electronic device through a speaker and a microphone. The audio circuit 305 can convert received audio data into an electrical signal and transmit the electrical signal to the speaker for conversion into an audible signal. On the other hand, the microphone can collect a sound signal and convert the sound signal into an electrical signal, which is received by the audio circuit 305 and converted into audio data. The audio data is output to the processor 301 for processing, and then transmitted to another electronic device through the radio frequency circuit 304 or stored in the memory 302 for further processing. The audio circuit 305 can also include a headphone jack to provide communication between an external device and the electronic device.

[0172] The input unit 306 can be used to receive material audio, reference audio, and the like.

[0173] The power supply 307 is used to supply power to various components of the electronic device 300. Optionally, the power supply 307 can be logically connected to the processor 301 through a power management system, so that the power management system can be used to manage charging, discharging, power consumption management, and the like. The power supply 307 can also include one or more direct current or alternating current power supplies, a recharging system, a power supply failure detection circuit, a power supply converter or inverter, a power supply status indicator, and the like.

[0174] Although Figure 6 The electronic device 300 can also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, and the like, which are not shown in the embodiments.

[0175] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0176] Those skilled in the art can understand that all or part of the steps of the various methods of the above embodiments can be completed by instructions, or by controlling related hardware by instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.

[0177] To this end, the embodiments of the present application provide a computer readable storage medium, which stores a plurality of computer programs. The computer programs can be loaded by a processor to execute any of the jump control methods provided by the embodiments of the present application. The computer programs can execute the steps of the following jump control method:

[0178] In response to an element jump operation on a target element in code of a target project, element information of the target element and a file path after jumping of the target element are obtained;

[0179] In a case where the file path indicates that the target element is from a target compiled file of the target project, position information of a target source code element corresponding to the target element is determined in a source code file of the target project based on the element information, wherein the target compiled file is a file obtained by compiling at least part of source code files of the target project;

[0180] The jump control is performed based on the position information of the target source code element.

[0181] By using the computer readable storage medium provided in the embodiments of the present application, the element information of the target element and the file path after jumping of the target element can be obtained in response to an element jump operation on a target element in code of a target project; in a case where the file path indicates that the target element is from a target compiled file of the target project, position information of a target source code element corresponding to the target element is determined in a source code file of the target project based on the element information, wherein the target compiled file is a file obtained by compiling at least part of source code files of the target project; and the jump control is performed based on the position information of the target source code element. In this way, by identifying whether an element that needs to be subjected to jump control is from a target compiled file, in a case where it is determined that the element is from the target compiled file, the position of a source code element corresponding to the element is further determined, so that when the element is subjected to jump control, the corresponding source code element can be accurately jumped to, instead of being only jumped to a position of a decompiled file obtained by decompiling the target compiled file, so that a developer can edit the source code element and the development efficiency is improved.

[0182] The specific implementation of each operation can be referred to the foregoing embodiments, which will not be described here.

[0183] The computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0184] Since the computer program stored in the computer readable storage medium can execute any jump control method provided in the embodiments of the present application, the beneficial effects of any jump control method provided in the embodiments of the present application can be achieved, which will be described in detail in the foregoing embodiments, and will not be described here.

[0185] According to an aspect of the present application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer readable storage medium. A processor of an electronic device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the method provided in various optional implementations in the above embodiments.

[0186] In the above embodiments of the jump control apparatus, the computer readable storage medium, the electronic device, and the computer program product, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments. Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the above-described jump control apparatus, computer readable storage medium, computer program product, electronic device and corresponding units thereof and the beneficial effects brought by them can be referred to the description of the jump control method in the above embodiments, which will not be described here in detail.

[0187] The above provides a detailed introduction to the jump control method, apparatus, electronic device, computer readable storage medium, and computer program product provided by the embodiments of the present application. The principle and implementation manner of the present application are described by applying specific examples in this paper. The above embodiment description is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed; in conclusion, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A jump control method characterized by comprising: The method includes: In response to an element jump operation in the code of the target project, obtain the element information of the target element and the file path of the target element after the jump; When the file path indicates that the target element originates from the target compiled file of the target project, the location information of the target source code element corresponding to the target element is determined in the source code file of the target project based on the element information, wherein the target compiled file is a file obtained by compiling at least a portion of the source code files of the target project; Jump control is performed based on the location information of the target source code element.

2. The jump control method according to claim 1, characterized by, The method further includes: Extract the file name and file identifier from the file path; If the file identifier matches the compiled file identifier and the file name matches a specific compiled file name, the file path indicates that the target element originates from the target compiled file of the target project.

3. The jump control method according to claim 2, wherein The element information includes the element name of the target element; determining the location information of the target source code element corresponding to the target element in the source code file of the target project based on the element information includes: Obtain the fully qualified name corresponding to the target element, wherein the fully qualified name includes the file name and the class name of the class corresponding to the target element; Based on the fully qualified name, the target source file containing the target source code element corresponding to the target element is determined from the source code file of the target project; From the target source code file, based on the element name of the target element, determine the position information of the target source code element in the target source code file.

4. The jump control method according to claim 3, characterized by, The target element includes at least one of class, variable, method, and function; When the target element is a variable, method, or function, determining the position information of the target source code element in the target source code file based on the element name of the target element includes: From the target source code file, determine the target class that contains the target element; In the target class, based on the element name of the target element, the target source code element is searched to obtain the position information of the source code element in the target source code file.

5. The jump control method according to claim 4, characterized by, When the target element is a class and the compiled file is compiled based on the Kotlin language, determining the target source file where the target source code element corresponding to the target element is located further includes: If the target source file cannot be determined based on the fully qualified name, obtain the target index that matches the target element; Based on the target index, the target source code file containing the target source code element corresponding to the target element is determined from the source code file of the target project.

6. The jump control method according to claim 4, wherein When the target element is a method or function, the target source code element is located within the target class based on its element name, including: Obtain the first parameter information of the input parameters corresponding to the target element; In the target class, based on the element name of the target element, at least one candidate source code element is determined, and each candidate source code element corresponds to second parameter information of a candidate parameter; Based on the first parameter information and the second parameter information, the target source code element is searched, wherein the target source code element is used to indicate the candidate source code element corresponding to the second parameter information matching the first parameter information.

7. The jump control method according to claim 6, wherein The parameter information includes type reference, parameter type and parameter text; in the case that the compiled file is compiled based on the Kotlin language, based on the first parameter information and the second parameter information, the target source code element is searched, including: Comparing the type reference in the first parameter information with the type reference in the second parameter information to obtain a first comparison result; In the case that the first comparison result indicates that there is a difference, comparing the parameter type in the first parameter information with the parameter type in the second parameter information to obtain a second comparison result; In the case that the second comparison result indicates that there is a difference, comparing the parameter text in the first parameter information with the parameter text in the second parameter information to obtain a third comparison result; In the case that the first comparison result, or the second comparison result, or the third comparison result indicates that they are the same, the candidate source code element corresponding to the second parameter information is taken as the target source code element.

8. The jump control method according to any one of claims 1 to 7, characterized by, The element jump operation of the target element in the code of the target project is responded to, and the element information of the target element and the file path after jumping of the target element are obtained, including: The element jump operation of the target element in the code of the target project is responded to, and the jump request of the target element is generated, the jump request including the element information of the target element and the file path after jumping of the target element; The jump request is intercepted through a preset component, and the file path and the element information are extracted from the jump request.

9. The jump control method according to any one of claims 1 to 7, characterized by, The position information of the target source code element is used for jump control, including: A jump option is generated, wherein the jump option includes a first jump option and a second jump option, the first jump option is generated based on the file path, and the second jump option is generated based on the position information of the target source code element; In response to a trigger operation on the first jump option in the jump option, jump to a decompiled file obtained by decompiling the target compiled file; In response to a trigger operation on the second jump option in the jump option, jump to the target source code element.

10. A jump control device characterized by comprising: The device includes: An information acquisition module is configured to acquire element information of a target element and a file path after jumping of the target element in response to an element jump operation of the target element in the code of a target project. A position determining module is configured to, when the file path indicates that the target element is derived from a target compilation file of the target project, determine position information of a target source code element corresponding to the target element in a source code file of the target project based on the element information, wherein the target compilation file is a file obtained by compiling at least part of source code files of the target project. A control module is configured to perform jump control based on the position information of the target source code element.

11. An electronic device, comprising: The electronic device comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the computer program causes the processor to perform the steps of the jump control method in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The electronic device comprises a computer program, and when the computer program runs on the electronic device, the computer program is used to cause the electronic device to perform the steps of the jump control method in any one of claims 1-9.