feat: add Phase 2 hover provider + Phase 1.5 robustness - #241
Merged
Conversation
Phase 2 — tree-sitter-backed HoverProvider: Message::Hover { uri, line, column } -> HoverResponse { signature, documentation, range }. UTF-16 to UTF-8 column reconciliation for hover positions (renderer Position.column is UTF-16 code units; tree-sitter Point.column is a UTF-8 byte offset). Signature via source-slice of the declaration header (keeps async/generics/params/return-type verbatim); JSDoc collected from leading /** comment siblings. Name-token gate (hover fires only on the identifier, not the body); variable_declarator/public_field_definition require a type annotation. CodermHoverProvider registered for the configured languages; renderer wraps signature in a typescript MarkdownString and renders JSDoc as a second markdown string.
Phase 1.5 — robustness: reject all pending requests on MessagePort close (no 30s timeout wait); onDidChangeLanguage re-sync (document/open re-sent with the new languageId).
Fix: SymbolKind off-by-one — documentSymbol kind values now match VS Code's SymbolKind enum (Class=4, Method=5, Enum=9, Interface=10, Function=11, TypeParameter=25), not LSP's off-by-one numbers, so outline icons render correctly.
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of the native (Rust) Language Host: tree-sitter-backed hover provider (function/method/class/interface/type/typed-variable signatures + JSDoc), plus Phase 1.5 robustness, plus a SymbolKind off-by-one fix for the Phase 1 documentSymbol icons.
Phase 2 — Hover
Message::Hover { uri, line, column }→HoverResponse { signature, documentation, range }Position.columnis UTF-16 code units; tree-sitterPoint.columnis a UTF-8 byte offset). Phase 1 symbol/fold stay byte-column + 1 with the retained TODO./**comment siblings.variable_declarator/public_field_definitionrequire a type annotation.CodermHoverProviderregistered for the configured languages; renderer wrapssignaturein a```typescriptMarkdownString and renders JSDoc as a second markdown string.Phase 1.5 — Robustness
MessagePortclose (no 30s timeout wait).onDidChangeLanguagere-sync:document/openre-sent with the newlanguageId.Fix
kindvalues now match VS Code'sSymbolKindenum (Class=4, Method=5, Enum=9, Interface=10, Function=11, TypeParameter=25), not LSP's off-by-one numbers. Outline icons now render correctly.How to verify
Verified end-to-end via Playwright CDP (hover signature + JSDoc render, source-slice keeps generics).