Inlay hints
Inlay hints are configurable editor adornments that improve readability of your code.
Push-to-Hint mode
Inlay hints can be helpful, but on the other hand they take editor space and may seem redundant in some cases.
Therefore you can use the Push-to-Hint mode (which is enabled by default). It lets you keep the hints hidden, and only view them when needed by pressing and holding the Ctrl key. In this mode, you can also press Ctrl twice to toggle the hints in the current editor tab.
If you want inlay hints to be always shown or hidden, you can choose it with the Default visibility selector on the page of ReSharper options (Alt+R, O). Whatever you choose for the default visibility, you can override it for specific kind of hints on the corresponding settings pages under .
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.
Consider the following method call:
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:
The idea of the parameter name hints is to 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.
Type name hints
Type name hints help you understand types variables and expressions have in different contexts. For example:
anonymous types,
parameters of lambda expressions,
return types of methods in a call chain,
and in many other cases.
If necessary, you can configure type name hints for each specific case.
Type conversion hints
Type conversion hints show implicit type conversions in your code.
In the example below, converting from Vector3D
to Vector2D
silently loses data (the Z
value) and the hint helps us see where this happens.
Code analysis hints
You can display missing returns in functions and missing breaks in switch statements using inlay hints. This lets you immediately understand what exactly is missing:
You can use inlay hints to see places where resource variables are disposed:
To configure visibility of these hints, use the corresponding selectors on the Alt+R, O).
page of ReSharper options (Configure inlay hints
You can toggle and configure inlay hints on the corresponding settings pages under the Alt+R, O).
page of ReSharper options (If you do not use inlay hints, you can disable them by clearing the Enable Inlay Hints checkbox on the settings page. ReSharper will stop calculating hints thus saving some resources.
However, if you want to see only a few specific kinds of hints, you can set the Default visibility selector on that page to Never Show and then override this with visibility selectors for the desired types of hints.
For parameter name hints, you can additionally hide hints in methods matching specific patterns. To do so, add these patterns at the bottom of the page of ReSharper options (Alt+R, O).
Here are some examples of patterns:
System.Math.*
matches all methods whose FQN starts withSystem.Math
System.Math.*(*, *)
matches all methods fromSystem.Math
namespace with two parameters(*info)
matches all single-parameter methods where the parameter name ends withinfo
(key, value)
matches all methods with parameterskey
andvalue
Put(key, value)
matches allPut
methods with parameterskey
andvalue
When your caret is at a code item that has an inlay hint, you can press Alt+Enter, choose Configure Inlay Name Hints, or instead, right-click a parameter hint, and then pick one of the commands, which allow you to:
hide parameter hints for all calls of the method, or type name hints that apply for the current item (if you want to show hints that you disabled, you can find the corresponding item or exception pattern in the options page and remove it),
disable inlay hints altogether (you can enable them later in the options page),
or open the options page for detailed configuration.
You can also toggle parameter name hints in the current solution with the Control+Alt+Shift+5 shortcut or from the context menu of the status indicator:
You can configure the color and font size of inlay hints — the font size can be set on the Alt+R, O), the font color — in Visual Studio options: go to and find the ReSharper Inlay Hint in the list of display items.
page of ReSharper options (Applicability in different languages
This feature is supported in the following languages and technologies:
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.