Spellchecking
GoLand checks the spelling of all your source code, including variable names, text in strings, comments, literals, and commit messages. For this purpose, GoLand provides a dedicated Typo inspection which is enabled by default.
The Typo inspection detects and highlights words that are not included in any dictionary. You can either correct the spelling or accept the word as correct (by saving it to the dictionary). Disable the Typo inspection if you want to ignore all spelling mistakes. For more information, see Configure the Typo inspection.
Correct a misspelled word
Place the caret at any word highlighted by the Typo inspection.
Click or press Alt+Enter to show the available intention actions.
Select one of the suggested fixes from the list.
In string literals and comments, only the spelling of this particular word at caret changes. Where the Rename refactoring is available, the inspection suggests to rename all occurrences of a symbol .
Accept a misspelled word
Place the caret at a word highlighted by the Typo inspection.
Click or press Alt+Enter to show the available intention actions.
Select the Save to dictionary action to add the word to the user's dictionary and skip it in the future.
If you have added the word by mistake, press Ctrl+Z to remove it from the dictionary.
By default, GoLand 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. For more information, see Select the default dictionary for saving words.
Configure the Typo inspection
By default, the Typo inspection checks all text including code elements, string literals, and comments in all scopes.
Press Ctrl+Alt+S to open the IDE settings and select
.Expand the Proofreading node and click Typo in the central pane.
In the right-hand pane, configure the Typo inspection:
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 various code elements.
Process literals: check text inside string literals.
Process comments: check text inside comments.
To disable the Typo inspection, clear the checkbox next to it.
Dictionaries
GoLand 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.
If you have the Hunspell plugin installed and enabled, you can add Hunspell dictionaries, which comprise 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 the spellchecker dictionaries
Press Ctrl+Alt+S to open the IDE settings and select
.Configure the list of custom dictionaries:
To add a new custom dictionary to the list, click or press Alt+Insert and specify the location of the required file.
To edit the contents of a custom dictionary in GoLand, select it and click 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 or press Alt+Delete.
Select the default dictionary for saving words
By default, GoLand 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.
Press Ctrl+Alt+S to open the IDE settings and select
.Select either the built-in project-level or application-level dictionary or disable the option to prompt you every time you save a word.
Add accepted words manually
Press Ctrl+Alt+S to open the IDE settings and select
.Add words to the Accepted words list. GoLand 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
andsnake_case
.
Share dictionaries
GoLand stores the built-in project-level dictionary with other project-related files. This means that anyone working with the project has access to the words stored in this dictionary.
To share your application-level dictionary, use the bundled IDE Settings Sync plugin.