Repository: TypeScript
Issue: Proposal: Inlay Hints with minimal parameters count
Labels: Suggestion,In Discussion,Domain: Inlay Hints

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

<!--
  💡 Did you know? TypeScript has over 2,000 open suggestions!
  🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
  The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests

  Replace the text below:
-->

Inlay Hints, LSP, VS Code integration

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).

## 📃 Motivating Example

From https://github.com/microsoft/vscode/issues/147875

With `javascript.inlayHints.parameterNames.enabled: 'all'`, we got

```ts
parseInt(/* str: */ '123', /* radix: */ 8)
```

While in many cases, we only use one parameter when calling a function, for example

```ts
parseInt(/* str: */ '123')
```
```ts
console.log(/* message: */ foo)
```
```ts
// Vue's Composition API
const state = ref(/* value: */ 1)
```
```ts
array
  .filter(/* predicate: */ Boolean)
  .map(/* callbackFn: */ i => i.value)
```

In those cases, the contexts are less ambitious and the inlay hints become a bit redundant and even verbose.


## ⭐ Suggestion

Thus I am proposing to introduce a new setting to configure the minimal parameters count required for the inlay hints to enable in each function call.

Able to have this setting fields in VS Code:

```ts
"typescript.inlayHints.parameterNames.minCount": 2 /* default: 0 */
```

To hide the inlay hints when calling functions with a single argument.

Thus we could expose an additional preference entry for 

```ts
interface InlayHintsOptions extends UserPreferences {
  includeInlayParameterNameHintsMinCount: 2
}
```

I had the implementation ready at https://github.com/antfu/TypeScript/commit/395477592183cf555ab5cea6b0eaa041ae2a757b . Could send a PR if the team agrees on this change.

## 💻 Use Cases

To provide a cleaner code reading experience for common functions while having the ability to have inlay hints for complex functions.

<!--
  What do you want to use this for?
  What shortcomings exist with current approaches?
  What workarounds are you using in the meantime?
-->