Skip to content

LSP: Label details feature #14473

@rushter

Description

@rushter

It would be nice to support the label details feature that is implemented since LSP 3.17.

Right now, for autocompletions that add auto-imports, there is no way to tell which symbol is to select for importing:

Image

I can see extra details in the LSP logs:

 {
      "additionalTextEdits": [
        {
          "newText": "from selectolax.parser import HTMLParser\n",
          "range": { "end": { "character": 0, "line": 7 }, "start": { "character": 0, "line": 7 } }
        }
      ],
      "insertText": "HTMLParser",
      "kind": 7,
      "label": "HTMLParser",
      "labelDetails": { "detail": " (import selectolax.parser)" },
      "sortText": " 56"
    },
    {
      "additionalTextEdits": [
        {
          "newText": "from html.parser import HTMLParser\n",
          "range": { "end": { "character": 0, "line": 7 }, "start": { "character": 0, "line": 7 } }
        }
      ],
      "insertText": "HTMLParser",
      "kind": 7,
      "label": "HTMLParser",
      "labelDetails": { "detail": " (import html.parser)" },
      "sortText": " 57"
    },

They usually go next to suggestions, similar to how symbol kind is displayed in Rust Analyzer:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions