Code sharing method and device, electronic equipment and storage medium

By determining the focus position in code sharing to generate and parse the sharing link, the problem of cumbersome and inefficient code sharing operations in existing technologies is solved, achieving efficient and accurate code positioning and transmission.

CN113849170BActive Publication Date: 2026-01-13BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111087680.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-16
Publication Date
2026-01-13
Estimated Expiration
2041-09-16

AI Technical Summary

Technical Problem

Existing code sharing methods are cumbersome and inefficient, making it difficult to achieve efficient code location and transmission.

Method used

By determining the current focus position in the file, a sharing link is generated and sent to a second electronic device. The second electronic device then parses the sharing link and locates the position of the code to be shared.

Benefits of technology

It simplifies code sharing operations and enables efficient location, improving the accuracy and automation of code sharing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849170B_ABST
    Figure CN113849170B_ABST
Patent Text Reader

Abstract

The present disclosure provides a code sharing method and device, electronic equipment and storage medium, relates to the technical field of computers, in particular to the field of intelligent sharing, and is applied to a code sharing scene. The specific implementation scheme is as follows: in response to receiving a code sharing instruction, determining first position information of a current focus in a file; determining a sharing link corresponding to the code to be shared according to the first position information; and in response to obtaining a sharing operation on the sharing link, sending the sharing link to a second electronic device associated with the sharing operation. According to the position information of the focus, the sharing link is determined and sent to the second electronic device, so that the second electronic device can locate the position of the code to be shared according to the sharing link, and the method is simple and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to the field of intelligent sharing, applied to code sharing scenarios, specifically to code sharing methods, devices, electronic devices, and storage media. Background Technology

[0002] In the daily development and work of software engineers, for purposes such as communication and discussion, it is necessary to share code from a project with others. In related technologies, the sharer typically provides the code to be shared or a screenshot of it to the recipient, who then searches for the code in a code repository based on its characteristics and analyzes it in context. Clearly, this method of code sharing is cumbersome and inefficient. Summary of the Invention

[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for code sharing.

[0004] According to one aspect of this disclosure, a code-sharing method is provided, comprising:

[0005] In response to receiving a code sharing instruction, determine the first position of the current focus in the file;

[0006] Based on the first location information, determine the sharing link corresponding to the code to be shared;

[0007] In response to receiving a sharing operation for the shared link, the shared link is sent to a second electronic device associated with the sharing operation.

[0008] According to another aspect of this disclosure, a code-sharing method is provided, comprising:

[0009] Receive a sharing link sent by the first electronic device;

[0010] Upon receiving a jump instruction for the shared link, the shared link is parsed to determine the first location information of the code to be shared;

[0011] Based on the first location information, obtain the code to be shared.

[0012] According to another aspect of this disclosure, a code-sharing apparatus is provided, comprising:

[0013] The first determining module is used to determine the first position information of the current focus in the file in response to receiving a code sharing instruction;

[0014] The second determining module is used to determine the sharing link corresponding to the code to be shared based on the first location information;

[0015] A sending module is configured to, in response to receiving a sharing operation for the sharing link, send the sharing link to a second electronic device associated with the sharing operation.

[0016] According to another aspect of this disclosure, a code-sharing apparatus is provided, comprising:

[0017] A receiving module is used to receive a sharing link sent by a first electronic device;

[0018] The parsing module is used to parse the sharing link when a jump instruction for the sharing link is received, so as to determine the first position information of the code to be shared;

[0019] The acquisition module is used to acquire the code to be shared based on the first location information.

[0020] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0021] At least one processor; and

[0022] A memory communicatively connected to the at least one processor; wherein,

[0023] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described in the above embodiments.

[0024] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method described in the above embodiments.

[0025] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method described in the above embodiments.

[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0027] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0028] Figure 1 A flowchart illustrating a code-sharing method provided in an embodiment of this disclosure;

[0029] Figure 2 A schematic diagram of a shortcut key interface provided in an embodiment of this disclosure;

[0030] Figure 3 A flowchart illustrating another code-sharing method provided in this embodiment of the disclosure;

[0031] Figure 4 A flowchart illustrating another code-sharing method provided in this embodiment of the disclosure;

[0032] Figure 5 A flowchart illustrating another code-sharing method provided in this embodiment of the disclosure;

[0033] Figure 6 This is a schematic diagram of the structure of a code-sharing device provided in an embodiment of the present disclosure;

[0034] Figure 7 A schematic diagram of another code-sharing device provided in an embodiment of this disclosure;

[0035] Figure 8 This is a block diagram of an electronic device used to implement the code sharing method of the embodiments of this disclosure. Detailed Implementation

[0036] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0037] The code-sharing methods, apparatus, electronic devices, and storage media of embodiments of this disclosure are described below with reference to the accompanying drawings.

[0038] Figure 1 This is a flowchart illustrating a code-sharing method provided in an embodiment of the present disclosure.

[0039] The code sharing method of this disclosure can be applied to electronic devices, referred to as the first electronic device for easy distinction. It determines the sharing link corresponding to the code to be shared based on the first position information of the current focus in the file, and shares the sharing link with the second electronic device so that the second electronic device can locate the position of the code to be shared based on the sharing link. The operation is simple and efficient.

[0040] like Figure 1 As shown, the code sharing method includes:

[0041] Step 101: In response to receiving the code sharing instruction, determine the first position information of the current focus in the file.

[0042] In this disclosure, one or more integrated development environments (IDEs) can be installed on the first electronic device. These IDEs can be software such as VS Code, IntelliJ IDEA, or Eclipse. The sharer can open code files in the project using one of the IDEs on the first electronic device; here, the IDE that opens the code to be shared can be referred to as the first IDE.

[0043] In practical applications, to facilitate communication and learning, the sharer may want to share certain code snippets from a file with the recipient. In this case, the focus, such as the cursor, can be positioned on the code to be shared. The sharer can trigger the code sharing control on the integrated development environment (IDE) interface, or right-click and select the code sharing shortcut from the shortcut list. The first electronic device will then receive the code sharing command.

[0044] In response to receiving a code sharing instruction, the first electronic device can determine the first position information of the current focus in the file. For example, it can obtain the first position information of the current focus in the file by calling certain application interfaces in the first integrated development environment, or it can determine the first position information of the current focus in the file by calling the corresponding function.

[0045] In this disclosure, the information about the first position of the current focus in the file can be the line number of the code where the focus is located, or the line number and column number of the code where the focus is located, or the function where the focus is located, etc.

[0046] Step 102: Determine the sharing link corresponding to the code to be shared based on the first location information.

[0047] In this disclosure, the code at the current focus location, or the code above and below the current focus location, can be used as the code to be shared. To improve code sharing efficiency, this disclosure can determine the sharing link corresponding to the code to be shared based on the first position information of the current focus location within the file, thereby achieving code sharing via the sharing link. The sharing link can carry the first position information, file information, etc.

[0048] Figure 2 This is a schematic diagram of a shortcut key interface provided in an embodiment of this disclosure. When the sharer right-clicks the mouse at the location of the cursor in the code, the following can be displayed: Figure 2 The diagram shows a shortcut key interface, displaying the "Code Sharing" shortcut. If the sharer triggers this shortcut, the electronic device receives the code sharing instruction, determines the current line and column number of the code where the cursor is located, and identifies the sharing link based on the cursor's position.

[0049] Step 103: In response to receiving a sharing operation for the sharing link, the sharing link is sent to the second electronic device associated with the sharing operation.

[0050] In this disclosure, the sharer can paste a specific sharing link into instant messaging software and send it to the recipient. Then, the first electronic device, in response to receiving a sharing operation for the sharing link, can send the sharing link to a second electronic device associated with the sharing operation.

[0051] Here, the sharing operation can refer to the sharer pasting or sending the sharing link, and the second electronic device can be the electronic device used by the recipient.

[0052] It should be noted that in this disclosure, the first electronic device and the second electronic device have the same engineering.

[0053] The code sharing method of this disclosure can be applied to scenarios such as code communication and code review in software development. By determining the sharing link of the code to be shared, the code can be shared using the sharing link, which facilitates code communication among software developers.

[0054] In this embodiment of the disclosure, in response to receiving a code sharing instruction, a first position information of the current focus in the file is determined; based on the first position information, a sharing link corresponding to the code to be shared is determined; and in response to obtaining a sharing operation for the sharing link, the sharing link is sent to a second electronic device associated with the sharing operation. Thus, by determining the sharing link based on the current position information of the focus and sending the sharing link to the second electronic device, the second electronic device can locate the position of the code to be shared based on the sharing link, resulting in a simple and efficient operation.

[0055] In practical applications, the same code file may exist in multiple locations on an electronic device. To ensure the accuracy of code sharing, one embodiment of this disclosure may employ... Figure 3 The code for the method shown is shared here. Figure 3 This is a flowchart illustrating another code-sharing method provided in an embodiment of this disclosure.

[0056] like Figure 3 As shown, the code sharing method includes:

[0057] Step 301: In response to receiving the code sharing instruction, determine the first position information of the current focus in the file.

[0058] In this disclosure, step 301 is similar to step 101 above, so it will not be described again here.

[0059] Step 302: Based on the first location information, determine the path information of the project to which the code to be shared belongs and the file information of the file to which it belongs.

[0060] In practical applications, the first electronic device may store multiple projects, and each project may contain multiple code files. In this disclosure, after determining the first location information, the file to which the code to be shared belongs and its file information can be determined based on the first location information, and the project to which the file belongs and its path information can be determined based on the file information.

[0061] To ensure that the recipient can accurately obtain the code to be shared, information such as the file containing the code and its location on the first electronic device can be determined. Therefore, in this disclosure, the file information of the file to which the code belongs may include the file path, file name, and other information.

[0062] For example, the file information of a certain code file is " / platform / src / engine / engine_parser.cpp". Here, "engine_parser.cpp" is the file name, and the file path is " / platform / src / engine / engine_parser".

[0063] Alternatively, the path information of the project to which the code to be shared belongs and the file information of the file to which it belongs can be obtained by calling the corresponding application interface in the first integrated development environment.

[0064] Step 303: Generate a sharing link based on the path information, file information, and first location information.

[0065] In this disclosure, a sharing link can be generated according to a preset format, based on path information, file information, and first location information.

[0066] As one implementation method, the preset format may include preset tags, and the path information, file information, and first position information are concatenated in descending order of hierarchy.

[0067] For example, the default format for a link is [Special Tag]: [Project Path|Code File Path and Filename|Cursor Line Number, Cursor Column Number]. For instance, a shared link might be FastGo: [bd / report-engine / query| / platform / src / engine / engine_parser.cpp|4344,30].

[0068] As another implementation, the preset format includes preset tags, and the path information, file information, and first position information are concatenated in ascending order of hierarchy. For example, a sharing link is FastGo:[4344,30| / platform / src / engine / engine_parser.cpp|bd / report-engine / query].

[0069] It should be noted that the format of the above-mentioned sharing links is only an example. In actual applications, it can be determined according to the needs, and this disclosure does not limit it.

[0070] Step 304: In response to receiving a sharing operation for the sharing link, the sharing link is sent to the second electronic device associated with the sharing operation.

[0071] In this disclosure, step 304 is similar to step 103 above, so it will not be described again here.

[0072] In this embodiment of the disclosure, when determining the sharing link corresponding to the code to be shared based on the first location information, the path information of the project to which the code belongs and the file information of the file to which it belongs can be determined based on the first location information; the sharing link is then generated based on the path information, the file information, and the first location information. Therefore, by sending the sharing link, which includes the path information of the project to which the code belongs, the file information of the file to which it belongs, and the focus position information within the file, to the second electronic device, the second electronic device can accurately locate the code to be shared based on the sharing link, thus improving the accuracy of code sharing.

[0073] In one embodiment of this disclosure, the sharing link may include path information of the project to which the code to be shared belongs, file information of the file to which it belongs, and information on the first position of the current focus in the file. It may also include an identifier of the first integrated development environment currently displaying the code to be shared.

[0074] Therefore, the first electronic device sends the sharing link to the second electronic device. The second electronic device can match the identifier of the first integrated development environment with the identifier of the local integrated development environment. Based on the matching result, it determines whether to automatically start the integrated development environment, thereby reducing user operations and improving the automation of code sharing.

[0075] To implement the above embodiments, this disclosure also proposes a code-sharing method. This code-sharing method can be applied to a second electronic device. Figure 4 This is a flowchart illustrating another code-sharing method provided in an embodiment of this disclosure.

[0076] like Figure 4 As shown, the code sharing method includes:

[0077] Step 401: Receive the sharing link sent by the first electronic device.

[0078] In this disclosure, the sharer can send a sharing link of the code to be shared generated by a first electronic device to a second electronic device used by the recipient via instant messaging software. The second electronic device can then receive the sharing link corresponding to the code to be shared sent by the first electronic device and display that sharing link.

[0079] Step 402: Upon receiving a redirect instruction for the share link, parse the share link to determine the first location information of the code to be shared.

[0080] In this disclosure, the second electronic device may be equipped with one or more integrated development environments (IDEs). The IDE of the second electronic device may be the same as or different from the first IDE in the first electronic device.

[0081] In this disclosure, the recipient can directly click the share link, or the recipient can copy the share link, open the integrated development environment installed on the second electronic device, and trigger the code positioning control. At this time, the second electronic device can obtain the jump instruction for the share link.

[0082] For example, after the recipient copies the share link, they open the integrated development environment and trigger... Figure 2 The shortcut key for "code location" shown in the image allows the electronic device to receive a jump command.

[0083] When the second electronic device receives a redirect instruction for the sharing link, it can parse the sharing link and determine the first position information of the code to be shared according to the preset format of the sharing link.

[0084] The first location information of the code to be shared here can be the location information of the code in the file, such as the line number and column number of the code in the file, the function to which it belongs in the file, or the location information of the file to which the code to be shared is located, the file information of the file to which it belongs, and the project path information of the project to which it belongs.

[0085] The file information of the file may include the file name and file path of the file.

[0086] Step 403: Obtain the code to be shared based on the first location information.

[0087] After determining the first location information, the second electronic device can locate the code to be shared based on the first location information and position the focus on the corresponding location.

[0088] For example, based on the first location information of the code to be shared within a file, the path information of the project to which the code belongs, the file information of the file to which it belongs, etc., can be determined. Then, based on the path information of the project to which it belongs, the project can be located and opened. After opening the project, based on the file information of the file to which it belongs, the file to which it belongs can be located and opened, and based on the first location information of the code to be shared, the focus can be positioned at the location corresponding to the first location information.

[0089] In this embodiment of the disclosure, a sharing link sent by a first electronic device is received; upon receiving a jump instruction for the sharing link, the sharing link is parsed to determine the first location information of the code to be shared; and the code to be shared is obtained based on the first location information. Therefore, by parsing the sharing link sent by the first electronic device to determine the location information of the code to be shared, and automatically obtaining the code to be shared based on the location information, rapid location of the sharing code is achieved, which is simple to operate and highly efficient.

[0090] Figure 5 This is a flowchart illustrating another code-sharing method provided in an embodiment of this disclosure.

[0091] like Figure 5 As shown, the code sharing method includes:

[0092] Step 501: Receive the sharing link sent by the first electronic device.

[0093] In this disclosure, step 501 is similar to step 401 above, so it will not be described again here.

[0094] Step 502: Parse the sharing link to determine the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the code to be shared in the file.

[0095] In this disclosure, the second electronic device can parse the sharing link and, based on the preset format of the sharing link, determine the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the code to be shared in the file.

[0096] For example, if the default format of a share link is [Special Tag]: [Project Path|Code File Path and Filename|Cursor Line Number, Cursor Column Number], then parsing the obtained share link and based on the default format, we can determine that the parameter adjacent to the special tag is the project path of the code to be shared, the parameter adjacent to the project path is the code file path and filename, and the next parameter adjacent to the code file path and filename is the cursor line number and column number.

[0097] Alternatively, the second electronic device can parse the sharing link and identify the parsed content based on the parameter types contained in the sharing link, so as to determine the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the code to be shared in the file.

[0098] For example, if a share link includes parameters such as the project path, file path and filename, and the cursor's row and column number, then the obtained share link is parsed, and the multiple pieces of content obtained from the parsing are identified. If the content type is a number, it can be determined that the content is the cursor's position information; if the content is a path with a suffix, it can be determined that the content is the filename and file path, and the other path obtained from the parsing is the project path of the code to be shared.

