Features Releases

Hunspell dictionaries support

PhpStorm is a polyglot IDE: it understands PHP, JS, CSS, HTML, and many other languages and will provide you with smart interpretation to assist you with writing your code. But what about human languages? English is the only language supported out of the box, and up until recently, you could only check your spelling in PhpStorm against a plain list of words.

This changes with PhpStorm 2017.3.2, since we are introducing support for Hunspell dictionaries.

Hun… what?

Chances are that you are already using Hunspell, though without even realizing it: It is the built-in spell checking engine used in OpenOffice, Mozilla Firefox, Google Chrome, Opera, macOS and many others – now including PhpStorm.

Compared to a plain list of words, Hunspell provides significantly faster and much more accurate typo detection with far fewer false positives.

Hunspell uses its own dictionary format, with each dictionary comprising two files. These files are commonly stored in the same directory and share the same name, for example, en_GB.dic and en_GB.aff. The .dic file stands for “dictionary”: it contains a list of words together with the applicable modification rules. The .aff file stands for “affixes”, which are, basically, prefixes and suffixes regulated by a specific rule:

hunspell_files

The files’ content is stored as plain text. Should you want to modify a dictionary or even create your own from scratch, you can do it using any text editor. Creating your own dictionary is a task in itself, and there are multiple guides available online. This one, for example, contains everything to get you up and running with your own dictionary.

In the majority of cases, however, downloading a ready-made dictionary online is more than enough to fulfill one’s spell-checking needs. These resources may provide you with a good start for finding a dictionary:

Having downloaded the dictionary, store it in a folder of your choice so that you can locate it from PhpStorm.

Setting up a Hunspell dictionary in PhpStorm

Hunspell dictionaries in PhpStorm are supported via the bundled Hunspell plugin. To make sure that it’s installed and enabled (as well as to install and enable it otherwise), navigate to Settings/Preferences | Plugins:

plugins_page

The next step is to appoint a Hunspell dictionary to be used by the spell checking engine. Navigate to the Settings/Preferences | Editor | Spelling, switch to the Dictionaries tab and select the dictionary folder:

settings_dictionaries

With the dictionary in place, PhpStorm will provide you with everything you would expect from a spell checking system: it will detect and highlight typos in your text and propose corrections for them.

Stay tuned for more updates!

Your JetBrains PhpStorm Team
The Drive to Develop

image description