-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
Suggestion
π Search Terms
inlay hints function callback
β Viability Checklist
My suggestion meets these guidelines:
- [x 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
Currently, inlay hints for parameter names only allow the selection of all, literals or none.

I suggest adding another option for anonymous functions and turning the dropdown into a select list.
π Motivating Example
literals is a good middle ground between none and all which tends to be very noisy.
However, if a method accepts multiple callback functions, it becomes hard to distinguish them:

The same snippet with option all looks like this:

Now the function-type parameters can be distinguished (green), but the inlay hints marked in red (and everywhere else) are unnecessary. Having the option to enable parameter inlay hints for literals and anonymous functions would be better and less noisy.
π» Use Cases
Fine-grained selection of inlay hints