CN113485688A - Code completion method and device, storage medium and electronic equipment - Google Patents

Code completion method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN113485688A
CN113485688A CN202110744406.0A CN202110744406A CN113485688A CN 113485688 A CN113485688 A CN 113485688A CN 202110744406 A CN202110744406 A CN 202110744406A CN 113485688 A CN113485688 A CN 113485688A
Authority
CN
China
Prior art keywords
configuration information
code
interface
completion
application programming
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110744406.0A
Other languages
Chinese (zh)
Other versions
CN113485688B (en
Inventor
黄富华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Boguan Information Technology Co Ltd
Original Assignee
Guangzhou Boguan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Boguan Information Technology Co Ltd filed Critical Guangzhou Boguan Information Technology Co Ltd
Priority to CN202110744406.0A priority Critical patent/CN113485688B/en
Publication of CN113485688A publication Critical patent/CN113485688A/en
Application granted granted Critical
Publication of CN113485688B publication Critical patent/CN113485688B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure provides a code completion method, a code completion device, a storage medium and electronic equipment, and relates to the technical field of computers. The code completion method comprises the following steps: acquiring interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame; detecting an application programming interface contained in the interface configuration information according to the name of the development framework; generating code completion configuration information with a target completion format according to the detected application programming interface; and performing code completion on the code to be edited by calling the code completion configuration information. The method and the device for realizing automatic code completion aiming at the code framework have strong adaptability, can automatically generate code completion configuration information, and reduce the workload of developers.

Description

Code completion method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a code completion method, a code completion apparatus, a computer-readable storage medium, and an electronic device.
Background
In order to increase the code editing speed of developers and reduce the code input amount, a code completion function is usually set in an integrated development environment.
In the related art, a code autocomplete function is generally set for an open source framework, such as an open source framework such as CSS (Cascading Style Sheets), JS (JavaScript (script voice running on a browser), and the like. For some non-open-source frameworks, such as some internal code frameworks developed by enterprises, lacking automatic code completion tools, it is usually necessary to manually edit the relevant file logic of code completion, which is a heavy workload for developers and cannot be applied to different code frameworks.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a code completion method, a code completion apparatus, a computer-readable storage medium, and an electronic device, thereby solving, at least to some extent, the problems of a large workload and poor adaptability of a code completion method employed in the related art.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a code completion method, comprising: acquiring interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame; detecting an application programming interface contained in the interface configuration information according to the name of the development framework; generating code completion configuration information with a target completion format according to the detected application programming interface; and performing code completion on the code to be edited by calling the code completion configuration information.
In an exemplary embodiment of the present disclosure, the method further includes: acquiring the latest interface configuration information corresponding to the development framework; and updating the completion configuration information according to the latest interface configuration information.
In an exemplary embodiment of the present disclosure, the acquiring the latest interface configuration information corresponding to the development framework includes: and locally recording the version number of the interface configuration information so as to obtain the latest interface configuration information corresponding to the development frame according to the locally recorded version number.
In an exemplary embodiment of the present disclosure, the obtaining the latest interface configuration information corresponding to the development framework according to the locally recorded version number includes: and when the locally recorded version number is inconsistent with the version number of the current interface configuration information, taking the current interface configuration information as the latest interface configuration information, and updating the locally recorded version number.
In an exemplary embodiment of the present disclosure, the method further includes: determining an unused application programming interface in the code completion configuration information according to the calling record of the code to be edited for the code completion configuration information; and generating first verification prompt information according to the unused application programming interface, so that a developer verifies whether the target code completion configuration information corresponding to the unused application programming interface is correct or not based on the first verification prompt information.
In an exemplary embodiment of the present disclosure, the method further includes: determining an application programming interface which is not detected in the interface configuration information according to the calling record of the code to be edited aiming at the code completion configuration information; and generating second checking prompt information according to the undetected application programming interface so that a developer can check whether the target interface configuration information corresponding to the undetected application programming interface is correct or not based on the second checking prompt information.
In an exemplary embodiment of the present disclosure, the detecting, according to the name of the development framework, an application programming interface included in the interface configuration information includes: generating a regular expression with a target matching format according to the name of the development frame; and matching out the application programming interface contained in the interface configuration information based on the regular expression.
According to a second aspect of the present disclosure, there is provided a code completion apparatus, comprising: the interface configuration information acquisition module is used for acquiring interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame; the application programming interface detection module is used for detecting the application programming interface contained in the interface configuration information according to the name of the development frame; the completion configuration information generation module is used for generating code completion configuration information with a target completion format according to the detected application programming interface; and the code completion module is used for performing code completion on the code to be edited by calling the code completion configuration information.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the code completion method described above.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the code completion method described above via execution of the executable instructions.
The technical scheme of the disclosure has the following beneficial effects:
in the code completion process, the application programming interface contained in the interface configuration information is detected through the name of the development frame, and the code completion configuration information with the target completion format is generated according to the detected application programming interface so as to realize the code completion function. On one hand, the related file logic of the code completion does not need to be manually edited, and the automatic generation of the code completion configuration information can reduce the workload of generating the code completion configuration. On the other hand, the code completion configuration information corresponding to the development framework is generated based on the interface configuration information of the development framework and the name of the development framework, so that the method is applicable to different development frameworks and can enhance the universality of code completion.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is apparent that the drawings in the following description are only some embodiments of the present disclosure, and that other drawings can be obtained from those drawings without inventive effort for a person skilled in the art.
FIG. 1 illustrates a flow chart of a method of code completion in the present exemplary embodiment;
FIG. 2 illustrates a flow diagram for updating completion configuration information in the exemplary embodiment;
FIG. 3 illustrates a flow diagram for complementing configuration information correction of a code in the exemplary embodiment;
FIG. 4 illustrates a flow chart of one type of correction for interface configuration information in the present exemplary embodiment;
FIG. 5 illustrates a flow diagram of a code completion implementation in the exemplary embodiment;
fig. 6 is a block diagram showing a structure of a code completion apparatus in the present exemplary embodiment;
fig. 7 shows an electronic device for implementing the above method in the present exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Herein, "first", "second", etc. are labels for specific objects, and do not limit the number or order of the objects.
In the related art, there is also a code automatic completion method for detecting a general syntax format of a code, which is difficult to adapt to a non-open-source code frame, generally needs to manually edit the logic of a code completion related file, lacks an automatic completion tool for the non-open-source frame, and has a large workload and poor adaptability.
In view of one or more of the above problems, exemplary embodiments of the present disclosure provide a code completion method.
Fig. 1 shows a schematic flow of a code completion method in the present exemplary embodiment, including the following steps S110 to S140:
step S110, acquiring interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame;
step S120, detecting an application programming interface contained in the interface configuration information according to the name of the development frame;
step S130, generating code completion configuration information with a target completion format according to the detected application programming interface;
and step S140, performing code completion on the code to be edited by calling the code completion configuration information.
In the code completion process, the application programming interface contained in the interface configuration information is detected through the name of the development frame, and the code completion configuration information with the target completion format is generated according to the detected application programming interface so as to realize the code completion function. On one hand, the related file logic of the code completion does not need to be manually edited, and the automatic generation of the code completion configuration information can reduce the workload of generating the code completion configuration. On the other hand, the code completion configuration information corresponding to the development framework is generated based on the interface configuration information of the development framework and the name of the development framework, so that the method is applicable to different development frameworks and can enhance the universality of code completion.
Each step in fig. 1 will be described in detail below.
Step S110, acquiring interface configuration information corresponding to the development frame of the code to be edited and the name of the development frame.
The code to be edited refers to editable code based on the development framework. The development framework is framework-level software in the program development process, and can be, for example, JSSDK, Vue, React, software development tools used in enterprises and other development frameworks, including underlying basic components, general components, coded communication conventions and the like used in the program development process, and software products can be developed based on the development frameworks. The JSSDK, Vue and React represent names of development frameworks, the JSSDK framework adopts Java script language and is a service-oriented development framework, and Vue and the React framework both belong to a development framework for constructing a user interface.
The interface configuration information refers to an interface description document configured according to an application programming interface in a development framework, and includes use cases of the application programming interfaces, and taking a JSSDK development framework as an example, the following code segments are interface configuration information corresponding to an application programming interface "share": share (conf), where { xxx } represents a use case of the "share" interface.
It should be noted that, before the interface configuration information corresponding to the development framework of the code to be edited is obtained, a configuration file with a preset format and related to the interface configuration information may be configured in advance for the development framework of the code to be edited, so as to detect the application programming interface in the configuration file.
Step S120, detecting an application programming interface included in the interface configuration information according to the name of the development framework.
The included application programming interface can be detected from the interface configuration information by reading the content of the interface configuration information and taking the name of the development framework as the basis. When the name of the development framework is JSSDK, in the above-mentioned code fragment, share can be extracted, and further, share of the application programming interface is detected.
In an alternative embodiment, detecting the application programming interface included in the interface configuration information according to the name of the development framework may be further implemented by: generating a regular expression with a target matching format according to the name of the development frame; and matching the application programming interface contained in the interface configuration information based on the regular expression.
The target matching format may be a code matching format composed of a frame name and an interface name in the interface configuration information. And realizing the precise matching of the frame name and the fuzzy matching of the interface name through a regular expression so as to extract a corresponding application programming interface.
For example: taking the code segment as an example, characters in JSSDK format included in the interface configuration information may be retrieved, and extracted as an application programming interface, where the characters may be used to represent interface name matching information.
In the process, the application programming interface contained in the interface configuration information is detected through the regular expression, the flexibility is strong, the application range is wide, and the automatic grabbing of the application programming interface can be realized aiming at different code frames.
Step S130, generating code completion configuration information having a target completion format according to the detected application programming interface.
The target completion format refers to a code completion format corresponding to the integrated development environment, and completion configuration information includes completion code segments corresponding to the application programming interfaces.
And step S140, performing code completion on the code to be edited by calling the code completion configuration information.
The code editor can call the code completion configuration information, retrieve the completion code segment in the code completion configuration information and perform code completion on the code to be edited.
In an optional implementation manner, in the code completion process, when an application programming interface of the development framework is changed, the interface configuration information needs to be updated, so as to obtain the latest completion configuration information. The completion configuration information may be updated through the steps shown in fig. 2, which specifically includes the following steps S210 to S220:
step S210, obtaining the latest interface configuration information corresponding to the development framework.
The latest interface configuration information refers to interface configuration information corresponding to the development frame of the current latest version, and since the interface configuration included in the interface configuration information may be changed, deleted or newly added according to the update of the development frame, the latest interface configuration information needs to be acquired to ensure the availability of the subsequently generated code completion configuration information.
Obtaining the latest interface configuration information can be performed in the following two ways: the method comprises the steps of periodically pulling up the latest interface configuration information to update the interface configuration information, and judging whether the interface configuration information is changed or not to update the interface configuration information when the integrated development environment is used every time.
It should be noted that, in the actual use process, which way is specifically adopted to obtain the latest interface configuration information may be set by a developer, and an applicable way is selected, and the two ways of obtaining the latest interface configuration information are specifically described below.
If the first manner of obtaining the latest interface configuration information is adopted, the method may specifically include: and acquiring the latest interface configuration information according to a preset time period so that the interface configuration information adopted in the code completion process can be adapted to the latest development framework.
If the second method for acquiring the latest interface configuration information is adopted, a version number may be configured for the interface configuration information in advance, the update status of the interface configuration information is recorded through the version number, and once the interface configuration information changes, the version number of the interface configuration information is updated, so as to determine whether the interface configuration information changes based on the version number of the interface configuration information, thereby ensuring that the acquired updated interface configuration information is acquired.
In the second method for acquiring the latest interface configuration information, after the interface configuration information of the development framework is acquired, the version number of the interface configuration information needs to be locally recorded, so as to acquire the latest interface configuration information corresponding to the development framework according to the locally recorded version number.
In an optional implementation manner, obtaining the latest interface configuration information corresponding to the development framework according to the locally recorded version number may be implemented in the following manner, specifically including: and when the locally recorded version number is inconsistent with the version number of the current interface configuration information, taking the current interface configuration information as the latest interface configuration information, and updating the locally recorded version number.
In the process, whether the interface configuration information changes is judged by comparing the version number of the current configuration information with the locally recorded version number, so that the latest interface configuration information can be acquired in time when the interface configuration information changes.
Step S220, updating the completion configuration information according to the latest interface configuration information.
Because the interface of the development framework may be changed or a new application programming interface may be added, the interface configuration information of the development framework needs to be updated correspondingly, and the completion configuration information also needs to be updated correspondingly according to the latest interface configuration information. When the completion configuration information is updated according to the latest interface configuration information, the application programming interface included in the latest interface configuration information can be detected again according to the name of the development frame, so that the code completion configuration information is updated according to the latest detection result of the application programming interface. In addition, the updated application programming interface can be determined by recording the updated part of the current version interface configuration information relative to the previous version interface configuration information and detecting the data information of the updated part based on the name of the development frame, and the updated application programming interface adopts a target completion format to update the corresponding code completion configuration information.
Since the code completion configuration information is generated by the application programming interface detected in the detection configuration information, an error is unavoidably existed in the automatic detection process, and a detection error or undetected condition of the application programming interface may occur, so that an information error checking mechanism can be set for the code completion method.
In an alternative embodiment, the code completion configuration information may be corrected through the steps shown in fig. 3, specifically including the following steps S310 to S320:
step S310, determining an unused application programming interface in the code completion configuration information according to a calling record of the code to be edited for the code completion configuration information;
step S320, generating first verification prompt information according to the unused application programming interface, so that the developer verifies whether the target code completion configuration information corresponding to the unused application programming interface is correct based on the first verification prompt information.
The call record refers to a call record of a completion code segment corresponding to a corresponding application programming interface in the code completion configuration information by the code editor according to the code to be edited. The first verification hint information refers to relevant hint information regarding unused application programming interfaces. The target code completion configuration information refers to code completion configuration information corresponding to an unused application programming interface, the target completion code configuration information needs to be verified by a developer for correctness, if the target code configuration information has errors, the developer can correct the target code completion configuration information, and if the target code configuration information does not have errors, the developer does not perform processing.
It should be noted that, the statistical developer may periodically check the code completion configuration information for the code completion call record of the application programming interface, so as to find information with configuration errors in the code completion configuration information. The application programming interface which is not used by the developer is determined by calling the record, the code completion configuration information corresponding to the application programming interface which is not used may be the information of configuration errors, the related prompt information of the application programming interface which is not used is generated, and an information error checking mechanism is established, so that the developer can carry out targeted checking and correction on the code completion configuration information, and the fault tolerance of code completion is enhanced.
In an optional embodiment, the interface configuration information may be corrected through the following steps S410 to S420, and specifically includes the following steps S410 to S420:
step S410, determining an application programming interface which is not detected in the interface configuration information according to the calling record of the code completion configuration information of the code to be edited;
step S420 is to generate second verification prompt information according to the undetected application programming interface, so that the developer verifies whether the target interface configuration information corresponding to the undetected application programming interface is correct based on the second verification prompt information.
The second check-up hint information refers to relevant hint information regarding undetected application programming interfaces. The target interface configuration information refers to interface configuration information corresponding to the undetected application programming interface, the interface configuration information needs to be verified by a developer for correctness, if the target interface configuration information has errors, the developer can correct the target interface configuration information, and if the target interface configuration information does not have errors, the developer does not process the target interface configuration information. The second check prompt information can be generated by periodically executing the steps, an information error check mechanism is perfected, a developer can conveniently carry out targeted check and correction on the interface configuration information, and the fault tolerance of code completion is further enhanced.
As shown in fig. 5, a flow chart for implementing code completion is provided, which specifically includes the following steps:
step S510, obtaining an interface configuration file;
step S520, generating a code completion configuration file corresponding to the integrated development environment according to the interface configuration file;
step S530, automatically updating the code completion configuration file;
and step S540, correcting the interface configuration file or the completion configuration file according to the calling record of the code to be edited aiming at the completion configuration file.
It should be noted that the interface configuration file has interface configuration information recorded therein, the code completion configuration file has code completion configuration information recorded therein, step S530 may update the code completion configuration file through the steps shown in fig. 2, and step S540 may perform correction processing on the code completion configuration file and the interface configuration file through the steps shown in fig. 3 and fig. 4, respectively.
Exemplary embodiments of the present disclosure also provide a code complementing apparatus. As shown in fig. 6, the code completing apparatus 600 may include:
the interface configuration information acquiring module 610 is configured to acquire interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame;
an application programming interface detection module 620, configured to detect an application programming interface included in the interface configuration information according to the name of the development framework;
a completion configuration information generating module 630, configured to generate code completion configuration information having a target completion format according to the detected application programming interface;
and the code completion module 640 is configured to perform code completion on the code to be edited by calling the code completion configuration information.
In an optional implementation manner, the code completing apparatus may further include: the latest interface configuration acquisition module is used for acquiring the latest interface configuration information corresponding to the development framework; and the completion configuration updating module is used for updating the completion configuration information according to the latest interface configuration information.
In an optional implementation manner, the latest interface configuration obtaining module includes: and the version number recording module is used for locally recording the version number of the interface configuration information so as to obtain the latest interface configuration information corresponding to the development frame according to the locally recorded version number.
In an optional implementation manner, the version number recording module may be further configured to: and when the locally recorded version number is inconsistent with the version number of the current interface configuration information, taking the current interface configuration information as the latest interface configuration information, and updating the locally recorded version number.
In an optional implementation manner, the code completing apparatus may further include: the unused interface determining module is used for determining an unused application programming interface in the code completion configuration information according to the calling record of the code to be edited for the code completion configuration information; the first prompt module is used for generating first verification prompt information according to the unused application programming interface, so that a developer can verify whether the target code completion configuration information corresponding to the unused application programming interface is correct or not based on the first verification prompt information.
In an optional implementation manner, the code completing apparatus may further include: the undetected interface determining module is used for determining an undetected application programming interface in the interface configuration information according to the call record of the code completion configuration information of the code to be edited; the second prompt module is used for generating second check prompt information according to the undetected application programming interfaces, so that a developer can check whether the target interface configuration information corresponding to the undetected application programming interfaces is correct or not based on the second check prompt information.
In an alternative embodiment, the api detection module 620 may be configured to: generating a regular expression with a target matching format according to the name of the development frame; and matching the application programming interface contained in the interface configuration information based on the regular expression.
The specific details of each part in the code completion apparatus 600 are described in detail in the method part embodiment, and details that are not disclosed may refer to the method part embodiment, and thus are not described again.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described code complementing method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing an electronic device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the electronic device. The program product may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Exemplary embodiments of the present disclosure also provide an electronic device capable of implementing the code complementing method. An electronic device 700 according to such an exemplary embodiment of the present disclosure is described below with reference to fig. 7. The electronic device 700 shown in fig. 7 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 may take the form of a general purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one memory unit 720, a bus 730 that connects the various system components (including the memory unit 720 and the processing unit 710), and a display unit 740.
The memory unit 720 stores program code that may be executed by the processing unit 710 to cause the processing unit 710 to perform steps according to various exemplary embodiments of the present disclosure as described in the "exemplary methods" section above in this specification. For example, processing unit 710 may perform any one or more of the method steps of fig. 1-5.
The storage unit 720 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)721 and/or a cache memory unit 722, and may further include a read only memory unit (ROM) 723.
The memory unit 720 may also include programs/utilities 724 having a set (at least one) of program modules 725, such program modules 725 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 730 may be any representation of one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 700, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 700 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 750. Also, the electronic device 700 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network such as the Internet) via the network adapter 770. As shown, the network adapter 770 communicates with the other modules of the electronic device 700 over the bus 730. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary embodiments of the present disclosure.
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit, according to exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the following claims.

