question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Have hover tooltips show instantiated / computed types when selection is multiple characters

See original GitHub issue

Suggestion

🔍 Search Terms

intellisense hover type debugging selection

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

⭐ Suggestion

Under the following conditions:

  • An area of code is selected (>=1 characters)
  • The selection is a single node in the AST, ignoring whitespace
  • The user has triggered a hover within that selection

…can the language service report the computed type of the selected node, either instead of or in addition to the normal hover info?

📃 Motivating Example

I don’t know of a way to get language services to show what MyA<OtherType> computes to in this Playground example with nested type generics.

The next best strategy is to make intermediate types and/or variables to debug though. It’s kind of a pain.

💻 Use Cases

This Tweet inspired by looking at @markerikson’s talk about complex Redux-area types being annoying to debug through 😄. https://twitter.com/JoshuaKGoldberg/status/1520079650055204866

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:10
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
itamarkcommented, Apr 29, 2022

I’m some person on the internet and I third this idea.

5reactions
markeriksoncommented, Apr 29, 2022

I’m Mark Erikson, and I approve and second this idea 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltip with shortened characters in divs - Stack Overflow
Test to see if the characters in a div are more then ten chars long · Shorten the text to less than ten...
Read more >
Hover over a cell and have a pop up that shows what was ...
I am creating a manpower schedule that is pulling information from multiple tabs within the excel file. The first tab has employee ...
Read more >
Option to expand computed TypeScript types on hover #94679
The impl of actual utils I'm using are inconsequential; it's the same if we'd used Pick , Omit , or Partial . It'd...
Read more >
Tooltips in the time of WCAG 2.1 | Sarah Higley
Focus and hover ... The first step is to ensure that the visual display can be controlled by either a keyboard or a...
Read more >
Tooltips - Material Design
Tooltips display informative text when users hover over, focus on, ... Paired. Tooltips are always paired nearby the element with which they are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found