[0099] Step 503: Obtain the code to be shared based on the path information, file information, and first location information.

[0100] In this disclosure, the second electronic device can determine and open the project to which the code to be shared belongs based on the path information of the project. After opening the project, it determines and opens the file to which the code to be shared belongs within the project based on the file information of the file to which the code to be shared belongs. After opening the file, it positions the focus on the position corresponding to the first position information of the code to be shared in the file, thereby obtaining the code to be shared.

[0101] It is understandable that the first position information of the code to be shared in the file is the same as the first position information of the current focus in the file on the first electronic device side.

[0102] In this embodiment, a sharing link sent by a first electronic device is received. Upon receiving a jump instruction for the sharing link, the sharing link is parsed to determine the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the code to be shared within the file. Based on the first position information, the code to be shared is obtained. Therefore, by obtaining the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the code to be shared within the file through parsing the sharing link, the accuracy of locating the shared code is improved.

[0103] In one embodiment of this disclosure, by parsing the sharing link, the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the current focus in the file can be determined. It can also determine the identifier of the first integrated development environment currently displaying the code to be shared in the first electronic device.

[0104] In this disclosure, the second electronic device parses the shared link to obtain the identifier of the first integrated development environment, and matches the identifier of the second integrated development environment in the second electronic device with the identifier of the first integrated development environment.

[0105] If the identifier of the second integrated development environment in the second electronic device matches the identifier of the first integrated development environment, it means that the second electronic device also has the first integrated development environment installed. When the recipient clicks the share link, the second electronic device can automatically start the second integrated development environment.

[0106] If the identifier of the second integrated development environment (IDE) does not match that of the first IDE, and the second IDE is different from the first IDE, the second electronic device can return a query message asking whether to start the second IDE, inquiring whether the user wants to start the second IDE. Upon receiving a start command for the second IDE, the second electronic device starts the second IDE.

[0107] The inquiry message can be displayed in text form, voice playback, or other formats.

[0108] In this disclosure, if the second electronic device is equipped with multiple second integrated development environments (IDEs), the identifier of each second IDE can be matched with the identifier of the first IDE. If any identifier of a second IDE matches the identifier of the first IDE, that second IDE can be automatically started.

[0109] If the identifier of the second integrated development environment in the second electronic device does not match the identifier of the first integrated development environment, then a query message can be returned asking whether to start any second integrated development environment.

[0110] Alternatively, if the identifier of the second integrated development environment (IDE) does not match that of the first IDE when the recipient clicks the share link, a prompt message for the next step can be returned. For example, a prompt message could be returned saying, "Copy the link to the second IDE and click the 'Code Sharing' shortcut."

[0111] In this embodiment of the disclosure, the sharing link may further include an identifier of the first integrated development environment (IDE) currently displaying the code to be shared. The second IDE can be activated if its identifier matches the identifier of the first IDE in the second electronic device; otherwise, a prompt message asking whether to activate the second IDE is returned. Thus, by determining whether to automatically activate the IDE or return a prompt message based on whether the IDE in the second electronic device is the same as the first IDE, the automation level of code sharing is improved.

[0112] To implement the above embodiments, this disclosure also proposes a code-sharing device. This code-sharing device can be applied to a first electronic device. Figure 6 This is a schematic diagram of the structure of a code-sharing device provided in an embodiment of this disclosure.

[0113] like Figure 6 As shown, the code-sharing device 600 may include:

[0114] The first determining module 610 is used to determine the first position information of the current focus in the file in response to receiving a code sharing instruction;

[0115] The second determining module 620 is used to determine the sharing link corresponding to the code to be shared based on the first location information;

[0116] The sending module 630 is configured to send the sharing link to a second electronic device associated with the sharing operation in response to receiving a sharing operation for the sharing link.

[0117] In one possible implementation of this disclosure, the second determining module 620 is used for

[0118] Based on the first location information, determine the path information of the project to which the code to be shared belongs and the file information of the file to which it belongs;

[0119] The sharing link is generated based on the path information, the file information, and the first location information.

[0120] In one possible implementation of this disclosure, the sharing link includes an identifier of the first integrated development environment currently displaying the code to be shared.

[0121] It should be noted that the explanation of the aforementioned code sharing method embodiment also applies to the code sharing device of this embodiment, and therefore will not be repeated here.

[0122] The code sharing device of this disclosure, in response to receiving a code sharing instruction, determines first position information of the current focus in a file; determines a sharing link corresponding to the code to be shared based on the first position information; and, in response to obtaining a sharing operation for the sharing link, sends the sharing link to a second electronic device associated with the sharing operation. Thus, by determining the sharing link based on the current position information of the focus and sending the sharing link to the second electronic device, the second electronic device can locate the position of the code to be shared based on the sharing link, resulting in simple operation and high efficiency.

[0123] To implement the above embodiments, this disclosure also proposes a code-sharing device. This code-sharing device can be applied to a second electronic device. Figure 7 This is a schematic diagram of another code-sharing device provided in an embodiment of this disclosure.

[0124] like Figure 7 As shown, the code-sharing device 700 includes:

[0125] The receiving module 710 is used to receive the sharing link sent by the first electronic device;

[0126] The parsing module 720 is used to parse the sharing link when a jump instruction for the sharing link is obtained, so as to determine the first position information of the code to be shared;

[0127] The acquisition module 730 is used to acquire the code to be shared based on the first location information.

[0128] In one possible implementation of this disclosure, the parsing module 720 is used for:

[0129] The shared link is parsed to determine the path information of the project to which the code to be shared belongs, the file information of the file to which it belongs, and the first position information of the code to be shared in the file.

[0130] In one possible implementation of this disclosure, the sharing link includes an identifier of the first integrated development environment currently displaying the code to be shared, and the apparatus may further include:

[0131] A startup module is used to start the second integrated development environment when the identifier of the second integrated development environment in the second electronic device matches the identifier of the first integrated development environment;

[0132] The return module is used to return a query message asking whether to start the second integrated development environment if the identifier of the second integrated development environment does not match the identifier of the first integrated development environment.

[0133] It should be noted that the explanation of the aforementioned code sharing method embodiment also applies to the code sharing device of this embodiment, and therefore will not be repeated here.

[0134] In this embodiment of the disclosure, a sharing link sent by a first electronic device is received; upon receiving a jump instruction for the sharing link, the sharing link is parsed to determine the first location information of the code to be shared; and the code to be shared is obtained based on the first location information. Therefore, by parsing the sharing link sent by the first electronic device to determine the location information of the code to be shared, and automatically obtaining the code to be shared based on the location information, rapid location of the sharing code is achieved, which is simple to operate and highly efficient.

[0135] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0136] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0137] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 802 or a computer program loaded from storage unit 808 into RAM (Random Access Memory) 803. RAM 803 can also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. I / O (Input / Output) interface 805 is also connected to bus 804.

[0138] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0139] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as code-sharing methods. For example, in some embodiments, the code-sharing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the code-sharing method described above may be performed. Alternatively, in other embodiments, computing unit 801 may be configured to execute code-sharing methods by any other suitable means (e.g., by means of firmware).

[0140] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0141] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0142] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0143] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0144] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.

[0145] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers integrated with blockchain technology.

[0146] According to embodiments of this disclosure, this disclosure also provides a computer program product that, when an instruction processor in the computer program product is executed, performs the code sharing method proposed in the above embodiments of this disclosure.

[0147] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0148] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A code sharing method applied to a first electronic device, the method comprising: determining first position information of a current focus in a file in response to receiving a code sharing instruction; determining path information of an engineering to which a code to be shared belongs and file information of a file to which the code to be shared belongs according to the first position information, the code to be shared being a code at a position of the current focus or a code in a vicinity of the position of the current focus, the code to be shared being a partial code segment in the file; generating a sharing link according to the path information, the file information and the first position information; sending the sharing link to a second electronic device associated with a sharing operation of the sharing link to enable the second electronic device to locate a position of the code to be shared in the file according to the sharing link in response to obtaining the sharing operation of the sharing link, wherein the first electronic device and the second electronic device store a same engineering, and the first electronic device and the second electronic device both install a first integrated development environment of the code to be shared.

