Skip to content

Inlay hint hover highlight doesn't cover the last character of the label #44812

@mikebronner

Description

@mikebronner

Description

When hovering over a clickable inlay hint (one with InlayHintLabelPart.location set), the hover highlight/underline doesn't extend to the last character of the label text. For example, if the label is → app/Livewire/UserProfile.php, the final p is not highlighted.

Steps to Reproduce

  1. Create an LSP server that returns inlay hints with clickable InlayHintLabelPart labels (see code below)
  2. Open a file that triggers the inlay hint
  3. Hover over the inlay hint to see the clickable highlight
  4. Observe that the last character is not included in the highlight

Expected Behavior

The entire label text should be highlighted when hovering, including the last character.

Actual Behavior

The highlight/underline stops one character short, leaving the final character unhighlighted.

Minimal LSP Response

The inlay hint returned by the LSP server:

{
  "position": { "line": 0, "character": 0 },
  "label": [
    {
      "value": "→ app/Livewire/UserProfile.php",
      "tooltip": "Cmd+Click to open: app/Livewire/UserProfile.php",
      "location": {
        "uri": "file:///path/to/app/Livewire/UserProfile.php",
        "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }
      }
    }
  ],
  "kind": 1,
  "paddingLeft": false,
  "paddingRight": true
}

Rust LSP Server Code (using tower-lsp 0.20)

hints.push(InlayHint {
    position: Position { line: 0, character: 0 },
    label: InlayHintLabel::LabelParts(vec![InlayHintLabelPart {
        value: format!("→ {}", display_path),
        tooltip: Some(InlayHintLabelPartTooltip::String(
            format!("Cmd+Click to open: {}", display_path)
        )),
        location: target_uri.map(|uri| Location {
            uri,
            range: Range::default(),
        }),
        command: None,
    }]),
    kind: Some(InlayHintKind::TYPE),
    text_edits: None,
    tooltip: None,
    padding_left: Some(false),
    padding_right: Some(true),
    data: None,
});

Environment

  • Zed version: v0.216.1+stable.95.81870d5cf77d61d40ec526a37141ebe3a74318ca
  • OS: macOS 26.1
  • Architecture: aarch64
  • Memory: 64 GiB
  • LSP: Custom LSP using tower-lsp 0.20, lsp-types 0.94

Metadata

Metadata

Assignees

No one assigned

    Labels

    community championIssues filed by our amazing community champions! 🫶

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions