GoLand 2019.2 Help

Spellchecking

GoLand helps you make sure that all your source code, including textual strings, comments, literals, and commit messages, is spelt correctly. For this purpose, GoLand provides a dedicated Typo inspection, which is enabled by default.

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

Checking the spelling of a word

With the Typo inspection enabled, GoLand detects and highlights words not included in any dictionary. You can either provide the correct spelling or accept the word as is. If a word is accepted, it will be added to the custom dictionary of your choice, and skipped by the spellchecker in the future. If the Typo inspection is disabled, all typos are ignored.

Correct a misspelled word

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

  2. Click the Intention action button or press Alt+Enter to show the available intention actions.

  3. Select the Change to intention action and choose the desired spelling from the suggestion list.

Accept a misspelled word

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

  2. Click Intention action icon or press Alt+Enter to show the available intention actions.

  3. Select the Save to dictionary action to add the word to the user's dictionary and skip it in the future. If no default dictionary is selected, GoLand will let you choose the one to save the word to.

    To remove the just added word, press Ctrl+Z.

Configuring the dictionaries to use

Correctness of spelling is checked against the bundled dictionaries and user-defined custom dictionaries. Since the spellchecking feature doesn't allow you to actually change the language itself, adding custom dictionaries will allow you to bring virtually any language support to GoLand.

The dictionaries can be any of the following:

  • The built-in project-level and application-level dictionaries, which you populate by manually saving words to them.

  • Plain text files with the DIC extension, containing words separated with a new line.

  • Hunspell dictionaries, comprise two plain text files commonly sharing the same name, for example, en_GB.dic and en_GB.aff. The DIC file contains a list of words together with the applicable modification rules. The AFF file list prefixes and suffixes regulated by a specific modification rule. Hunspell dictionaries can be easily obtained online, for example, here.

Choose the dictionaries to use

  1. In the Settings/Preferences dialog Ctrl+Alt+S, choose Spelling under Editor.

  2. On the Spelling page that opens, switch to the Dictionaries tab.

    In the Custom Dictionaries area, configure your custom dictionaries to use.

    • To add a new custom dictionary to the list, click the Add button or press Alt+Insert and choose the required file in the Select Path Dialog dialog that opens. The full path to the selected file is added to the Custom Dictionaries list.

    • To edit the contents of a custom dictionary in GoLand, 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.

  3. In the Bundled Dictionaries area, configure the bundled dictionaries to use by selecting or clearing the checkboxes next to them.

Populating the built-in dictionaries

You can manually populate the built-in project-level and application-level dictionaries with the words that should be skipped during spellchecking.

Add an accepted word

  1. In the Settings/Preferences dialog Ctrl+Alt+S, choose Spelling under Editor.

  2. On the Spelling page that opens, switch to the Accepted Words tab.

  3. Create a Word List:

    • Click the Add button to open the Add New Word dialog 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, GoLand 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 Remove button.

Configuring the spellchecking options

Set the spellchecking defaults

  1. In the Settings/Preferences dialog Ctrl+Alt+S, choose Spelling under Editor.

  2. On the Spelling page that opens, switch to the Dictionaries tab. In the Advanced settings area, choose whether you want to use a built-in project-level or application-level dictionary as a single dictionary for saving words.

    If no default dictionary is selected, GoLand will let you choose the one to save the word to on invoking the Change to... intention action on a mistyped word.

  3. If necessary, use the spin box to limit the number of words suggested by the spellchecker.

Configure the Typo inspection

  1. In the Settings/Preferences dialog Ctrl+Alt+S, choose Inspections under Editor.

  2. On the Inspections page that opens, expand the Spelling node and click Typo in the central pane.

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

    • In the Severity area, choose the inspection severity level and the scope in which to apply this level.

Last modified: 10 August 2019

See Also