Skip to content

Inlay Hints for parameter names: Add anonymous functions as a selectable optionΒ #49537

@AlCalzone

Description

@AlCalzone

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.
image

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

The same snippet with option all looks like this:
image
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions