ReSharper 2024.1 Help

Grammar analysis

Grammar rules

ReSharper checks grammar against a set of rules defined for a language. For example, in English, there are rules on how to properly use articles, commas, and past tense forms, stylistic hints for creative and plain writing, common typos and words that are commonly confused, proper collocations, and many more.

Most of these rules are enabled by default and detect definite mistakes. However, some of them are suggestions that you may not agree with or not care about. In this case, you can disable a specific rule from the Alt+Enter menu or in the settings.

Configure the set of rules

  1. Select ReSharper | Options from the main menu or press Alt+R O, then choose Tools | Grammar and Spelling | Grammar on the left.

  2. On the Rules tab, expand the language node and select the rules against which you want to check your text.

Use the search field to filter the list of rules with a keyword, such as article or comma.

Exceptions

Exceptions are words and phrases that you want to be always considered correct. If some rule triggers a mistake in a phrase that you do not want to highlight, you do not need to disable this rule, because then it will not be triggered in other places where the rule is valid. In this case, you can add the phrase as an exception using the Alt+Enter menu.

Review all added exceptions

  1. Select ReSharper | Options from the main menu or press Alt+R O, then choose Tools | Grammar and Spelling | Grammar on the left.

  2. On the Exceptions tab, you can see the list of words and phrases added as exceptions. Remove an exception by selecting it and clicking Remove.

Configure grammar inspections

By default, grammar inspections are enabled for almost all contexts. You can enable/disable individual inspections and change their severity levels by searching for grammar on the Code Inspection | Inspection Severity page of ReSharper options .

If you have methods that are supposed to receive raw text with grammar errors, you can mark the corresponding parameters with the [IgnoreSpellingAndGrammarErrors] from JetBrains.Annotations. This will disable warnings for callers of the method.

public class Sample { void Out([IgnoreSpellingAndGrammarErrors] string str) { Console.WriteLine(str); } void Test() { // no warnings Out("wiht erorrs speld texxt"); } }

You can disable grammar and spelling analysis by clearing the Grammar and Spelling checkbox on the Environment | Products & Features page of ReSharper options .

Last modified: 11 February 2024