ReSharper 2018.3 Help

Inline Parameter Name Hints

As an alternative to writing named arguments in method calls, you can make use of ReSharper's parameter name hints — editor adornments that show parameter names next to the corresponding arguments at method calls.

Why use parameter name hints?

Consider the following method call:

AddCheckbox(true, true, "AutoFill", null);

When you read this code, you have to stop and study the method signature to understand what happens here. (you can do it either with the parameter information tooltip or by navigating to method declaration). With parameter name hints, the same call becomes much clearer:

ReSharper: inline parameter name hints help understanding arguments in a method call

The idea of the parameter name hints is to automatically show parameter names for arguments whose intention may not be clear, but at the same time not to clutter the editor with hints where the argument purpose is obvious, and of course if there are named arguments in the call. To achieve this, ReSharper applies a number of configurable heuristics.

Configuring parameter name hints

You can toggle and configure parameter name hints on the Environment | Editor | Parameter Name Hints page of ReSharper options. Use Show parameter name hints to toggle the hints, and then optionally use other controls to specify where the hints should be hidden:

Hide for non-literals

Hides parameter name hints for arguments that are variables, resources, or expressions, allowing you to configure some exceptions.

Hide for builder-like methods

Hide parameter name hints for methods similar to methods of System.Text.StringBuilder, which return a modified object of their containing class. Names of such methods normally make clear the purpose of their parameters.

Hide if method parameters only differ by numbered suffix

Hides parameter name hints when calling methods with signatures similar to

void DoSomething(int arg0, int arg1, int arg2, int arg3) {/*...*/}

Hide if intention of first parameter is clear from method name

Hides parameter name hint on the first argument when calling methods with signatures similar to

void SetExtension(string extension, object next) {/*...*/}

Hide if intention of argument is clear from usage

For methods with signatures similar to

void DoSomething(int value, object context) {/*...*/}
hides the value parameter name hint if the method is called like so
DoSomething(myValue, context: null);

You can configure lists of method patterns for which the parameter name hints will be always hidden, independently of other preferences.
These lists work independently for different languages.

Patterns are matched against fully qualified method name, parameter count, and parameter names. For example:

  • System.Math.* matches all methods whose FQN starts with System.Math

  • System.Math.*(*, *) matches all methods from System.Math namespace with two parameters

  • (*info) matches all single-parameter methods where the parameter name ends with info

  • (key, value) matches all methods with parameters key and value

  • Put(key, value) matches all Put methods with key and value

When your caret is at a method call showing parameter name hints, you can press Alt+Enter, choose Configure Parameter Name Hints, or instead, right-click a parameter hint, and then pick one of the commands, which allow you to:

  • hide hints for all calls of this method (if you want to show hints for this method in the future, you can find the corresponding exception pattern in the options page and remove it),

  • disable the hints (you can enable them later in the options page),

  • or open the options page for detailed configuration.

ReSharper: configuring parameter name hints from the Alt+Enter menu

You can also toggle parameter name hints in the current solution from the context menu of the status indicator:

ReSharper; switching parameter name hints from the status indicator

You can configure the color of parameter name hints in Visual Studio options — go to Tools | Options | Environment | Fonts and Colors and find the ReSharper Parameter Name Hints in the list of display items.

Applicability in different languages

This feature is supported in the following languages and technologies:

Language: C#

Language: VB.NET

Language: C++

Language: HTML

Language: ASP.NET

Language: Razor

Language: JavaScript

Language: TypeScript

Language: CSS

Language: XML

Language: XAML

Language: Resx

Language: Build Scripts

Language: Protobuf

Language: JSON

Feature is available

Feature is available

Feature is available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

Feature is not available

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.

Last modified: 25 April 2019

See Also