Eclipse Spell Checker

One of the nice things of modern IDE’s are: they offer many extras for free. Many times it is related to programming and coding. But I love as well the ones which makes things easier and better which is not directly related to the executed code. One thing Eclipse offers is an on-the-fly spell-checking, similar to Microsoft Word:

Spellchecked Sources

Spellchecked Sources

Hovering over the text offers me to correct the flagged error:

Initialization vs. Initialisation

Initialization vs. Initialisation

But wait: is that example not spelled correctly?

And indeed, Eclipse offers to customize the spell checking. The option page is in the Windows > Preferences > General > Editors > Text Editors > Spelling page:

Spelling Preferences

Spelling Preferences

‘Initialization’ vs. ‘Initialisation’: that’s an ‘English US’ vs. English UK’ thing, and is easily changed. And I prefer the US English:

Changing Dictionary

Changing Dictionary

In later Eclipse versions (.e.g. Oxygen or Photon), make sure that the ‘C/C++ spelling engine’ is selected and configured:

C and C++ Spelling Engine

C and C++ Spelling Engine

With this, everything is ok now:

not flagged any more

not flagged any more

💡 After changing the platform dictionary, it usually takes a few minutes until the sources are checked again.

But what if Eclipse does not know a word? Then it offers to add it to a dictionary:

Adding to the dictionary

Adding to the dictionary

If I do not have a user dictionary yet, it will prompt a dialog:

Missing User Dictionary

Missing User Dictionary

If pressing ‘Yes’, it will prompt the settings page from above where I can specify my user dictionary file:

User defined dictionary

User defined dictionary

The user dictionary is a normal text file with one word on each line. That makes it easy to edit and to have it in a version control system.

💡 I have one common dictionary file for all my workspaces. But of course it is possible to have different dictionaries per workspace, as the settings are per workspace too.

Summary

I feel having reasonable spelled comments in the sources is just something an engineer should care about. And the Eclipse spelling engine does not have to be as good as the one in MS Word (which is pretty good in my view). But for making sources better something like correctly spelled comments is a plus. But only if the code works like a charm :mrgreen:

Happy Spelling 🙂

13 thoughts on “Eclipse Spell Checker

  1. Pingback: Top 10 Customization of Eclipse Settings | MCU on Eclipse

  2. I need to spellcheck a C++ project on Linux and Eclipse’s spell checker seems to be the best I found in Linux’s IDE’s. The only thing I miss about it is the ability to do some kind of a “batch spellcheck” the way F7 in MS Word does. It would be great if Eclipse could direct you to lines with misspelled words just like it directs you to lines with C++ syntax errors.
    Thanks for the article!

    Like

    • Hi ThorX89,
      you are welcome! And yes, I wish there would be a way to jump to the next spelling error, or to have a list/report of the errors. I have seen some requests around this in other forums, but not seen it implemented (yet).

      Like

      • Hi Erich. I ended up solving the problem right after posting my comment here. Turns out both KDE Kate and KDevelop do have a nice spellchecker that can jump from error to error just like MS Word does, and it supports spellchecking code (i.e., it checks string literals and comments but not the actual code). The only downside (and Eclipse suffers from this too) is that code identifiers and language keywords don’t get ignored automatically. (See https://bugs.kde.org/show_bug.cgi?id=321593 ). Really useful if you have a fairly large codebase with lots of documentation that you didn’t write with a spellchecker on (my case).

        Like

  3. Pingback: How to re-enable ‘Add to dictionary’ for the Eclipse Spell Checker | MCU on Eclipse

  4. The last few updates to mcuXpresso have broken the dictionary. It says I need to define a file but shows it in the User Defined Dictionary box. I’ve made sure permissions a open (777) and tried different forms of the file name with and without .txt

    Any ideas?

    Systems I’m having problems on: Ubuntu 16.04LTS, Ubuntu 18.04LTS with KDE. LOTS of free disk and RAM, so shouldn’t be any problems there.

    Like

  5. Pingback: Eclipse Spell Checker for C/C++ Code | MCU on Eclipse

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.