Tuesday, September 6, 2011

Spellchecking in Visual Studio 2010

Visual Studio 2010 has no built in support for spell checking, but there is an extension available that fixes this.

This amazing extension written by Roman Golovin and Michael Lehenl checks the spelling in your code comments as well as in html files.

As I have understood it takes advantage of the spell checking support in WPF and uses this functionality to implement the extension.

This all works fine if you’re located in the US or any other region that has a supported language.

The extension sets up the language based on the locale on your machine so if you’re outside one of English speaking regions, you will not be able to do spell checking in English.

But there is a way around this.

The code for this extension is available from GitHub and we only need to make one tiny little change in the source code to make it work.

Here is what to do.

Download the code from GitHub and locate the SpellingTagger class.

In the CheckSpellings method we need to add one line of code to make it default to “en"-US”.


TextBox textBox = new TextBox();
textBox.SpellCheck.IsEnabled = true;
//Added to force english US language 
textBox.Language = XmlLanguage.GetLanguage("en-US");


Compile the solution and install the extension by executing the SpellChecker.vsix file located in the Bin folder.

Now we can all have spell checking in Visual Studio 2010



No comments: