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:
Hovering over the text offers me to correct the flagged error:
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:
‘Initialization’ vs. ‘Initialisation’: that’s an ‘English US’ vs. English UK’ thing, and is easily changed. And I prefer the US English:
In later Eclipse versions (.e.g. Oxygen or Photon), make sure that the ‘C/C++ spelling engine’ is selected and configured:
With this, everything is ok now:
💡 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:
If I do not have a user dictionary yet, it will prompt a dialog:
If pressing ‘Yes’, it will prompt the settings page from above where I can specify my user dictionary file:
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.
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
Happy Spelling 🙂
Pingback: Top 10 Customization of Eclipse Settings | MCU on Eclipse
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!
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).
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).
ok, good to know about KDE and KDevelop.
Pingback: How to re-enable ‘Add to dictionary’ for the Eclipse Spell Checker | MCU on Eclipse
Thank you, nice explanation..
Thank you! It helped me to re-enable the spell checker I had disabled accidentally!
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
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.
Later Eclipse versions added the ability to specify the dictionary for different environment. Make sure you configure your dictionary file for C/C++: https://mcuoneclipse.files.wordpress.com/2013/01/C-and-C-Spelling-Engine.png?w=584&h=529
Thanks, that did it. Somewhere during an update it got changed to DEFAULT which, of course, sounds ok but doesn’t actually work.
Yes, this had trapped me in the first place too, that’s why I have now updated the article.
Pingback: Eclipse Spell Checker for C/C++ Code | MCU on Eclipse