New Spellchecker Implementation in IntelliJ IDEA 2020.2

Posted on by Alexey Zhebel

Spellchecking is a pretty standard feature in most of today’s IDEs because it can be really helpful to catch typos in your code in the natural language constructs, such as variable names, strings, comments, and so on. Not so long ago, we introduced Grazie, a built-in grammar and style checker. Grazie is evolving and improving with every release and getting better and better at catching discrepancies in natural language. We decided it’s now about time we turned our attention to some of the long-standing issues with spellchecking and put the expertise gained from creating our powerful grammar and style checks into making the spellchecker better too.

Here’s what we managed to achieve by moving to a different spellchecker implementation:

  • Better performance: Although this may not be so noticeable, the spellchecker is now several times faster at detecting mistakes and suggesting fixes.
  • Improved suggestion accuracy: The new implementation filters out irrelevant suggestions that used to clutter up the list of suggestions.
  • Improved suggestion sorting: It has several criteria to rank the suggestions and calculate which is the most relevant in this context. The first suggestion is the correct spelling in 84% of cases.
  • Fewer false positives: For example, there were problems with detecting and fixing typos related to possessives (apostrophes) and camel-case names.
  • More statistics: We are now collecting a lot of statistics to see how people use the spellchecker through opt-in anonymous usage reports. We have already reworked and simplified the spellchecker settings based on these stats.

To get an idea of how much more relevant the suggestions are now, here is a comparison:

Spellchecking back in 2020.1


Spellchecking now in 2020.2


If you have the Grazie plugin enabled, it is also now much easier than before to enable the spellchecker for other languages. Previously, you would have to manually download and import the corresponding dictionary. Although this is still possible, IntelliJ IDEA now detects the language in a file from the first couple of paragraphs and suggests downloading and enabling that language model. You can see and explicitly add/remove supported languages in the Settings / Preferences under Editor | Proofreading (this works for both spelling and grammar checks).

Be sure to give the spellchecker a try in the latest IntelliJ IDEA 2020.2 EAP. If you disabled it before, open Settings / Preferences, select Editor | Inspections, and enable the Typo inspection.

We are also working on other related functionality, such as improving Markdown support in IntelliJ IDEA and other features related to natural language processing. So stay tuned for more updates and happy developing!

Subscribe

Subscribe for updates