Skip to content

API for showing additional info in a hover #195394

@mjbvz

Description

@mjbvz

Problem

For TS, one of our most popular feature requests is showing expanded type information in hovers. For example, with the code:

type FooType = string | number

const foo: FooType = 1

Hovering over foo today shows FooType. While this is sometimes what you want, other times you'd like to see the type expanded to string | number instead

While 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:

  • A keyboard shortcut that expands the currently showing hover hover when pressed
  • A button in the hover the lets you toggle between different levels of detail

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

Metadata

Metadata

Labels

editor-apiIssues about the API of vscode in the area of editorseditor-hoverEditor mouse hoverfeature-requestRequest for new features or functionalityon-testplan

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions