Skip to content

feat: Add LSP 3.17 InlayHint features (resolve, textEdits, label parts)#4995

Open
takeokunn wants to merge 1 commit into
masterfrom
feature/issue-4775
Open

feat: Add LSP 3.17 InlayHint features (resolve, textEdits, label parts)#4995
takeokunn wants to merge 1 commit into
masterfrom
feature/issue-4775

Conversation

@takeokunn
Copy link
Copy Markdown
Collaborator

Summary

Extends lsp-mode's InlayHint support with LSP 3.17 specification features, addressing #4775.

  • Add inlayHint/resolve support with resolveSupport capability advertisement for textEdits and tooltip
  • Add lsp-inlay-hint-accept interactive command that applies a hint's textEdits (resolving lazily via inlayHint/resolve if needed)
  • Add InlayHintLabelPart rendering with per-part tooltip, location (click-to-navigate), and command (click-to-execute)
  • Add interactive mouse handler with three-tier click precedence: label part location → label part command → hint accept
  • Add tooltip and data field support on InlayHint type
  • Add :cancel-token to prevent stale async request accumulation
  • Add 3 new mock-server tests for hint data storage, label parts, and keymap presence

Changes

File Description
lsp-mode.el New functions (lsp-inlay-hint-accept, lsp--inlay-hint-resolve, lsp--inlay-hint-mouse-handler, lsp--inlay-hint-label-part-string, lsp--inlay-hint-tooltip-text), capability registration,
client capability advertisement, keymap, keybinding (s-l a i)
lsp-protocol.el Add InlayHintOptions type; extend InlayHint with :textEdits :tooltip :data; add InlayHintLabelPart with :tooltip :location :command
test/lsp-mock-server-test.el 3 new ERT tests for inlay hint data, label parts, and keymap
test/mock-lsp-server.el Enable resolveProvider in mock server capabilities
CHANGELOG.org Feature entry under Unreleased 9.0.1

Test plan

  • 3 new ERT tests pass (lsp-mock-server-inlay-hint-stores-data, lsp-mock-server-inlay-hint-label-parts, lsp-mock-server-inlay-hint-has-keymap)
  • Byte-compilation clean (only pre-existing docstring width warning at line 2277)
  • Manual: enable lsp-inlay-hints-mode, verify hints render with tooltips
  • Manual: click inlay hint label part with location → navigates to definition
  • Manual: invoke lsp-inlay-hint-accept on hint with textEdits → edits applied
  • Manual: invoke lsp-inlay-hint-accept on hint without textEdits → resolves via inlayHint/resolve
CleanShot 2026-02-15 at 00 42 58@2x

…solve

- Implement InlayHint features: textEdits, tooltip, data, label parts
- Add per-part tooltip/location/command, inlayHint/resolve, mouse handler
- Introduce lsp-inlay-hint-accept command for interactive hint acceptance
- Update protocol definitions and server mock for new capabilities
- Enhance tests for overlay data, label parts, and mouse keymap interaction
@takeokunn takeokunn marked this pull request as ready for review February 14, 2026 16:03
Copy link
Copy Markdown
Member

@jcs090218 jcs090218 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants