PhpStorm 2016.2 Help

Spellchecking

On this page:

Basics

PhpStorm helps you make sure that all your source code, including textual strings, comments, and literals, and commit messages, is spelt correctly. For this purpose, PhpStorm 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, PhpStorm 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.

Checking the spelling of a word

  1. Place the caret on a word highlighted by the Typo inspection.
  2. Press Alt+Enter to show the available intention actions.
  3. Choose one of the following actions:
    • Change to: select the desired spelling of a textual string or comment from the suggestion list.
    • Save to dictionary: add word to the user's list and skip it in future.

Configuring the dictionaries to use

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for OS X, and click Spelling under Editor.
  2. Define the set of dictionaries to be used for spellchecking.
    1. Switch to the Dictionaries tab.
    2. 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 PhpStorm 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.
    3. 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 with the dic extension, containing words separated with a newline).
      • To add a new folder to the list, click add 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 *.dic files found in this folder are added to the Dictionaries list.

      • To remove a folder from the list, select it and click delete.
  3. 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.
    1. Switch to the Accepted Words tab.
    2. Create a Word List:
      • Click the add 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, PhpStorm 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 delete.

Configuring spellchecking options

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for OS X, and click Inspections under Editor.
  2. On the Inspections page, that opens showing a list of inspection types, 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 check boxes.
    • In the Severity area, choose the inspection severity level and the scope to apply this level in.

See Also

Last modified: 24 November 2016