Code completion methods, devices, equipment, media and program products
By collecting cursor trajectory data in real time through the cursor positioning plugin of the integrated development environment, constructing target confidence, identifying developer needs, and outputting efficient and accurate candidate code completion suggestions, the problem of long response time and low accuracy of code completion in existing technologies is solved, thereby improving the development efficiency of financial service applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-25
- Publication Date
- 2026-07-31
AI Technical Summary
Existing code completion methods have long response times and low accuracy, especially in financial service applications where they perform poorly in development scenarios involving complex business logic and interface interaction.
The cursor movement trajectory data is collected in real time by the cursor positioning plugin of the integrated development environment. Based on the trajectory data, the target confidence score is constructed to identify the developer's real need for code completion and output candidate code completion suggestions that are highly matched with the context.
It improves the accuracy and efficiency of code completion, making it particularly suitable for development scenarios involving complex business logic and interface interaction in financial service applications, while reducing false triggers and memory usage.
Smart Images

Figure CN122489121A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more particularly to a code completion method, apparatus, device, medium, and program product. Background Technology
[0002] Code completion is a core feature of integrated development environments (IDEs). It can automatically provide possible code snippets or options to help developers complete coding tasks quickly and accurately.
[0003] Existing technologies can complete code through syntax analysis, which is based on static syntax tree analysis and fuzzy matching of the current input characters. However, this method has a long response time for code completion, can only complete characters, and has low accuracy.
[0004] Therefore, improving the accuracy and efficiency of code completion is an urgent problem to be solved. Summary of the Invention
[0005] This application provides a code completion method, apparatus, device, medium, and program product to improve the accuracy and efficiency of code completion.
[0006] In a first aspect, embodiments of this application provide a code completion method, including:
[0007] A cursor positioning plugin based on an integrated development environment (IDE) determines the trajectory data of cursor movement; the IDE is used to develop financial service applications.
[0008] Based on the trajectory data, the target confidence level of the target event is determined; the target event is: code completion is required for the target code.
[0009] In response to the target confidence level being greater than or equal to a preset confidence level, a code completion suggestion is output, the code completion suggestion including: candidate codes for completing the target code;
[0010] In response to the code completion instruction, the target code is completed based on the candidate code.
[0011] Secondly, embodiments of this application provide a code completion device, comprising:
[0012] The first determining module is used to determine the trajectory data of cursor movement based on the cursor positioning plugin of the integrated development environment; the integrated development environment is used to develop financial service applications.
[0013] The second determining module is used to determine the target confidence level of the occurrence of the target event based on the trajectory data; the target event is: code completion is required for the target code;
[0014] An output module is configured to output code completion suggestions in response to the target confidence level being greater than or equal to a preset confidence level. The code completion suggestions include candidate codes for completing the target code.
[0015] A code completion module is used to complete the target code based on the candidate code in response to a code completion instruction.
[0016] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0017] The memory stores computer-executed instructions;
[0018] The processor executes computer execution instructions stored in the memory, causing the processor to perform the method described in any of the first aspects above.
[0019] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in any of the first aspects above.
[0020] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the first aspects above.
[0021] This application provides a code completion method, apparatus, device, medium, and program product. By using a cursor positioning plugin within an integrated development environment (IDE) to collect cursor movement trajectory data in real time, it can capture the implicit operational intentions of developers during code editing, overcoming the limitations of existing technologies that rely solely on explicit character input. Based on the trajectory data, this application constructs a target confidence level that can identify the developer's true need for code completion, avoiding false triggers caused by random movements or brief pauses, thus improving the accuracy of code completion. When the target confidence level reaches a preset confidence level, it can output candidate code completion suggestions that highly match the context, improving the accuracy and efficiency of code completion, especially suitable for development scenarios involving complex business logic and interface interaction in financial service applications. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0023] Figure 1 A flowchart illustrating a code completion method provided in an embodiment of this application;
[0024] Figure 2A schematic diagram of the structure of a code completion device provided in this application;
[0025] Figure 3 This is a schematic diagram of the structure of an electronic device provided in this application.
[0026] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0028] In this application, the term "comprising" and its variations can refer to non-limiting inclusion; the term "or" and its variations can refer to "and / or". The terms "first", "second", etc., in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0029] Code completion is a core feature of integrated development environments (IDEs). It can automatically generate or recommend possible code snippets, function calls, variable declarations, and other options to help developers quickly complete coding tasks, reduce repetitive typing and syntax errors, and improve development efficiency.
[0030] Existing code completion methods often rely on static syntax tree analysis, which traverses the code's syntax structure to match the syntax type of the current input character (such as variable declarations or method calls) and generates candidate suggestions that conform to the rules. However, this method has several drawbacks. Firstly, it requires traversing the entire syntax tree, resulting in a long average response time. Secondly, this approach only supports fuzzy matching of the current input character, leading to low completion accuracy.
[0031] Therefore, embodiments of this application provide a code completion method, apparatus, device, medium, and program product. By capturing cursor trajectory data through a cursor positioning plugin in an integrated development environment, the context data of the code can be represented based on the cursor trajectory data, and code completion can be triggered based on trajectory analysis. Compared to existing technologies that cannot analyze code context and can only complete characters, embodiments of this application can improve the accuracy and efficiency of code completion.
[0032] It should be noted that the executing entity of this application can be a user terminal, which can be any electronic device with processing capabilities, such as a computer.
[0033] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0034] Figure 1 This is a flowchart illustrating a code completion method provided in an embodiment of this application. Figure 1 As shown, the method includes:
[0035] S101, A cursor positioning plugin based on an integrated development environment (IDE) to determine the trajectory data of cursor movement; the IDE is used to develop financial service applications.
[0036] Alternatively, an integrated development environment (IDE) can be a type of software that integrates development tools such as code editing, debugging, compiling, and running into a unified interface, which can improve development efficiency and reduce tool switching.
[0037] For example, an integrated development environment can integrate functions such as code editing, debugging, and performance analysis, and support the development of Java (a programming language), Kotlin (a programming language), and XML (an extensible markup language) layout files.
[0038] Cursor positioning plugins can be extension tools embedded in integrated development environments. They can determine the movement trajectory of the cursor in the code editing area, such as the position of the cursor's trajectory point, the timestamp of the trajectory point, or any one or more of these parameters.
[0039] Financial services applications can be mobile applications used for financial services, such as services related to banking, securities, etc.
[0040] Optionally, the electronic device can determine the trajectory data of cursor movement through a cursor positioning plugin at a preset sampling frequency.
[0041] S102. Based on trajectory data, determine the target confidence level of the target event; the target event is: code completion is required for the target code.
[0042] Optionally, target confidence can be used to quantify the likelihood that a target event will occur. For example, the higher the target confidence, the more likely the target event is to happen.
[0043] Optionally, the electronic device can pre-store a mapping relationship between trajectory data and the target confidence level of the target event, and determine the target confidence level of the target event based on this mapping relationship. Alternatively, the electronic device can determine the target confidence level of the target event based on the trajectory data using a preset algorithm.
[0044] S103. In response to the target confidence level being greater than or equal to the preset confidence level, output code completion suggestions, which include candidate codes for completing the target code.
[0045] Optionally, the preset confidence level can be set according to the code completion requirements. Candidate codes can be codes generated by the electronic device to complete the target code. The electronic device can output code completion suggestions via one or more methods, such as pop-ups, drop-down lists, etc.
[0046] S104. In response to the code completion instruction, complete the target code based on the candidate code.
[0047] Optionally, code completion commands can be actively triggered by the developer through interactive actions. For example, such interactive actions can be one or more of the following: clicking a button, voice commands (such as voice input "complete the current method"), etc.
[0048] Optionally, the electronic device can insert selected candidate code into the incomplete position of the target code to complete the target code.
[0049] This application embodiment uses a cursor positioning plugin within the integrated development environment to collect cursor movement trajectory data in real time. This captures the implicit operational intentions of developers during code editing, overcoming the limitations of existing technologies that rely solely on explicit character input. Based on the trajectory data, this application embodiment constructs a target confidence level that can identify the developer's true need for code completion, avoiding false triggers caused by random movements or brief pauses, thus improving the accuracy of code completion. When the target confidence level reaches a preset confidence level, it can output candidate code completion suggestions that highly match the context, improving the accuracy and efficiency of code completion. This is particularly suitable for development scenarios involving complex business logic and interface interaction in financial service applications.
[0050] Taking the example of how electronic devices can determine the target confidence level of a target event based on trajectory data and a preset algorithm, the following is a detailed explanation of how electronic devices calculate the target confidence level.
[0051] Electronic devices can first obtain the initial confidence level of the occurrence of the target event based on trajectory data.
[0052] Optionally, the initial confidence level can be the degree of credibility of the target event calculated by the electronic device based on trajectory data using a preliminary algorithm. In one implementation, the trajectory data includes at least: the position of the cursor's trajectory point, the timestamp of the trajectory point, and the electronic device can determine the duration of the cursor's stay at the target code and the cursor's speed decay parameter based on the position of the trajectory point and the timestamp of the trajectory point.
[0053] Optionally, the electronic device can determine the time when the cursor arrives at and leaves a position by combining the timestamp information of the trajectory points with the position of the cursor's trajectory points, thereby calculating the duration of the cursor's stay at the target code. For example, if the cursor is stationary at a certain position from time t1 to time t2, then the duration of the cursor's stay at the target code is t2-t1.
[0054] Optionally, the cursor speed decay parameter can reflect the decay relationship between changes in cursor speed and the occurrence of the target event. When the cursor movement speed increases, the value of this parameter decreases, thereby reducing the initial confidence of the target event; conversely, when the speed decreases, the parameter value increases, and the confidence increases. For example, a faster cursor movement speed may indicate that the developer is simply quickly browsing the target code, and the probability of the target event (code completion) occurring is lower; a slower cursor movement speed indicates that the probability of the target event (code completion) occurring is higher.
[0055] Electronic devices can determine the initial confidence level based on the product of dwell time and speed decay parameter.
[0056] Optionally, the electronic device can comprehensively consider the product of dwell time and speed decay parameter, and determine the initial confidence level based on the product of dwell time and speed decay parameter. For example, when the dwell time is long and the speed decay parameter is slow, the initial confidence level will be significantly improved.
[0057] The embodiments of this application calculate the initial confidence level by multiplying the cursor dwell time by the speed decay parameter, which accurately quantifies the initial confidence level and facilitates the improvement of the accuracy of subsequent code completion based on the initial confidence level.
[0058] After obtaining the initial confidence level, the electronic device can perform Gaussian kernel smoothing on the initial confidence level to obtain the target confidence level.
[0059] Optionally, Gaussian kernel smoothing can be a nonlinear smoothing technique based on Gaussian functions, which can reduce noise interference and generate stable target confidence by weighting the initial confidence sequence.
[0060] The embodiments of this application can use Gaussian kernel smoothing to process the initial confidence level, effectively eliminating instantaneous noise interference in the cursor trajectory data, making the target confidence level calculation more stable, reducing false triggers caused by developers' brief pauses or misoperations, and improving the accuracy of code completion.
[0061] Before determining the cursor movement trajectory data using the aforementioned cursor positioning plugin based on the integrated development environment, this embodiment of the application can also determine the event that the developer triggers the switching between layout files and code files during the process of the developer developing a financial services application through the integrated development environment.
[0062] Optionally, the layout file can be an XML file for the developer interface, describing the layout, style, and interaction logic of interface components (buttons, text boxes, etc.). The code file can be a source code file, such as a Java or Kotlin file. A toggle event can be an event triggered by the action of moving from the currently operated file (such as the layout file) to another file (such as the code file).
[0063] Optionally, electronic devices can use existing technologies to identify, record, and analyze the process of the developer switching behavior, and this application does not limit this.
[0064] This application's embodiments proactively identify the contextual intent of developers' cross-file operations by determining the switching events between layout files and code files. Compared to traditional completion methods that fail to recognize the linkage between interface design (XML) and logic code (Kotlin / Java), leading to completion failures, this application's embodiments provide a triggering basis for contextual completion, improving the accuracy of code completion.
[0065] Based on the premise that the electronic device can determine whether the developer has triggered a switching event between the layout file and the code file, in one embodiment, S103 may include:
[0066] First, the electronic device can call the code completion model when the target confidence level is greater than or equal to the preset confidence level and the code file is of non-Extensible Markup Language (XML).
[0067] Optionally, the code completion model can be a large language model. Electronic devices can invoke the code completion model via an API. The electronic device can input relevant information about the target code into the code completion model, determine candidate codes, and output code completion suggestions including the candidate codes.
[0068] For example, relevant information about the target code may include, for instance, the identifiers and trajectory data of view controls in the integrated development environment, as well as one or more of the code file information. This information may also include code before and after the cursor position (such as function calls, variable declarations, and loop structures), helping the code completion model understand the current editing intent. Furthermore, relevant information about the target code may include developer behavior data, such as recently entered code snippets and modification records (such as deletion / insertion operations), helping the code completion model predict recurring patterns or common errors.
[0069] In one implementation, the electronic device can input at least the identifiers and trajectory data of view controls in the integrated development environment (IDE), as well as the code file, into the code completion model to obtain candidate code. The view controls can include any one or more of the following: buttons, text boxes, lists, etc., and the identifier of the view control can be a unique identifier for the view control. For example, the identifier of the view control can be an identifier (ID) specific to controls in the IDE, such as R.id.button1 (an identifier).
[0070] The identifiers of view controls can help the code completion model understand which UI element the currently edited code is related to, thereby generating more context-appropriate candidate code.
[0071] Trajectory data can characterize the movement trajectory of the cursor during code editing. By using trajectory data, code completion models can more accurately understand the developer's operational intentions, thereby generating candidate code that better meets the developer's needs.
[0072] Code files define various functionalities of an application, such as view control initialization, event handling logic, and business logic. Code completion models analyze the contents of code files to understand the syntax structure, variable definitions, method calls, and other information of the current code, thereby generating candidate code that fits the current code context.
[0073] In this embodiment, the view control ID, trajectory data, and code file can be input into the code completion model, and candidate codes can be obtained through the code completion model, which can improve the accuracy of control-level code completion.
[0074] This application's embodiments can invoke the code completion model for non-XML files, reducing invalid suggestions such as incorrectly inferring Java methods in layout files. Existing technologies send the code context to a cloud model and return multi-line completion suggestions through a large model. This method consumes a large amount of memory, has weak context awareness, and low accuracy. Compared to existing methods, this application's embodiments can reduce memory consumption, perceive the context of the target code, and improve accuracy by invoking the code completion model.
[0075] Secondly, the electronic device can call the attribute completion model in response to a target confidence level greater than or equal to a preset confidence level, and the code file is of XML type.
[0076] Optionally, the attribute completion model can be used to analyze and process attribute information in code files and generate possible attribute completion reference information based on the context. Electronic devices can use the attribute completion model to determine the attribute completion reference information of code files and output attribute completion hints that include the attribute completion reference information.
[0077] Optionally, the attribute completion reference information can be a series of possible attribute values or attribute suggestions generated based on the context and attribute rules of the code file.
[0078] The embodiments of this application can call the attribute completion model for XML files and provide attribute completion reference information, which can reduce the situation where the code completion model generates invalid Java code in XML and improve the accuracy of code completion.
[0079] The above method is illustrated below with a specific embodiment.
[0080] The code completion in this application embodiment can be achieved through the following process:
[0081] 1. Electronic devices respond to code written by developers.
[0082] 2. Use electronic devices to observe the cursor trajectory.
[0083] 3. Electronic devices can infer the developer's intentions based on cursor trajectory.
[0084] 4. Electronic devices display code completion suggestions within seconds.
[0085] The core steps of the above process are as follows:
[0086] 1. Trajectory sampling.
[0087] The cursor movement trajectory is sampled at a frequency of 100Hz. Each sample generates an object containing a timestamp, coordinates within the integrated development environment, movement speed (pixels / milliseconds), current operation view ID, and file type (XML / Kotlin / Java). This fully records the real-time dynamic data of the cursor in the code editing area during the development of financial service applications, providing structured contextual input support for subsequent precise code completion triggered by trajectory analysis.
[0088] 2. Thermal modeling.
[0089] Define a function that takes a list of cursor trajectory samples as input, calculates the speed decay weight for each sample, multiplies it by the dwell time corresponding to that sample, and finally sums the weighted results of all samples. This implements trajectory data weight aggregation based on Gaussian kernel smoothing, which is used to quantify the intensity of developers' attention to the target code and support the stable calculation of target confidence.
[0090] 3. Layered completion trigger.
[0091] When the heat value calculated in step 2 exceeds the preset threshold, a lightweight model is loaded to support efficient inference; if it is detected that the current environment is an XML layout file, only the completion function (such as layout attributes, view control parameters, etc.) is triggered to avoid recommending invalid Java method suggestions, thereby accurately adapting to the dual needs of "code logic completion" and "interface attribute configuration" in financial service application development, improving development efficiency and suggestion accuracy.
[0092] This application's embodiments achieve synergistic optimization of performance, resources, and accuracy through cursor trajectory analysis and a layered completion mechanism: on the one hand, it significantly improves the completion response speed of high-frequency code snippets; on the other hand, it reduces memory usage through a lightweight model and dynamic memory management; and for scenarios involving the linkage of layout files and code files, it substantially improves code completion accuracy, fully meeting the dual requirements of efficiency and stability for financial service application development.
[0093] The above are the method embodiments provided in this application. The apparatus provided in this application will be described below.
[0094] Figure 2 A schematic diagram of the structure of a code completion device provided in this application is shown below. Figure 2 As shown, the code completion device 200 provided in this embodiment includes: a first determining module 201, a second determining module 202, an output module 203, and a completion module 204. Optionally, the code completion device 200 may further include a processing module 205.
[0095] The first determining module 201 is used to determine the trajectory data of cursor movement based on the cursor positioning plugin of the integrated development environment; the integrated development environment is used to develop financial service applications.
[0096] The second determining module 202 is used to determine the target confidence level of the occurrence of the target event based on the trajectory data; the target event is: code completion is required for the target code.
[0097] Output module 203 is used to output code completion suggestions in response to a target confidence level being greater than or equal to a preset confidence level. The code completion suggestions include candidate codes for completing the target code.
[0098] The code completion module 204 is used to complete the target code based on candidate code in response to code completion instructions.
[0099] Optionally, the second determining module 202 is specifically used to obtain an initial confidence level of the occurrence of the target event based on the trajectory data. The initial confidence level is then subjected to Gaussian kernel smoothing to obtain the target confidence level.
[0100] For example, the trajectory data includes at least: the position of the cursor's trajectory point, the timestamp of the trajectory point, and the second determining module 202, specifically used to determine the duration of the cursor's stay at the target code and the cursor's velocity decay parameter based on the position of the trajectory point and the timestamp of the trajectory point. An initial confidence level is determined based on the product of the stay duration and the velocity decay parameter.
[0101] Optionally, before the first determining module 201 determines the cursor movement trajectory data based on the cursor positioning plugin of the integrated development environment, the processing module 205 determines the switch event between the layout file and the code file triggered by the developer during the process of the developer developing the financial services application through the integrated development environment.
[0102] Optionally, output module 203 is specifically configured to, in response to a target confidence level greater than or equal to a preset confidence level, and the code file type being non-Extensible Markup Language (XML), invoke the code completion model. The code completion model determines candidate code. The output includes code completion suggestions for the candidate code.
[0103] For example, output module 203 is specifically used to input at least the identifiers and trajectory data of view controls in the integrated development environment, as well as the code file, into the code completion model to obtain candidate code.
[0104] Optionally, output module 203 is specifically used to invoke the attribute completion model in response to a target confidence level greater than or equal to a preset confidence level and the code file being of XML type. The attribute completion model determines attribute completion reference information for the code file. The output includes attribute completion hints that incorporate the attribute completion reference information.
[0105] The code completion device provided in this embodiment can execute the methods provided in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0106] Figure 3 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 3 As shown, the electronic device 500 provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the device 500 further includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus 504.
[0107] In a specific implementation, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to perform the above-described method.
[0108] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0109] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0110] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0111] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0112] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0113] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0114] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0115] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0116] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0117] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0118] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0119] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0120] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0121] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A code completion method, characterized by, The method includes: A cursor positioning plugin based on an integrated development environment (IDE) determines the trajectory data of cursor movement; the IDE is used to develop financial service applications. Based on the trajectory data, the target confidence level of the target event is determined; the target event is: code completion is required for the target code. In response to the target confidence level being greater than or equal to a preset confidence level, a code completion suggestion is output, the code completion suggestion including: candidate codes for completing the target code; In response to the code completion instruction, the target code is completed based on the candidate code.
2. The method according to claim 1, characterized in that, The determination of the target confidence level based on the trajectory data includes: Based on the trajectory data, the initial confidence level of the occurrence of the target event is obtained; The initial confidence level is smoothed using Gaussian kernels to obtain the target confidence level.
3. The method according to claim 2, characterized in that, The trajectory data includes at least: the position of the cursor's trajectory point and the timestamp of the trajectory point. The initial confidence level of the target event's occurrence, based on the trajectory data, includes: Based on the position of the trajectory point and the timestamp of the trajectory point, determine the duration of the cursor's stay at the target code and the cursor's speed decay parameter; The initial confidence level is determined based on the product of the dwell time and the velocity decay parameter.
4. The method according to any one of claims 1-3, characterized in that, Before determining the cursor movement trajectory data using the cursor positioning plugin based on the integrated development environment, the method further includes: During the process of a developer developing the financial services application through the integrated development environment, it is determined that the developer triggers a switch event between the layout file and the code file.
5. The method according to claim 4, characterized in that, The response that the target confidence level is greater than or equal to the preset confidence level, outputting code completion suggestions, includes: In response to the target confidence level being greater than or equal to the preset confidence level, and the file type of the code file being non-Extensible Markup Language (XML), the code completion model is invoked; The candidate code is determined using the code completion model. The output includes the code completion suggestions for the candidate code.
6. The method according to claim 5, characterized in that, The step of determining the candidate code through the code completion model includes: The candidate code is obtained by inputting at least the identifier of the view control in the integrated development environment, the trajectory data, and the code file into the code completion model.
7. The method according to claim 5, characterized in that, The method further includes: In response to the target confidence level being greater than or equal to the preset confidence level, and the file type of the code file being XML, the attribute completion model is invoked; The attribute completion model is used to determine the attribute completion reference information of the code file. The output includes attribute completion suggestions that include the attribute completion reference information.
8. A code completion device, characterized in that, include: The first determination module is used by the cursor positioning plugin based on the integrated development environment to determine the trajectory data of cursor movement; The integrated development environment is used to develop financial service applications; The second determining module is used to determine the target confidence level of the occurrence of the target event based on the trajectory data; the target event is: code completion is required for the target code; An output module is configured to output code completion suggestions in response to the target confidence level being greater than or equal to a preset confidence level. The code completion suggestions include candidate codes for completing the target code. A code completion module is used to complete the target code based on the candidate code in response to a code completion instruction.
9. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.
11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.