Quantcast
Channel: ASP.NET Blog
Viewing all articles
Browse latest Browse all 7144

Spell Checker extension for Visual Studio 2012 HTML, ASP.NET, CSS and other files

$
0
0

I have updated spell checker extension for Visual Studio 2012. You can download it from Visual Studio Gallery.

Spell checker supports text verification in:

  • HTML and ASP.NET element content and attributes
  • 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 and H files. Spell checker is able to detects lang attribute specified on HTML elements, extract ISO language and use it to specify appropriate dictionary for the Office spell checking engine.

Requirements

Microsoft Visual Studio 2012 any edition except Express.
Microsoft Word 2003, 2007 or 2010. Extension was not tested with Office 15 preview.

How to use Spell Checker

After installing the extension you should see Spell Checker menu item in the Tools menu. Spell checker is not 'as you type' so you have to click the menu item each time you want to re-check the document.

 

 

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. Right click on the error marker allows you to pick correct word from list of suggestions.

 

 

Spell checker is able to detects langattribute specified on elements, extract ISO language and use it to specify appropriate dictionary for the Office spell checking engine. You can define language of comments in non-HTML files by adding the following in the first comment in the file:

// <spellcheck-language='fr'

In order to be able to spell check pages in multiple languages you may need to install appropriate Office Language Pack. If you never used particular language dictionary in Word, you have to try using it at least once before it becomes available to the Spell Checker extension. Many dictionaries are installed on demand and if particular language was never activated in Word, the dictionary may be 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.

Office language options can be found in Word File | Options menu:

 

Customization

You can customize spell checker behavior by editing rules.xml file located in the extension install folder (typically under C:\Users\<user_name>\AppData\Local\Microsoft\VisualStudio\11.0\Extensions. You can exclude certain elements and add more rules for attribute checking if you want spell checker to verify spelling in custom control attributes. All element and attribute names much be in lowercase. You don't have to close 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>

Thanks

Mikhail Arkhipov


Viewing all articles
Browse latest Browse all 7144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>