Skip to content

Improve inlay hint suppression options #8862

@envoidia

Description

@envoidia

Is your feature request related to a problem? Please describe.

I find inlay hints extremely useful, but when enabled, they show up everywhere, and the options to suppress them when they're not necessary are very lacking

Describe the solution you would like

dotnet.inlayHints.suppressInlayHintsForParametersThatMatchArgumentName should (or have an option to) ignore case and punctuation:

void fn(int fooBar) { }

// Hidden:
fn(fooBar);

// Not hidden:
fn(/*fooBar: */_fooBar);
fn(/*fooBar: */FooBar);
fn(/*fooBar: */FOO_BAR);

dotnet.inlayHints.suppressInlayHintsForParametersThatDifferOnlyBySuffix doesn't seem to work at all:

fn(/*fooBar: */fooBar_);

void fn2(int fooBar_) { }

fn2(/*fooBar_: */fooBar);

There should be an option to hide inlay hints for parameters ending with a member access that matches argument name:

Vector2 bar = new(/*x: */foo.X, /*y: */foo.Y);

There should be an option to hide inlay hints for collection indexer parameters:

someArr[/*index: */i];

And there should be an option to hide locally apparent type hints for target-typed new and collection expressions:

// Caused by `csharp.inlayHints.enableInlayHintsForImplicitObjectCreation`:
Vector2 foo = new/*Vector2*/(1, 2);

// Caused by `csharp.inlayHints.enableInlayHintsForTypes`:
int[] bar = /*int[]*/[1, 2, 3];

These options would reduce the clutter of unneeded hints while keeping hints for more ambiguous cases

Applicable Scenarios

When someone is using inlay hints for parameters, implicit object creation, and types

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions