-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API for showing additional info in a hover #195394
Comments
Hi @jakebailey @mjbvz, we have discussed this issue in the team and I see three possible ways to implement this: (1) We can propose a new API (2) Instead we could change the class (3. a) Another idea that was discussed by our team is the following. We could allow extension authors to return hover markdown information with custom URI links. On click of this custom link, we would do a request to the hover provider through a proposed API
This idea would require us to introduce a new proposed API (3.b) We have also discussed another variant of 3.a. The flow is as follows:
In the case of TypeScript, the link will point to the definition of Please let us know what approach you think is more appropriate and what would suit better the needs of the TypeScript team. Thank you. |
Thanks @aiday-mar! Either 1 or 2 sound fairly easy and I think would address the original request I personally prefer approach 1 where we pass a boolean or enum to However if we go with approach 1, we'd also likely want a way to figure out a way for providers to tell us if they can provide extended info or not. That way we can show an @RyanCavanaugh @DanielRosenwasser What do you think about these proposals? Approach 3 is interesting and something that we've talked about before for improving our diagnostics UX. I especially like that it could let us support One nice feature of approach 1 or 2 is that we could implement 3 on top of them later too |
With (2). couldn't |
To discuss (raw notes): proposal 4: the hover provider returns an URI which is then interpreted as a text document and rendered in the hover. This allows us to invoke the DocumentLinkProvider on that document. proposal 5: the hover provider returns another field (annotations) which references offsets into the markdown content. Via annotations we could link to locations (similar to proposal 3b). It could be another field in the Hover or it could be MarkdownStringWithAnnotations. |
I have discussed the proposals in #195394 (comment) with @alexdima. Conclusions from the discussion are as follows:
2 more proposals have been made in the comment #195394 (comment) above. I have scheduled a meeting to discuss this work further. |
Why is this a concern? Why would anyone put completely different info into a hover tooltip? That seems like it would not be productive for any API consumer (and one could totally "misuse" any other feature for other uses already?). |
Indeed that would not be productive for any API consumer. The idea is to limit this possibility of this happening. I will bring up this thread in our meeting and let you know of the discussion later. |
Hey all. We have discussed all of the proposals in a meeting, and decided to move forward with proposal 1, since it seems to be what best suits the needs of the TypeScript team. We will put proposal 5 on the backlog, and potentially implement it in the future too, since proposal 1 can co-exist with proposal 5. To give more detail about the implementation, extensions will be able to return a hover with additional fields |
Related?: #64566, #94679, microsoft/TypeScript#35601 |
Any progress, or projection when we can expect to have it released? |
Hi @clcoco so this PR will likely be part of VS Code 1.89, but not 1.88 |
Fixed with #210472 |
In the last UX sync, @gabritto who is currently working on adopting the expandable hover for TypeScript, mentioned the TypeScript team would like to add links in the hover which when clicked would expand the specific type. There are several reasons for this:
The hover is a nice way to display the types because it is easily discoverable and can be used to easily expand and contract type information. In the UX sync certain other ideas have been proposed for how to display the type information:
We should discuss this other language extensions authors and collect more feedback to see if/how much they would find it useful to have expandable links in the hover. |
Problem
For TS, one of our most popular feature requests is showing expanded type information in hovers. For example, with the code:
Hovering over
foo
today showsFooType
. While this is sometimes what you want, other times you'd like to see the type expanded tostring | number
insteadWhile we could add a global setting for expanding types in hovers, this isn't a great solution as sometimes the expanded type is very confusing. Really we want to provide both the simplified and expanded hover info and make it easy to switch between them
Feature Request
Add new UI and apis that users to request a more detailed version of a hover. The user action for this could be:
We believe that other languages besides typescript could use this functionality as well. @jakebailey brought up Python for example but C++, c#, and any other languages with complex types could likely benefit
The text was updated successfully, but these errors were encountered: