Integrated spell checking with ReSpeller in ReSharper and Rider
The latest builds of ReSharper 2018.2 EAP and Rider 2018.2 EAP come with the ReSpeller extension, providing spell-checking functionality out of the box. Just like with code analysis, ReSpeller scans for spelling mistakes and typos in identifiers, comments, string literals and more, and provides quick-fixes to resolve the problem. Let’s have a look!
Spell-checking in the editor
ReSpeller will look for spelling mistakes in identifiers, comments, and string literals. When it detects a potential spelling mistake or a typo, it will let us know in the same way ReSharper and Rider display other code suggestions:
We can then invoke the Alt+Enter menu where ReSpeller gives us several options to fix our mistake: we can either fix our typo or add this word to ReSpeller’s dictionary.
When selecting Replace with…, ReSpeller provides us with several suggestions. By default, the best match will be selected (“parameters” in this example), but other versions are provided as well. Perhaps we meant to use the singular “parameter”? And yes, “par meters” exist – they measure Photosynthetically Active Radiation in case you wanted to know.
What’s nice about ReSpeller is that it automatically invokes the Rename refactoring when fixing a typo in an identifier. This ensures that our spelling correction preserves consistency across our code base. Note that in the Rename dialog, we can press Ctrl+Space to invoke code completion – or in this case, word completion.
Now, where do these suggestions come from…
ReSpeller dictionaries
By default, Rider and ReSharper come with a built-in dictionary for English (United States). It uses a dictionary based on Hunspell, which means we can install other languages as well. Being a native Dutch speaker (well, Flemish), I’ve downloaded the corresponding .aff
and .dic
files and imported it in ReSharper’s settings:
Et voila! (yes, you can add French, too, and many more languages) We now have spell checking for Dutch:
Remember that the quick-fix on a spelling mistake also showed the option Add to user dictionary? It allows us to add a custom word to ReSpeller’s dictionary. And just like with settings layers, we can choose to add that word to a dictionary on our own machine or share it with the entire team.
Configuring ReSpeller code analysis
By default, ReSpeller is enabled in many of ReSharper’s supported languages. We can enable/disable individual inspections and change severity by searching for “typo” in the settings (under Code Inspection | Inspection Severity).
There are many cases where spell checking is important or even critical. ReSharper and Rider now help detect and resolve them.
Give ReSharper 2018.2 EAP a try! Or grab the latest Rider 2018.2 EAP! We’d love to hear your feedback!
Bradley says:
July 10, 2018Any chance we can get custom dictionary “layers” with this too? I’d like to be able to have project / solution specific dictionaries for domain specific words, that won’t affect unrelated projects.
Maarten Balliauw says:
July 10, 2018You can add words to e.g. the team-shared layer.
Dew Drop - July 11, 2018 (#2763) - Morning Dew says:
July 11, 2018[…] Integrated spell checking with ReSpeller in ReSharper and Rider (Maarten Balliauw) […]
Jeff Odell says:
July 11, 2018Would you consider excluding strings that are ALLCAPS?
Jeff Odell says:
July 11, 2018I’m sorry – I meant “an option for excluding ALLCAPS”
Maarten Balliauw says:
July 11, 2018That’s a good suggestion. Would you mind logging a request at https://youtrack.jetbrains.com/issues/RSRP#newIssue ?
Greg says:
July 13, 2018Does this replace the purchased version of ReSpeller Pro?
Maarten Balliauw says:
July 13, 2018That’s correct.
mdeschaepmeester says:
July 17, 2018Mooi, dat verdient inderdaad pannenkoeken!
Maarten Balliauw says:
July 17, 2018Haha bedankt 🙂 (Thanks! I will enjoy them.)
Bruno Juchli says:
August 22, 2018What’s the simplest way to deactivate ReSpeller altogether?
Maarten Balliauw says:
August 22, 2018There is no “one click” way, however it’s not too difficult. From Rider’s settings, find Editor | Inspections. Then under the languages of choice (e.g. C#), search for "spell" or "typo" and disable the inspections.
Then when saving settings, pick the dropdown and pick This Computer if you want these disabled in all solutions you open.
Stephen Kennedy says:
August 22, 2018I added the en-GB dictionary and saved the setting to my team’s layer. The path to the dictionary is saved as a full path including drive letter. This necessitates all team members to have installed the dictionary into the same folder on the same drive. I want to commit the dictionary to source control and have Resharper look for it relative to my team settings file location. Is that possible? I tried manually editing the settings file but it didn’t work.
Maarten Balliauw says:
August 22, 2018Just checked with the team, this is planned but right now only absolute paths are supported.
Bart Joy says:
April 8, 2019This is essential for sharing settings among the team. Has there been any progress?
Maarten Balliauw says:
April 9, 2019Hi Bart, you can keep an eye on this issue: https://youtrack.jetbrains.com/issue/RSRP-471194
Stephen Kennedy says:
August 22, 2018Thanks Maarten. Is there a ticket for this planned improvement I can monitor, or am I safe to assume it will come in the next release?
Maarten Balliauw says:
August 22, 2018It’s an improvement the main developer thought of as well, but there was no ticket it seems. Just created one: https://youtrack.jetbrains.com/issue/RSRP-471194
Jon Ward says:
August 22, 2018I’d also prefer to disable ReSpeller until you can offer a better way of managing languages. Selecting languages should be handled entirely within the configuration, not requiring a dictionary download outside of the tool.
Maarten Balliauw says:
August 22, 2018Would you mind elaborating a bit in a ticket? https://youtrack.jetbrains.com/issues/RSRP#newIssue
(let me know the ticket URL once you have it, will then send it over to the right folks)
Jon Ward says:
August 23, 2018Thanks Maarten, I’ve done that: https://youtrack.jetbrains.com/issue/RSRP-471227
Just to be clear, I’m not saying ReSpeller is a bad feature and I do love ReSharper… it’s just that it could support languages with much less messing about and until it does that I’d rather turn it off.
Thanks for your reply.
Maarten Balliauw says:
August 23, 2018Thanks! Updated the issue so the right folks see it. Much appreciate you creating that ticket!
Jon Ward says:
August 23, 2018You’re welcome, and thanks for your response!
Logan Ratner says:
August 27, 2018One irritant is that ReSpeller doesn’t understand doxygen commands inside a comment block. If I type:
/// \brief a method
///
/// \return true if methodical
///
Then it reports spelling errors ‘ief’ and ‘eturn’ as it thinks \b and \r are special characters.
John Staveley (@johnstaveley) says:
September 6, 2018Every single word in Visual Studio is marked as having a typo. Switching it off in settings does not work.
What’s New in ReSharper C++ 2018.2 - ReSharper C++ BlogReSharper C++ Blog says:
September 12, 2018[…] By default, the spell-checker comes with a built-in dictionary for American English, so do not be surprised if ReSpeller complains about “colour” or “behaviour”. Dictionaries for other languages can be easily added too, since ReSharper C++ uses the standard hunspell dictionary format. For instructions on adding a new dictionary and more info about ReSpeller, see Integrated spell checking with ReSpeller in ReSharper and Rider. […]
Alex Strickland says:
September 13, 2018As above, I am not able to disable the spelling checker, it is not “ticked” and yet is still loaded. It is irritating me, too many marked typos in commented code (I’m sure any commented code should have been deleted and kept “clean” but you know how it is).
Alex Strickland says:
September 13, 2018My apologies – it was the Component One spell checker.
Karl THURNHOFER says:
January 15, 2019Forget the german Hunspell dictionaries from Wooorm website, they are not useable for a serious german spell checking. I recommend the german Hunspell dictionaries (de_DE-20071211.zip) from Björn Jacke that can be found at https://j3e.de/hunspell/
Andrew Patrick says:
February 6, 2019Is there a way to make it pick up words from existing Code Analysis (i.e. FxCop) custom dictionaries?
I’ve just tried a preview of this on my codebase and Respeller is reporting all the words in my custom dictionary as being spelled wrong… hardly the ideal result, nor do I really want to maintain two dictionaries of custom words, one for CA and one for Respeller.
Maarten Balliauw says:
February 7, 2019This is no supported currently. Could you log a request at https://youtrack.jetbrains.com/issues/RSRP#newIssue ?
Andy Patrick says:
February 9, 2019Certainly. https://youtrack.jetbrains.com/issue/RSRP-473336
Maarten Balliauw says:
February 11, 2019Great, thanks Andy!
Courtney says:
February 15, 2019Downloaded the Australian dictionary from Wooorm website and added the .dic file – after doing that though Respeller shows every word is now a spelling mistake.
Disabled.
Guy Bailey says:
February 18, 2019i hope they add the ability to disable ReSpeller. Until then, we will use a different code analysis tool.
Maarten Balliauw says:
February 25, 2019There is no “one click” way, however it’s not too difficult. From Rider/ReSharper settings, this can be done from the inspections page. Then under the languages of choice (e.g. C#), search for "spell" or "typo" and disable the inspections.
Bertus says:
March 9, 2020Seems simple enough, but I don’t get it to work.
I wanted to use real English instead of American.
I added the .dic file from wooorm, disabled the bundled en-US, en refreshed the code inspection. I got thousands of spelling issues.
I have suspended Resharper, restarted Visual Studio, nothing helps.
What’s going on? I only need the .dic file, right? It is alright to be html, right?
So why doesn’t it work? Bug?
Maarten Balliauw says:
March 10, 2020Do you happen to have the URL to the .dic file so we can try this as well?
Bertus says:
March 9, 2020By the way, I already had the .aff file in the same directory as the .dic file, but it does not work anyway.
I found that here:
https://www.jetbrains.com/help/resharper/Spell_Checking.html