Skip to content

Properties completions lose qualified-prefix ranking after dots #287

Closed

Description

@luceat-lux-vestra

What happened?

Spring Boot property completions in .properties files are re-ranked against only the text after the last dot. For example, at server.p, Zed uses p as its local fuzzy query because the Properties language configuration does not declare . as a completion_query_character.

This can override the language server's deliberate sortText ranking. In a captured Spring Tools 5.2.0 completion response for server.p:

  • server.port was response item 0 with sortText: "00000".
  • server.ssl.key-password was item 6 with sortText: "00006".
  • deprecated server.max-http-post-size was item 119 with sortText: "00119" and tags: [1].

The visible Zed menu instead began with server.ssl.key-password, deprecated server.max-http-post-size, and several Tomcat max-part properties. server.port was not in the visible beginning.

Reproduction

  1. Open a Spring Boot project's application.properties with Spring Tools completion available.
  2. Type server.p and trigger completion.
  3. Compare the visible ordering with the textDocument/completion response's sortText values.

Source-backed cause

The current Properties config has no completion query characters:

name = "Properties"
grammar = "properties"
path_suffixes = ["properties"]
line_comments = ["# "]
brackets = [{ start = "[", end = "]", close = true, newline = true }]

Zed's completion query is the surrounding word under this language configuration, so . is punctuation and the query at server.p becomes p. Zed then ranks fuzzy score and match positions before LSP sortText.

I reproduced the sorter behavior on current zed-industries/zed main (2118a7c53a843b791adff6c21b0a4ca0de8478b9) using the captured labels/filter text/sort text:

p: ["server.ssl.key-password", "server.max-http-post-size", "server.tomcat.max-part-count", "server.tomcat.max-parameter-count", "server.tomcat.max-part-header-size", "server.port"]
server.p: ["server.port", "server.ssl.key-password", "server.max-http-post-size", "server.tomcat.max-part-count", "server.tomcat.max-parameter-count", "server.tomcat.max-part-header-size"]

This shows that including the dot in the query restores server.port to first place for this captured subset without changing Zed's global sorter.

Expected behavior / candidate fix

Properties completion should retain the qualified key prefix while filtering. The narrow candidate is:

completion_query_characters = [".", "-"]

. is directly verified by the sorter reproduction above. - should be covered as part of the same change because Spring property segments commonly use kebab case, but it still needs runtime coverage for relaxed binding aliases before merge.

Environment

  • Zed 1.11.3 (952d712dac48a4af2c54fb22c82d82a9d69b72d4)
  • Java extension 6.8.23 (ddc13dafaf9ddc44ab46c9ff9768832aa98dfe11)
  • Spring Tools 5.2.0.RELEASE (18d1a975dbea4f9314fd736d0237bd9e23f243f9)
  • macOS 26.5.2 arm64
  • Temurin JDK 25.0.3

Full source attribution and bounded runtime observations are recorded in R015.

Activity

  1. tartarughina commented on Jul 19, 2026

    @tartarughina
    Collaborator

    @luceat-lux-vestra thanks for the detailed report and for the suggested fix.

    The completion characters are usually provided by the languages server. See below how JDTLS informs Zed of those in the initial handshake communication.

    "completionProvider": {
        "triggerCharacters": [
          ".",
          "@",
          "#",
          "*",
          " "
        ]
    }
    

    I'd first try to see whether your language server could tell Zed about these trigger characters before adding an override to properties.
    Snippet below is following what the Ruby extension does: see

    [overrides.string]
    completion_query_characters = ["-", "."]
  2. luceat-lux-vestra commented on Jul 19, 2026

    @luceat-lux-vestra
    ContributorAuthor

    Thanks @tartarughina — the Ruby snippet you linked is exactly the shape of fix I had in mind. But I want to flag one thing on the "see whether the language server could tell Zed about these trigger characters first" suggestion, because I think it points at a different mechanism than the one causing the bad ranking. I checked this against current Zed source (2ed83a1ee6).

    triggerCharacters and completion_query_characters are two independent code paths in Zed:

    • triggerCharacters (server-advertised, your JDTLS handshake snippet) only decide when Zed fires a textDocument/completion request and what trigger context it attaches. They are consumed at crates/editor/src/completions.rs:446-460 purely to build the request's trigger_kind / trigger_character — they never feed the local filtering/ranking.
    • completion_query_characters (the language config.toml field, which is what the Ruby [overrides.string] snippet sets) is what decides the query word Zed extracts to fuzzy-rank the returned items. That word comes solely from completion_query() → surrounding_word(offset, Some(CharScopeContext::Completion)) (completions.rs:758), which reads the language's completion_query_characters (language.rs:1259, buffer.rs:6148).

    So a server advertising . as a trigger character — even this exact JDTLS list — will not change the ordering. At server.p, . is still not a query character, the local query collapses to p, and Zed's fuzzy score is applied ahead of the server's sortText (server.port ships as sortText: "00000" but drops out of the visible top). Only completion_query_characters moves that boundary.

    Two more reasons the server-trigger route doesn't cover this case:

    1. The quoted ["." , "@", "#", "*", " "] is JDTLS advertising for .java. These particular completions come from the Spring Tools language server over .properties — a different server and document than the Java handshake shown.
    2. Trigger lists aren't reusable as query characters anyway: (space), *, and @ would break word boundaries if promoted into completion_query_characters.

    So I believe the completion_query_characters override you pointed at (the Ruby pattern) is the correct and narrowest fix — adding [".", "-"] for the Properties language. Happy to open a PR with a fixture that asserts server.p, server.tomcat.m, and one deprecated property, if that direction works for you.

  3. tartarughina commented on Jul 19, 2026

    @tartarughina
    Collaborator

    @luceat-lux-vestra please, as you seem to have more insights on the specific issue, go ahead and create the pull request.

    One small note from my side, the override should probably be applied to property rather than string but I could be wrong.

  4. added a commit that references this issue on Jul 22, 2026
    f0fa2d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions