microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.17k stars 12.51k forks source link

Disable inlay hints for tests (or allow conditional overrides) #45785

Open TrueWill opened 3 years ago

TrueWill commented 3 years ago

Suggestion

Originally opened at https://github.com/microsoft/vscode/issues/132304 - they asked me to file upstream.

🔍 Search Terms

inlay hints

✅ Viability Checklist

My suggestion meets these guidelines:

⭐ Suggestion

I ❤️ the new inlay hints feature. One area where it's a bit noisy is in tests, though. Even with the literals setting, it shows up for Jest (and similar) test blocks (describe, it, test). Please consider adding a way to override this for certain cases. Thank you!

image

📃 Motivating Example

As a developer, I want to maximize readability while minimizing noise.

💻 Use Cases

Kingwl commented 3 years ago

https://github.com/microsoft/vscode/issues/128162 is a feature that allows you peek inlay hints after pressed some button.

andrewbranch commented 3 years ago

/cc @DanielRosenwasser, was trying to find something to link this feedback to as we think about fine tuning the inlay hints experience, but couldn’t find a parent issue

MartinJohns commented 3 years ago

Related: #45389

nmain commented 3 years ago

Would it make sense to override this in the function declaration on a per-parameter basis?

function describe(/* @ts-no-inlay */ name: string, /* @ts-no-inlay */ callback: () => (void | Promise<void>)) { ... }
MartinJohns commented 3 years ago

@nmain Then it wouldn't be the users choice anymore (in case of libraries).