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:UsersUSER_NAMEAppDataLocalMicrosoftVisualStudio10.0ExpExtensionsMicrosoftHTMLASP.NET Spell Checker for VS 20102.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.DiagnosticsPublic Module SpellChecker
Private _outputWindow As OutputWindowPanePublic 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 SubPrivate 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 IfIf childrenCount = 0 Then
If pi.Kind = Constants.vsProjectItemKindPhysicalFile And IsKnownFileType(pi.Name) Then
Try
Dim window As Window
Dim opened As Boolean = FalseIf 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 Ifwindow.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 IfCatch 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 SubPrivate Function GetOutputWindowPane(ByVal Name As String) As OutputWindowPane
Dim window As Window
Dim outputWindow As OutputWindow
Dim outputWindowPane As OutputWindowPanewindow = 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 FunctionPrivate 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
NextReturn False
End Function
End Module
Thanks
Mikhail Arkhipov
0 comments