On this page:
- Checking the spelling of a word
- Configuring the dictionaries to use
- Configuring spellchecking options
CLion helps you make sure that all your source code, including textual strings, comments, and literals, and commit messages, is spelt correctly. For this purpose, CLion 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,
english.dic), and any number of
user-defined custom dictionaries.
A user dictionary is a textual file with the
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, CLion 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:
Configuring the dictionaries to use
- Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or 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 CLion by default and user-defined dictionaries detected in the folders from the Custom Dictionaries Folder area above.
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
dicextension, 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 .
- 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, CLion 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 for Windows and Linux or 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.
- In the Severity area, choose the inspection severity level and the scope to apply this level in.