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, jetbrains.dic and english.dic), and any number of user-defined custom dictionaries.
A user dictionary is a textual file with the dic extension, 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.
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.
- Place the caret on a word highlighted by the Typo inspection.
- Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1 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.
- Open the Project Settings dialog box
- Click Spelling.
- Make up a user's words list. To do that, click the Accepted Words tab, and use (Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter) and (Alt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteCommand DeleteCommand DeleteCommand Delete) to manage the list of words to be skipped by the Typo inspection.
- Define the set of dictionaries to be used for spellchecking on the Dictionaries tab. In the User dictionaries paths section, click (Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter), and in the dialog that opens, select the directory where the desired dictionaries are located. All dictionaries detected in the specified directories, are listed in the Dictionaries section below. By default, all dictionaries are enabled. If you want to omit some of them, clear their check boxes.
- Define the type of contents to be inspected, and inspection severity. To do that, click the Manage spelling inspection settings hyperlink to open the Typo page in Inspections. Use check boxes to define the pieces of code to be inspected (code, literals, and comments), and select severity level from the drop-down list.