microsoft / microsoft/language-server-protocol

Support for multiple hover targets under the cursor

Open
#1,920 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request hover
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

In Swift, a type can also be used as as an initializer (constructor) and the hover for Xcode returns both the type documentation and the documentation for the initializer.

let _ = URL(string: "http://example.com")
         ^
       request hover from cursor here

How these appear in Xcode are shown below.

Type hover doc

image

Initializer hover doc

image

Would it make sense for LSP to also support an array of Hover items as a response to the Hover request?

Also in the screenshots I shared, once the hover is presented, it's possible to switch between declarations shown at the top, so the top part acts somewhat like a "table of contents" of sorts for the resolved declarations. If multiple hover items are to be supported, it would be useful to have a field in Hover response for the resolved declaration, possibly of type MarkedString or MarkupContent.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Hover request and response definitions in the language-server protocol and the design questions raised in this issue. Done would require an agreed representation for multiple hover targets and resolved declarations, along with corresponding protocol documentation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.