ReSharper 2024.3 Help

C# Other Hints

ReSharper options: Environment | Inlay Hints | C# | Other

Use this settings page to configure other kinds of inlay hints in C#.

Code annotations for parameter declarations

This kind of hints shows JetBrains code annotation attributes used in base classes on overriding and implementing members:

ReSharper: Inlay hints. code annotations

Use the Visibility selector to choose how inlay hints for code annotation should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Missing constructs

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:

ReSharper Inlay hints: missing return

Use the Visibility selector to choose how inlay hints for missing constructs should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

[MustDisposeResource] annotations

If you are using the [MustDisposeResourceAttribute] from JetBrains.Annotations to enforce resource disposal in the calling code, ReSharper helps you visually identify constructors and factory methods that return a disposable resource:

ReSharper Inlay hints: MustDisposeResourceAttribute

Use the Visibility selector to choose how inlay hints for [MustDisposeResource] annotations should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Implicit dispose points

You can use inlay hints to see places where resource variables are disposed:

ReSharper Inlay hints: disposed resource variable

Use the Visibility selector to choose how inlay hints for implicit dispose points should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Tuple component names

You can see tuple component names as inlay hints when those names are not apparent from the component expression:

ReSharper: Inlay hints for tuple component names

Use the Visibility selector to choose how inlay hints for tuple components should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Deconstruction pattern component names

Inlay hints can greatly improve the readability of a deconstruction pattern by showing the declared names of its components:

ReSharper: Inlay hints for deconstruction pattern component names

Use the Visibility selector to choose how inlay hints for deconstruction pattern components should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Discard type names

When a method returns more variables than needed, and some are discarded with _, inlay hints can help you see what is discarded. By default, hints for discards work with push-to-hint:

ReSharper: Inlay hints for discard names

Use the Visibility selector to choose how inlay hints for deconstruction pattern components should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Descriptions for warnings disabled or restored with #pragma directives

#pragma warning directives allow you to disable and restore specific warnings by their ID. It is hard to remember what each ID means, therefore ReSharper can add inlay hints with warning descriptions. Note that this kind of hints only work with compiler warnings, whose IDs start with CS.

ReSharper: Inlay hints for '#pragma warning' directives

Use the Visibility selector to choose how inlay hints for #pragma directives should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Implicit 'return' or 'continue' before local functions at the end of a block

Having local functions at the end of a code block is a common practice, but when reading such blocks, you often need to scroll past local function definitions to make sure there is no executable code after them.

To improve readability in such cases, ReSharper offers inline hints that either visualize the implicit control flow markers such as return; and continue, or just show //Local Functions if there is no more executable code in the block.

ReSharper: Inlay hints for trailing local functions

Use the Visibility selector to choose how inlay hints before trailing local functions should be displayed in the editor: choose Default to apply the general visibility preference from the Environment | Inlay Hints | General page of ReSharper options , choose Show Always or Never Show to always show or hide hints, or choose Push-to-Hint to hide the hints by default but show them when you press and hold Ctrl.

Show a comment before long local functions at the end of a not-terminating nested scope

This checkbox lets you choose whether to show inlay hints for trailing local functions in code blocks that do not break the control flow, such as if statements:

ReSharper: Inlay hints for trailing local functions in an 'if' block

Minimum total number of lines in local functions to show a comment before them

Use this selector to configure whether to display hints before smaller trailing local functions.

Last modified: 11 February 2024