On this page:
- Checking the Spelling of a word
- Configuring the Dictionaries to Use
- Configuring Spellchecking Options
PyCharm helps you make sure that all your source code, including textual strings, comments, and literals,
and commit messages, is spelt correctly. For this purpose, PyCharm 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, PyCharm 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.
On this page:
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:
- : select the desired spelling of a textual string or comment from the suggestion list.
- : add word to the user's list and skip it in future.
Configuring the Dictionaries to Use
- Open the Settings / Preferences Dialog by choosing for Windows and Linux or for OS X, 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 PyCharm 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
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 .
The full path to the folder is added to the Custom Dictionaries Folder list, and all the
*.dicfiles found in this folder are added to the Dictionaries list.
- To remove a folder from the list, select it and click .
- To add a new folder to the list, click and choose the required folder in the Select Path Dialog dialog that opens .
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, PyCharm 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 choosing for Windows and Linux or for OS X, 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.