Lune

OOPSLA2022Top-tier venue

Language-parametric static semantic code completion

Daniël A. A. Pelsmaeker, Hendrik van Antwerpen, Casper Bach Poulsen, Eelco Visser

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.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

3 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Language-Parametric Reference Synthesis cites Knowing when to ask: sound scheduling of name resolution in type checkers derived from declarative specifications
  • Incremental type-checking for free: using scope graphs to derive incremental type-checkers cites Knowing when to ask: sound scheduling of name resolution in type checkers derived from declarative specifications
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. Two Birds with One Stone: Boosting Code Generation and Code Search via a Generative Adversarial NetworkShangwen Wang, Bo Lin, Zhensu Sun, Ming Wen et al.OOPSLA 2023 · 21 citations
  2. Incremental type-checking for free: using scope graphs to derive incremental type-checkersAron Zwaan, Hendrik van Antwerpen, Eelco VisserOOPSLA 2022 · 3 citations
  3. Language-Parametric Reference SynthesisDaniël A. A. Pelsmaeker, Aron Zwaan, Casper Bach Poulsen, Arjan J. MooijOOPSLA 2025 · 1 citation

Builds on1

  1. Knowing when to ask: sound scheduling of name resolution in type checkers derived from declarative specificationsArjen Rouvoet, Hendrik van Antwerpen, Casper Bach Poulsen, Robbert Krebbers et al.OOPSLA 2020 · 9 citations

Related papers

  1. How Practitioners Expect Code Completion?Chaozheng Wang, Junhao Hu, Cuiyun Gao, Yu Jin et al.FSE 2023 · 24 citations
  2. Semantics Lifting for Syntactic SugarZhichao Guan, Yiyuan Cao, Tailai Yu, Ziheng Wang et al.OOPSLA 2024 · 1 citation
  3. API-Driven Program Synthesis for Testing Static Typing ImplementationsThodoris Sotiropoulos, Stefanos Chaliasos, Zhendong SuPOPL 2024 · 15 citations
  4. Synthesizing Formal Semantics from Executable InterpretersJiangyi Liu, Charlie Murphy, Anvay Grover, Keith J. C. Johnson et al.OOPSLA 2024
  5. Graduality and parametricity: together again for the first timeMax S. New, Dustin Jamner, Amal AhmedPOPL 2020 · 36 citations
Dusk over the sea between two cliffs drawn in fine vertical lines