CLion 2024.1 Help

Spellchecking

CLion looks for spelling errors in identifier names, string literals, comments, markdown files, and commit messages. For this purpose, CLion provides a dedicated Typo inspection which is enabled by default.

Fix a misspelled word

  1. Place the caret at a word highlighted by the Typo inspection.

  2. Press Alt+Enter or click the yellow bulb icon to the left of the caret to show the available actions.

  3. Select one of the suggested ways to fix the spelling.

    Correcting a typo

In string literals and comments, only the spelling of this particular word at caret changes. For code identifiers, such as variables, functions, classes, and other symbols, the inspection also suggests changing all occurrences via the Rename refactoring.

Save a word to dictionary

If a detected typo is actually a valid word, you can add it to a user-defined dictionary that extends built-in dictionaries.

  1. Place the caret at a word highlighted by the Typo inspection.

  2. Press Alt+Enter or click the yellow bulb icon to the left of the caret to show the available actions.

  3. Select Save to dictionary to add the word to the user's dictionary and do not report it in the future.

    Accept a misspelled word

    If you have added the word by mistake, press Ctrl+Z to remove it from the dictionary.

By default, CLion saves words to the global application-level dictionary. You can choose to save words to the project-level dictionary if the spelling is correct only for this particular project and/or should be shared with the team working on that project. For more information, refer to Select the default dictionary for saving words.

Find all spelling errors

You can run the Typo inspection on your entire project or a set of files.

  1. Press Ctrl+Alt+Shift+I or go to Code | Analyze Code | Run Inspection by Name in the main menu.

  2. In the Enter inspection name popup, find and select the Typo inspection.

  3. In the Run 'Typo' dialog, select the scope in which you want to run the inspection, and other options, such as a file mask filter. Then click OK.

CLion will run the Typo inspection on all files in the selected scope and show all found typos in a separate tab of the Problems tool window.

Configure the Typo inspection

By default, the Typo inspection checks code identifiers, string literals, and comments in all scopes.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Editor | Inspections.

  2. Expand the Proofreading node and click Typo in the central pane.

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

    The Typo inspection settings
    Severity

    Specify the severity level and the scope in which to apply this level.

    For example, if you want typos to stand out more, select Error or Warning to highlight typos similar to syntax errors or warnings in your code.

    Options

    Specify the type of content to check:

    • Process code: check code identifiers .

    • Process literals: check text inside string literals.

    • Process comments: check text inside comments.

Disable spellchecking

Disable the Typo inspection

  1. Press Ctrl+Alt+S to open the IDE settings and then select Editor | Inspections.

  2. Expand the Proofreading node.

  3. Clear the checkbox next to the Typo inspection.

    Disabling the spellcheck inspection

Disable spellchecking in commit messages

  1. Press Ctrl+Alt+S to open the IDE settings and then select Version Control | Commit.

  2. In the Commit Message Inspections, clear the Spelling checkbox.

    Disabling spellcheck in commits

Disable spellchecking for new projects

  1. Go to New Projects Setup | Settings for New Projects.

  2. Clear the checkboxes described above. This will affect the projects created or opened for the first time after you save the settings.

Dictionaries

CLion includes bundled dictionaries for all configured languages. You cannot change them directly, but you can extend the spellchecker in other ways:

  • Save words to a built-in global or project dictionary.

  • Add plain-text files with the .dic extension that contain lists of words.

  • Add Hunspell dictionaries, each of which consists of two files: the DIC file that contains a list of words with the applicable modification rules and the AFF file that lists prefixes and suffixes regulated by a specific modification rule. For example, en_GB.dic and en_GB.aff.

Configure spellchecker dictionaries

  1. Press Ctrl+Alt+S to open the IDE settings and then select Editor | Natural Languages | Spelling.

  2. Spelling settings

    Configure the list of custom dictionaries:

    • To add a new custom dictionary to the list, click the Add button or press Alt+Insert and specify the location of the required file.

    • To edit the contents of a custom dictionary in CLion, select it and click the Edit button or press Enter. The corresponding file will open in a new editor tab.

    • To remove a custom dictionary from the list, select it and click the Remove button or press Alt+Delete.

Select the default dictionary for saving words

By default, CLion saves words to the global application-level dictionary. You can choose to save words to the project-level dictionary if the spelling is correct only for this particular project and/or should be shared with the team working on that project.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Editor | Natural Languages | Spelling.

  2. If you want to choose the dictionary manually every time you save a highlighted word, clear the checkbox next to the Use single dictionary for saving words option.

  3. If you want to save highlighted words on the project level, leave the checkbox selected and choose project-level next to that option.

Add accepted words manually

  1. Press Ctrl+Alt+S to open the IDE settings and then select Editor | Natural Languages | Spelling.

  2. Add words to the Accepted words list. CLion always adds manually accepted words to the project-level dictionary.

    You can't add words that are already present in one of the dictionaries and mixed-case words, such as CamelCase and snake_case.

The Accepted words list also shows words that you saved to any of the built-in dictionaries using the Alt+Enter menu.

It does not show words added to the shared project-level dictionary by other users and words from other custom dictionaries, but these words will be still ignored by the spellchecker.

Share dictionaries

CLion stores the built-in project-level dictionary in the d.xml file in the .idea subdirectory of your project directory with other project-related files.

When you share this file with your project team through VCS, other team members using CLion will be able to access the dictionary to share the list of ignored words.

To share your application-level dictionary, use the bundled Settings Sync plugin.

Last modified: 16 April 2024