ASP.NET/HTML Spell Checker 2.3 is available for Visual Studio 2010

ASP.NET/HTML Spell Checker 2.3 is available for Visual Studio 2010

  • Comments 8

ASP.NET/HTML Spell Checker 2.3 for Visual Studio 2010 has been posted on Visual Studio Gallery (also accessible from Visual Studio Start page in 'Extending Visual Studio' section). Direct link: http://visualstudiogallery.msdn.microsoft.com/en-us/0db4814c-255e-4cc6-a2c2-a428de7f8949

What's new in version 2.3:

  • VS 2010 version installs from gallery as Visual Studio Extension package (VSIX)
  • In VS 2010 suggestion list is invoked via right button click (instead of double click as in earlier versions).
  • Fixed bug:
    • Fixing misspelled word it may also remove punctuation that immediately follows it.

For additional information please refer to readme.htm included in the download - you can find it in the extension directory, typically 

C:\Users\USER_NAME\AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\HTML\ASP.NET Spell Checker for VS 2010\2.3

 as well as to the earlier blog post on version 2.2.

To run spell check on all files in solution you can use the following macro

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module SpellChecker
    Private _outputWindow As OutputWindowPane

    Public Sub SpellCheckSolution()
        _outputWindow = GetOutputWindowPane("HTML Spell Checker")
        _outputWindow.Clear()
        _outputWindow.OutputString("Running spell check on files in the solution..." + vbCrLf)

        For Each project As Project In DTE.Solution.Projects
            ProcessProjectItemCollection(project.ProjectItems)
        Next

        _outputWindow.OutputString("Spell check complete." + vbCrLf)
    End Sub

    Private Sub ProcessProjectItemCollection(ByVal projItemsCollection As ProjectItems)

        For Each pi As ProjectItem In projItemsCollection

            Dim childrenCount = 0
            If Not pi.ProjectItems Is Nothing Then
                childrenCount = pi.ProjectItems.Count
            End If

            If childrenCount = 0 Then
                If pi.Kind = Constants.vsProjectItemKindPhysicalFile And IsKnownFileType(pi.Name) Then
                    Try
                        Dim window As Window
                        Dim opened As Boolean = False

                        If pi.Document Is Nothing Then
                            window = pi.Open(Constants.vsViewKindTextView)
                            'opened = True
                        Else
                            window = pi.Document.ActiveWindow
                            If (window Is Nothing) Then
                                window = pi.Open(Constants.vsViewKindTextView)
                            End If
                        End If

                        window.Visible = True
                        window.Activate()
                        _outputWindow.OutputString(pi.Name + vbCrLf)

                        DTE.ExecuteCommand("Tools.SpellChecker")

                        'If Not window.Caption.Contains("*") And opened = True Then
                        'window.Close()
                        'End If

                    Catch ex As Exception
                        _outputWindow.OutputString("Could not check " + pi.Name + ", exception " + ex.Message + vbCrLf)
                    End Try
                End If
            Else
                ProcessProjectItemCollection(pi.ProjectItems)
            End If
        Next
    End Sub

    Private Function GetOutputWindowPane(ByVal Name As String) As OutputWindowPane
        Dim window As Window
        Dim outputWindow As OutputWindow
        Dim outputWindowPane As OutputWindowPane

        window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
        window.Visible = True
        outputWindow = window.Object
        Try
            outputWindowPane = outputWindow.OutputWindowPanes.Item(Name)
        Catch e As System.Exception
            outputWindowPane = outputWindow.OutputWindowPanes.Add(Name)
        End Try
        outputWindowPane.Activate()
        Return outputWindowPane
    End Function

    Private Function IsKnownFileType(ByVal name As String) As Boolean
        Dim knownExtensions() As String = New String() {".cs", ".vb", "htm", ".html", ".css", ".inc", ".js", ".vbs", _
                                                       ".aspx", ".asp", ".ascx", ".ashx", ".asmx", _
                                                       ".cpp", ".h", ".hpp", ".hxx"}

        For Each ext As String In knownExtensions
            If name.EndsWith(ext) Then
                Return True
            End If
        Next

        Return False
    End Function
End Module

Thanks

Mikhail Arkhipov

Leave a Comment
  • Please add 2 and 7 and type the answer here:
  • Post
  • WOW

    This will help for those who don't have English as mother tong.

  • Bad example showing color as an incorrect word.  There's no u in color as far as the .Net Framework is concerned.

  • AE: color

    BE: colour

    .. which brings up the question: what dictionary is being used? Could one switch between different dictionaries?

  • The outer tag has lang="en-gb", that's UK English :-) Example is correct - control is validated against British English dictionary as specified. Note that outer control is not flagged since it is in default language, i.e. en-us. So everything works as expected, "color" is US spelling and "colour" is UK spelling.

  • And yes, it's all customozable, see extended post on 2.2: http://blogs.msdn.com/webdevtools/archive/2008/11/29/spell-checker-update-2-2-full-support-for-vs-2008-sp1-simpler-setup-and-a-few-bug-fixes.aspx

  • "Fixing misspelled word it may also remove punctuation that immedialy follows it."  Irony?  :)

  • Yep, irony :-) Page was not made in VS though, it's internal blog system editor. Fixed.

  • I am not having enough experience with visual studio, but i have found that very much interesting after reading your post. i will also be checking the spell checker.

Page 1 of 1 (8 items)