ReSharper 2024.2 Help

Spellchecking

ReSharper looks for spelling 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 other code issues — in design time or when you run code inspection in specific scope.

When ReSharper detects and highlights spelling problems in design time, you can press Alt+Enter and choose one of suggested fixes.

ReSharper: Detecting and fixing typos

If you use a quick-fix to fix a typo in an identifier, the Rename refactoring will be invoked automatically to ensure consistency of the change across your code base.

If the reported word is valid in your context, pick Add to user dictionary in the Alt+Enter menu to stop reporting this word.

Spellchecking is enabled by default, but you can disable it by clearing the corresponding checkbox on the Tools | Grammar and Spelling | General page of ReSharper options Alt+R, O.

Spelling dictionaries

ReSharper comes with a built-in spelling dictionary for English (United States), but it allows you to install and use Hunspell /MySpell dictionaries for other languages. A lot of dictionaries can be found on https://github.com/wooorm/dictionaries.

Install custom dictionaries

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

  2. Add the desired Hunspell/MySpell dictionaries — click Add and pick a Hunspell dictionary file .dic. Note that you also need to have the affix file of the dictionary (named the same as the dictionary file but with the .aff extension) next to the dictionary file.

  3. 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.

When you install a custom dictionary, ReSharper saves a full path to the dictionary file in settings.

If you share your solution via VCS, you can share custom dictionaries by putting dictionary files in the VCS directory and making the paths in the settings file relative.

Share custom dictionaries

  1. Put the desired dictionary files in your solution directory. For example, you can create a Dictionaries subdirectory in the solution root and put the files there.

  2. Add the dictionaries in settings as described above, make sure to save changes in the 'Solution team-shared' settings layer.

  3. In the solution root folder, find and open the team-shared settings file <SolutionName>.sln.DotSettings.

  4. In the settings file, find all entries that define dictionaries — they start with <s:Boolean x:Key="/Default/InstalledDictionaries — and specify relative paths for them.

    For example, if you put German dictionary files German.dic and German.aff in the Dictionaries subdirectory in the solution root, then the entry for the dictionary will look as follows in the settings file:

    <s:Boolean x:Key="/Default/InstalledDictionaries/InstalledDictionaries/=Dictionaries_005CGerman_002Edic/@EntryIndexedValue">True</s:Boolean>

    The path format in settings uses the following symbol substitutions:

    • _003A for :

    • _005C for \

    • _002E for .

  5. Make sure that <SolutionName>.sln.DotSettings file and all dictionary files are committed to your VCS.

You can extend the installed dictionaries with other words, which will be stored using the settings layers together with other preferences. There are two ways to add user words:

  • When your caret is on a highlighted spelling issue in the editor, choose Add to user dictionary from the Alt+Enter menu. The word will be saved using the smart save logic, but you can also expand the submenu to choose a specific settings layer:

    ReSharper: adding user words for spell checking
  • On the Tools | Grammar and Spelling | Spelling page of ReSharper options Alt+R, O, use the Exceptions area to configure a newline-separated list of words to be ignored by the spell-checker.

Configure spelling inspections

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

If you have methods that are supposed to receive raw text with spelling 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: 25 September 2024