Welcome to MSDN Blogs Sign in | Join | Help

Visual Web Developer Team Blog

Your official information source from the Visual Web Developer team.

News

  • These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified Terms of Use
Spell checker for HTML, ASP.NET, JScript, VB, C#, CSS and C++ for Visual Studio 2005 and 2008

Following Visual Studio 2008 release I updated my Spell Checker add-in for VS 2008 as well as added some new useful functionality.

What's new in version 2.0:

Spell checker now supports text verification in:

  • HTML style comments <-- HTML -->
  • ASP.NET server side comments: <%-- ASP.NET --%>
  • JScript, C# and C++ comments: // C++ style comments
  • CSS and C style comments: /* C style comments */
  • VB and VBScript style comments: 'This is VB comment


Spell checking is supported in style and script blocks as well as in JS, CS, VB, CSS, CPP ahd H files. There are two separate binaries for VS 2005 and VS 2008. The can be installed side by side if you have both VS 2005 and VS 2008 installed on the machine.

Requirements:

Microsoft Visual Studio 2008 or 2005, any edition except Express.
Microsoft Word 2003 or 2007

Installation

Close Visual Studio
Download and run VSSpellChecker2005.msi or VSSpellChecker2008.msi.
Run Visual Studio
Open a Web site or standalone HTML, ASP, VB, C#, JS, VBS, CSS or CPP file.
You should see Spell Checker entry in the Tools menu.


Uninstall

Close Visual Studio
Open Control Panel
Go to Add/Remove Programs
Locate Spell Checker Add-in for Visual Studio 2005 or 2008 and click Remove.


How to use the Spell Checker

Open a Web Form, HTML, ASP, JS, VBS, CS, VB, CPP or CSS file and click Tools | Spell Checker. Spell check may take 10-15 seconds on decently sized files. There is no immediate progress indication, but you can see that squiggles appear one by one under misspelled words. Double click on the misspelled word brings list of suggestions. <Cancel> closes the suggestion list. Spell checker messages also show up in the Error List as informational messages. They are not entered as errors or warnings so they don't break builds.

VS 2005 screenshot:

VS 2008 screenshot:

As before, Spell Checker support mutiple languages in HTML markup, it detects lang attribute specified on elements, extracts ISO language and uses it to specify appropriate dictionary for the Office spell checking engine.It uses default Office spell checking language in code comments:

In order to be able to spell check multiple languages you may need to install Microsoft Office 2003 Proofing Tools or an appropriate Office 2007 Language Pack. If you never used particular language dictionary in Word, you have to try it before it becomes available in the Spell Checker add-in. Many dictionaries are installed on demand and if particular language was never activated in Word, the dictionary may be still missing. Open Word, type something in the desired language and run Word spell checker at least once to make sure it works and dictionary is installed.

Customization

You can customize spell checker behavior by editing rules.xml file located in Program Files\VS 2005 Spell Checker Add-In or VS 2008 Spell Checker Add-In. You can exclude certain elements and add more rules for attribute checking. You probably want to do that if you are using custom controls and want spell checker to verify spelling in custom control attribute values. All element and attribute names much be in lowercase. You don't have to close the HTML document or Visual Studio after editing the file, the file is loaded every time spell checking is performed.

<?xml version="1.0" encoding="utf-8"?>
<rules>
  <!-- Exclude content of script and style elements from spell check -->
  <exclude name="script" />
  <exclude name="style" />

  <!-- Check 'value' attribute on all elements without a namespace -->
  <element name="*">
    <attribute name="value" />
  </element>

  <!-- Rules in ASP namespace -->
  <namespace name="asp">

    <!-- Check all attributes ending in 'text' as well as tooltip attribute in all ASP.NET elements -->
    <element name="*">
      <attribute name="*text" />
      <attribute name="tooltip" />
    </element>

    <!-- Special rule for asp:Calendar -->
    <element name="calendar">
      <attribute name="caption" />
    </element>

    <!-- Add more rules for ASP.NET elements here if needed -->
  </namespace>

  <!-- Add rules for custom controls here if needed -->
 
</rules>

Important note: Add-in does not work with Visual Web Developer Express as Express editions are not extensible.

Visual Studio 2005 Add-in download

Visual Studio 2008 Add-in download

Troubleshooting:

You may have to run as admin during the setup since add-in needs to register COM components. If, for some reason, add-in does not appear in Visual Studio, try running regsvr32 vsspellchecker.dll from command line in the add in installation folder in Program Files. Look for more details here: http://blogs.msdn.com/mikhailarkhipov/archive/2007/12/13/troubleshooting-spell-checker-setup.aspx.

- Mikhail Arkhipov

Posted: Thursday, December 13, 2007 4:57 PM by WebDevTools

Comments

Nektar said:

That is a very interesting add-in. I don't know if you want but could you upload your source code on Codeplex so that we can use it as a learning ground for our own add-ins and so that we can give you feedback and fix bugs, since this is not an official MS software release and it does not have to keep its source code confidencial, unless you want it so of course. What do you think? It would make an excellent addition to the current already good power toys source code releases for Visual Studio on Codeplex.

# December 13, 2007 1:29 PM

Brian Dukes said:

Any plans to check resource (.resx) files?

# December 13, 2007 2:39 PM

sean said:

"Following Visual Studio 2008 release I updated my Spell Shecker add-in to make work with VS 2008..."

Shecker...make work with...

I don't know if that was intended, but hilarious either way.  I would officially rename to 'Spell Shecker'.

# December 13, 2007 4:23 PM

かるあ のメモ said:

Spell checker for HTML, ASP.NET, JScript, VB, C#, CSS and C++ for Visual Studio 2005 and 2008 より Visual Studio 2005, 2008 のアドインで、英語のスペルチェックをしてくれるプラグインの紹介がされています。 Visual Studio 2005 Add-in download Visual Studio 2008 Add-in download

# December 13, 2007 6:30 PM

WebDevTools said:

Brian, RESX files are essentially XML, so you can try this workaround: http://blogs.msdn.com/mikhailarkhipov/archive/2006/04/20/579980.aspx

I'll look into adding native support for resx in the future though - good suggestion, thanks.

# December 13, 2007 6:45 PM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# December 13, 2007 8:35 PM

Jesper Blad Jensen said:

The link is dead :(

# December 14, 2007 2:08 AM

Egil Hansen said:

I really like your plugin. I'm having trouble with the language selection, or rather, the lack there of.

Usually my office applications default to Danish, as it is the language I write most in. But how do I force the spell checker in VS to spell check in English?

# December 14, 2007 6:21 AM

Egil Hansen said:

Ahh, please disregard my previous post.

I found a aptly named "Microsoft Office 2007 Language Settings" on my computer, that did the trick.

# December 14, 2007 6:30 AM

Konstantin said:

Извините, что не в тему, но не смог удержаться. Вы русский???

# December 14, 2007 1:10 PM

ProJester said:

Dear WDT Team Members,

regarding Arkhipov's "Important note: Add-in does not work with Visual Web Developer Express as Express editions are not extensible."

Red Gate

http://www.red-gate.com/  (SQL Prompt) are capable to extend Express Edition, so how you can’t?  (You are from the core – you are from Microsoft)

Regards,Alfred.

# December 14, 2007 1:53 PM

almazik said:

ProJester: according to Microsoft, Express editions are not allowed to be extensible. There was a pretty big discussion in blogs when Microsoft tried to force Jamie Cansdale, the creator of TestDriven.NET, to remove support for Express Editions (http://weblogs.asp.net/nunitaddin/archive/2007/05/30/microsoft-vs-testdriven-net-express.aspx).

# December 14, 2007 2:19 PM

Mikhail Arkhipov (MSFT) said:

To Konstantin: Yes.

# December 14, 2007 8:28 PM

Mikhail Arkhipov (MSFT) said:

Alfred, RedGate mentions "SSMS Express Edition", not Visual Studio Express Edition.

Some interfaces Spell Checker uses simply do not exist in Express as components that implement them are not in the products.

# December 14, 2007 8:33 PM

Khaled Musaied (from Saudi Arabia) said:

Thanks for this extention and I will Distribute it to all my friends.

# December 15, 2007 1:33 AM

Manuel Abadia said:

What about adding support for meta tags with Content-Language specifying the default language for the document?

# December 17, 2007 6:08 AM

SergeyD said:

Dear Mikhail,

Do you have any plans to support text verification for C++/C#/VB strings? I mean quoted string constants like c = "foo bar"

# December 17, 2007 8:41 AM

David J said:

The spell checker seems to work when I run Visual Studio as my admin user, but not when I run Visual Studio as a non-admin user (which is how I prefer to run Visual Studio). The Add-In Manager doesn't list the Spell Checker when I run Visual Studio as a non-admin but it does for the admin user.

I did choose to install the Add-In for All Users in the setup UI. I am running Windows Vista.

# December 17, 2007 2:08 PM

Mikhail Arkhipov (MSFT) said:

David: default installation is per user. Try choosing 'Install for all users' when installing the add-in.

# December 18, 2007 1:58 PM

Iain said:

Just spotted something a little funny, where i have code starting Rem it thinks that whatever comes next is a comment.

e.g.   allSuppliers.Remove(1)  - where ove(1) is spelt wrong?!?

I'm using this in vb2008

# December 19, 2007 9:03 AM

Ivan said:

I tried to install VS2008 addin for "everyone" and it did not work. When I install it for "me only" it worked ok.

# December 19, 2007 1:35 PM

Chinh Do said:

Looks like the spell checker has a bug dealing with C# XML document comments. For example, it doesn't recognize that </para> is a closing tag in the line below and puts squiggles under "Notes</b></para>".

/// <para><b>Developer Notes</b></para>

# December 20, 2007 3:43 PM

Tom James said:

The spell checker is working for me in VS 2005 with Word 2003, but does not seem to catch anything inside my asp script or javascript tags

<body>zxcvzxc</body> is caught

<%

zxcvzxcv

%>

AND

<script type="text/javascript">

zxcvzxcv

</script>

is not. Any ideas?

Tom

# December 21, 2007 9:45 AM

Dani Avni said:

the spell checker has some problems with XML comments

i have a comment

''' <param name="Location">the new location of the mobile device</param>

and the speller highlights the device</param> as a problem.

any chance this will be fixed?

# December 26, 2007 4:43 AM

Mikhail Arkhipov (MSFT) said:

Tom, David: I fixed </param> as well as premature termination of spell checking after <% %> block. Update will be published soon.

# December 31, 2007 2:39 AM

Bryan said:

Any chance the spell checker might be setup to work with older versions of MSWord (say from Office 97) for those of us that don't need, or want for that matter, to upgrade to 2003/7? Or is the API significantly different?

Thanks

# January 4, 2008 9:04 AM

Brian said:

Awesome tool guys thanks!

# January 4, 2008 9:53 AM
New Comments to this post are disabled
Page view tracker