ReSharper 2024.3 Help

Grammar and spelling analysis

One important task of code inspection is the analysis of grammar and spelling in natural languages. ReSharper will look for spelling and grammar errors in identifiers, comments, and string literals. When it detects a potential error or a typo, it will let you know in the same way as for other code issues — in design time or when you run code inspection in specific scope.

In this section:

Configure languages

By default, ReSharper checks spelling and grammar using the 'English (USA)' dictionary, but you can install dictionaries for other languages.

Install spelling and grammar dictionary

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

  2. Click Add.

  3. In the dialog that opens, select one or more languages and click Install.

  4. The selected dictionaries will be downloaded and installed.

  5. Click Save in the Options dialog to apply the modifications and let ReSharper choose where to save them, or save the modifications to a specific settings layer by choosing this layer from the Save To selector. For more information, see manage and share resharper settings.

Configure spelling and grammar inspections

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

If you have methods that are supposed to receive raw text with spelling and 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 Alt+R, O.

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 in C#

Feature is available in Visual Basic

Feature is available in C++

Feature is available in HTML

Feature is available in ASP.NET

Feature is available in Razor

Feature is available in JavaScript

Feature is available in TypeScript

Feature is not available in CSS

Feature is available in XML

Feature is available in XAML

Feature is available in Resource files

Feature is not available in build script files

Feature is not available in Protobuf

Feature is available in JSON

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the Languages and frameworks section.

Last modified: 31 August 2024