2. The method of claim 1, wherein, The sharing link comprises an identifier of the first integrated development environment currently displaying the code to be shared. 3.A code sharing method applied to a second electronic device, the method comprising: receiving a sharing link sent by a first electronic device; analyzing the sharing link to determine path information of an engineering to which a code to be shared belongs, file information of a file to which the code to be shared belongs, and first position information of the code to be shared in the file in a case where a jump instruction of the sharing link is obtained, the code to be shared being a code at a position of the current focus or a code in a vicinity of the position of the current focus, the code to be shared being a partial code segment in the file; determining the engineering to which the code to be shared belongs and opening the engineering according to the path information of the engineering to which the code to be shared belongs in a second integrated development environment of the second electronic device, opening the file to which the code to be shared belongs in the engineering according to the file information of the file to which the code to be shared belongs after opening the engineering, positioning the focus to a position corresponding to the first position information of the code to be shared in the file after opening the file, and determining the code to be shared, wherein the first electronic device and the second electronic device store a same engineering, and the first electronic device and the second electronic device both install a first integrated development environment of the code to be shared.

4. The method of claim 3, wherein, The sharing link comprises an identifier of the first integrated development environment currently displaying the code to be shared, and the method further comprises: starting the second integrated development environment in a case where the identifier of the second integrated development environment in the second electronic device matches the identifier of the first integrated development environment; returning a query message of whether to start the second integrated development environment in a case where the identifier of the second integrated development environment does not match the identifier of the first integrated development environment. 5.A code sharing apparatus applied to a first electronic device, the apparatus comprising: a first determining module configured to determine first position information of a current focus in a file in response to receiving a code sharing instruction; a second determining module, configured to determine path information of a project to which the to-be-shared code belongs and file information of a file to which the to-be-shared code belongs according to the first position information, the to-be-shared code being a code at a current focus position or a code in a vicinity of the current focus position, the to-be-shared code being a partial code segment in the file; generating a sharing link according to the path information, the file information and the first position information; a sending module, configured to, in response to obtaining a sharing operation on the sharing link, send the sharing link to a second electronic device associated with the sharing operation, so that the second electronic device positions a location of the to-be-shared code in the file according to the sharing link, wherein the first electronic device and the second electronic device store the same project, and the first electronic device and the second electronic device both install a first integrated development environment of the to-be-shared code.

6. The apparatus of claim 5, wherein, The sharing link includes an identifier of the first integrated development environment currently displaying the to-be-shared code.

7. A code sharing apparatus applied to a second electronic device, the apparatus comprising: a receiving module, configured to receive a sharing link sent by a first electronic device; a parsing module, configured to, in a case where a jump instruction on the sharing link is obtained, parse the sharing link to determine path information of a project to which to-be-shared code belongs, file information of a file to which the to-be-shared code belongs, and first position information of the to-be-shared code in the file, the to-be-shared code being a code at a current focus position or a code in a vicinity of the current focus position, the to-be-shared code being a partial code segment in the file; a obtaining module, configured to, in a second integrated development environment of the second electronic device, determine a project to which to-be-shared code belongs according to path information of the project to which the to-be-shared code belongs, and open the project, determine a file to which the to-be-shared code belongs in the project according to file information of the file to which the to-be-shared code belongs after the project is opened, and open the file, and position a focus to a position corresponding to first position information of the to-be-shared code in the file after the file is opened, and determine the to-be-shared code, wherein the first electronic device and the second electronic device store the same project, and the first electronic device and the second electronic device both install a first integrated development environment of the to-be-shared code.

8. The apparatus of claim 7, wherein, The sharing link includes an identifier of the first integrated development environment currently displaying the to-be-shared code, and the apparatus further comprises: a starting module, configured to, in a case where an identifier of the second integrated development environment in the second electronic device matches an identifier of the first integrated development environment, start the second integrated development environment; a returning module, configured to, in a case where the identifier of the second integrated development environment does not match the identifier of the first integrated development environment, return an inquiry message about whether to start the second integrated development environment.

9. An electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-2, or to perform the method of any one of claims 3-4.

10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are for causing the computer to perform the method of any one of claims 1-2, or to perform the method of any one of claims 3-4.

11. A computer program product comprising computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1-2, or to perform the steps of the method of any one of claims 3-4.

Citation Information

Patent Citations

  • Interface sharing method and device based on big data, electronic equipment and storage medium

    CN109597947A