Affiliation:
1. Delft University of Technology, Netherlands
Abstract
Code completion is an editor service in IDEs that proposes code fragments for the user to insert at the caret position in their code. Code completion should be sound and complete. It should be sound, such that it only proposes fragments that do not violate the syntactic and static semantic rules of the language. It should be complete, such that it proposes all valid fragments so that code completion can be used to construct all programs. To realize soundness and completeness, code completion should be informed by the language definition. In practice, the implementation of code completion is an additional effort in the implementation of a language.
In this paper, we develop a framework for language-parametric semantic code completion for statically typed programming languages based on their specification of syntax and static semantics, realizing the implementation of a code completion editor service with minimal additional effort. The framework builds on the SDF3 syntax definition formalism and the Statix static semantics specification language. The algorithm reinterprets the static semantics definition to find sound expansions of predicates and solutions to name resolution queries in scope graphs. This allows a search strategy to explore the solution space and synthesize completion proposals. The implementation of the strategy language and code completion algorithm extend the implementation of the Statix solver, and can be used for any language defined in Statix. We demonstrate soundness and completeness of the completion proposal synthesis, and evaluate its performance.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
7 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. OIL: an industrial case study in language engineering with Spoofax;Software and Systems Modeling;2024-06-03
2. How Practitioners Expect Code Completion?;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30
3. Two Birds with One Stone: Boosting Code Generation and Code Search via a Generative Adversarial Network;Proceedings of the ACM on Programming Languages;2023-10-16
4. Verifying Well-Typedness Preservation of Refactorings using Scope Graphs;Proceedings of the 25th ACM International Workshop on Formal Techniques for Java-like Programs;2023-07-18
5. A text-based syntax completion method using LR parsing and its evaluation;Science of Computer Programming;2023-06