IntelliJ IDEA 2017.1 Help

Spellchecking

Basics

IntelliJ IDEA helps you make sure that all your source code, including textual strings, comments, and literals, and commit messages, is spelt correctly. For this purpose, IntelliJ IDEA suggests a dedicated Typo inspection, which is supported by the corresponding bundled plugin and is enabled by default.

Correctness of spelling is checked against pre-defined dictionaries (as of now, jetbrains.dic and english.dic), and any number of user-defined custom dictionaries.

A user dictionary is a textual file with the dic extension, containing the words you want to be accepted by the Typo inspection as correct. The words in such dictionaries are delimited with the newline.

Besides that, you can define your own list of words that will be skipped by the inspection. You can add words to this list "on-the-fly", or intentionally while setting up your spellchecker options.

With the Typo inspection enabled, IntelliJ IDEA detects and highlights words not included in dictionaries and user's words list. It up to the user to provide correct spelling, accept word as is, or disable inspection.

If a word is accepted, it will be added to the user's words list, and skipped by the spellchecker in future. If inspection is disabled, all typos will be ignored.

In the textual strings and comments, spelling of a word at caret can be changed to a correct one. In the contexts that enable Rename refactoring, the inspection suggests to rename all occurrences of a symbol.

Checking the spelling of a word

Place the caret on a word highlighted by the Typo inspection.

Press Alt+Enter to show the available intention actions.

Choose one of the following actions:

Change to: select the desired spelling of a textual string or comment from the suggestion list.

Save to dictionary: add word to the user's list and skip it in future.

Configuring the dictionaries to use

Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for macOS, and click Spelling under Editor.

Define the set of dictionaries to be used for spellchecking.

Switch to the Dictionaries tab.

The Dictionaries area in the bottom of the page shows a list of the dictionaries that can be used in spellchecking. The list contains the dictionaries that come bundled with IntelliJ IDEA by default and user-defined dictionaries detected in the folders from the Custom Dictionaries Folder area above.

To have a default dictionary applied in the current project, select the check box next to it.

To exclude a default dictionary from spellchecking within the scope of the current project, clear the check box next to it.

In the Custom Dictionaries Folder area, configure your custom dictionaries to use. This area displays a list of directories that contain user-defined dictionary files (text files with the dic extension, containing words separated with a newline).

To add a new folder to the list, click and choose the required folder in the Select Path Dialog dialog that opens .

The full path to the folder is added to the Custom Dictionaries Folder list, and all the *.dic files found in this folder are added to the Dictionaries list.

To remove a folder from the list, select it and click .

Besides configuring a custom dictionary, you can create your own Word List with the words that you want to be skipped during spell checking without being included in a custom dictionary.

Switch to the Accepted Words tab.

Create a Word List:

Click the icon to open the Add New Word dialog box and specify a new entry there. CamelCase or snake_case are not supported. If you try to add a word that is already included in one of the spelling dictionaries, IntelliJ IDEA displays an error message The word <just typed word> is already in the dictionary.

To remove an item from the list, select it and click .

Configuring spellchecking options

Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for macOS, and click Inspections under Editor.

On the Inspections page, that opens showing a list of inspection types, expand the Spelling node and click Typo in the central pane.

In the right-hand pane, configure the Typo inspection:

In the Options area, define the type of contents to be inspected by selecting or clearing the Process Code, Process Literals, and Process Comments check boxes.