Claims (10)

1. A method of code completion, comprising:
acquiring interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame;
detecting an application programming interface contained in the interface configuration information according to the name of the development framework;
generating code completion configuration information with a target completion format according to the detected application programming interface;
and performing code completion on the code to be edited by calling the code completion configuration information.
2. The method of claim 1, further comprising:
acquiring the latest interface configuration information corresponding to the development framework;
and updating the completion configuration information according to the latest interface configuration information.
3. The method of claim 2, wherein the obtaining the latest interface configuration information corresponding to the development framework comprises:
and locally recording the version number of the interface configuration information so as to obtain the latest interface configuration information corresponding to the development frame according to the locally recorded version number.
4. The method according to claim 3, wherein the obtaining the latest interface configuration information corresponding to the development framework according to the locally recorded version number includes:
and when the locally recorded version number is inconsistent with the version number of the current interface configuration information, taking the current interface configuration information as the latest interface configuration information corresponding to the development frame, and updating the locally recorded version number.
5. The method of claim 1, further comprising:
determining an unused application programming interface in the code completion configuration information according to the calling record of the code to be edited for the code completion configuration information;
and generating first verification prompt information according to the unused application programming interface, so that a developer verifies whether the target code completion configuration information corresponding to the unused application programming interface is correct or not based on the first verification prompt information.
6. The method of claim 1, further comprising:
determining an application programming interface which is not detected in the interface configuration information according to the calling record of the code to be edited aiming at the code completion configuration information;
and generating second checking prompt information according to the undetected application programming interface so that a developer can check whether the target interface configuration information corresponding to the undetected application programming interface is correct or not based on the second checking prompt information.
7. The method according to claim 1, wherein the detecting the application programming interface included in the interface configuration information according to the name of the development framework comprises:
generating a regular expression with a target matching format according to the name of the development frame;
and matching out the application programming interface contained in the interface configuration information based on the regular expression.
8. A code completion apparatus, comprising:
the interface configuration information acquisition module is used for acquiring interface configuration information corresponding to a development frame of a code to be edited and a name of the development frame;
the application programming interface detection module is used for detecting the application programming interface contained in the interface configuration information according to the name of the development frame;
the completion configuration information generation module is used for generating code completion configuration information with a target completion format according to the detected application programming interface;
and the code completion module is used for performing code completion on the code to be edited by calling the code completion configuration information.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1 to 7 via execution of the executable instructions.
CN202110744406.0A 2021-07-01 2021-07-01 Code completion method and device, storage medium and electronic equipment Active CN113485688B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110744406.0A CN113485688B (en) 2021-07-01 2021-07-01 Code completion method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110744406.0A CN113485688B (en) 2021-07-01 2021-07-01 Code completion method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113485688A true CN113485688A (en) 2021-10-08
CN113485688B CN113485688B (en) 2022-08-05

Family

ID=77937529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110744406.0A Active CN113485688B (en) 2021-07-01 2021-07-01 Code completion method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113485688B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070039010A1 (en) * 2005-08-15 2007-02-15 Microsoft Corporation Automatic generation of software code to facilitate interoperability
CN109683907A (en) * 2018-12-29 2019-04-26 深圳乐信软件技术有限公司 Code completion method, apparatus, equipment and storage medium
CN111176626A (en) * 2019-08-05 2020-05-19 腾讯科技(深圳)有限公司 Cross-programming-language code calling method and device, medium and equipment
CN111367513A (en) * 2020-02-20 2020-07-03 北京达佳互联信息技术有限公司 Code completion method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070039010A1 (en) * 2005-08-15 2007-02-15 Microsoft Corporation Automatic generation of software code to facilitate interoperability
CN109683907A (en) * 2018-12-29 2019-04-26 深圳乐信软件技术有限公司 Code completion method, apparatus, equipment and storage medium
CN111176626A (en) * 2019-08-05 2020-05-19 腾讯科技(深圳)有限公司 Cross-programming-language code calling method and device, medium and equipment
CN111367513A (en) * 2020-02-20 2020-07-03 北京达佳互联信息技术有限公司 Code completion method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113485688B (en) 2022-08-05

Similar Documents

Publication Publication Date Title
US10613971B1 (en) Autonomous testing of web-based applications
CN109739478B (en) Front-end project automatic construction method and device, storage medium and electronic equipment
CN109117131B (en) Code generation method and device, storage medium and electronic terminal
CN110516971B (en) Anomaly detection method, device, medium and computing equipment
US8156473B2 (en) Model oriented debugging
CN109408105A (en) Acquisition method, device, computing device and the storage medium of user behavior data
CN112527382B (en) Method for deploying pipeline engine system, and method and device for continuous integration
CN110389755B (en) Code processing method and device, electronic equipment and computer readable storage medium
CN109299124B (en) Method and apparatus for updating a model
CN114138244A (en) Method and device for automatically generating model files, storage medium and electronic equipment
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN110728128A (en) Data report generation method, device, medium and electronic equipment
CN114077430A (en) Interface generation method and device, electronic equipment and storage medium
CN114253537A (en) Form generation method and device, electronic equipment and storage medium
CN110716804A (en) Method and device for automatically deleting useless resources, storage medium and electronic equipment
CN111061522A (en) Method, device, equipment and storage medium for generating front-end card assembly based on back end
CN110990264A (en) Element identification method, device and equipment for UI automation test and storage medium
CN112632425B (en) Method, device, equipment and storage medium for generating offline resource file
CN112988192A (en) Version updating method and device, electronic equipment and storage medium
CN110888641B (en) Script automatic generation method and device, server and storage medium
CN113485688B (en) Code completion method and device, storage medium and electronic equipment
CN111708681A (en) Log processing method, device, equipment and storage medium
CN113377648B (en) Software system diagnosis method, device, electronic equipment and computer readable medium
US11392371B2 (en) Identification of a partial code to be refactored within a source code
CN114338846B (en) Message testing method and device

Legal Events

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