From 88a0fab6958500dc4472da3104394a7944a56f8f Mon Sep 17 00:00:00 2001 From: EWSoftware Date: Mon, 3 Jan 2022 11:45:57 -0800 Subject: [PATCH] Minor fixes - Added a separate solution/project classifier for .tsx and .jsx files. These are also handled by the general tagger now in the editor to account for the mix of code and HTML. Fixes #237. - Added the Razor content type to the HTML tagger. Fixes #251. - Made several changes to the solution/project spell checking code to avoid responsiveness issues in Visual Studio caused by garbage collections triggered by the code in prior releases. Fixes #244. May also fix #236. --- Docs/Content/ClassifierDefinition.aml | 7 + Docs/Content/CustomDictionaries.aml | 22 +- Docs/Content/Installation.aml | 6 +- .../Content/VersionHistory/VersionHistory.aml | 6 + Docs/Content/VersionHistory/v2022.1.3.0.aml | 48 +++ Docs/ContentLayout.content | 7 +- Docs/VSSpellCheckerDocs.shfbproj | 7 +- LICENSE | 8 +- .../Classifications.config | 17 +- Source/VSSpellChecker2017And2019/License.rtf | 30 +- .../source.extension.vsixmanifest | 2 +- .../source.extension.vsixmanifest | 2 +- .../Properties/AssemblyInfoShared.cs | 12 +- .../ProjectSpellCheck/ClassifierFactory.cs | 8 +- .../ScriptWithHtmlClassifier.cs | 231 ++++++++++++++ .../ProjectSpellCheck/SpellCheckFileInfo.cs | 292 +++++++++--------- .../Tagging/CommentTextTagger.cs | 32 +- .../Tagging/HtmlTextTagger.cs | 21 +- .../SolutionProjectSpellCheckControl.xaml.cs | 12 +- .../VSSpellCheckerShared.projitems | 3 +- 20 files changed, 556 insertions(+), 217 deletions(-) create mode 100644 Docs/Content/VersionHistory/v2022.1.3.0.aml create mode 100644 Source/VSSpellCheckerShared/ProjectSpellCheck/ScriptWithHtmlClassifier.cs diff --git a/Docs/Content/ClassifierDefinition.aml b/Docs/Content/ClassifierDefinition.aml index 08550a0..94f3d49 100644 --- a/Docs/Content/ClassifierDefinition.aml +++ b/Docs/Content/ClassifierDefinition.aml @@ -73,6 +73,13 @@ Such undefined spans are removed from other classified spans to reduce the numbe from the removed spans. + + ScriptWithHtmlClassifier - This classifier is similar to the +CodeClassifier described above but is specific to JavaScript and TypeScript files that +contain embedded HTML elements. It will parse the code and also the HTML elements to include the wanted HTML +element parts such as inner text and exclude the unwanted HTML elements parts such as ignored attribute values. + + RegexClassifier - This is a general classifier that uses a series of regular expressions to classify file content as code comments or string literals. This is useful for non-code diff --git a/Docs/Content/CustomDictionaries.aml b/Docs/Content/CustomDictionaries.aml index 73f8181..63fecfd 100644 --- a/Docs/Content/CustomDictionaries.aml +++ b/Docs/Content/CustomDictionaries.aml @@ -4,7 +4,8 @@ The package uses NHunspell to perform spell checking and comes with several dictionaries for various languages. Since NHunspell makes use of Open Office dictionaries, you can download additional dictionaries for -other languages. To make them available to the spell checker, do the following: +other languages. Dictionaries for OpenOffice versions 2, 3, and 4 are supported. To make them available to the +spell checker, do the following: @@ -17,18 +18,19 @@ other languages. To make them available to the spell checker, do the following: Search for OpenOffice dictionaries http://extensions.services.openoffice.org/dictionary _blank - and download the dictionaries for the languages you need. Dictionaries for OpenOffice versions -2, 3, and 4 are supported. + and download the dictionaries for the languages you need. If the downloaded file has a +.oxt extension, rename it to have a .zip extension. Extract the +content of the file and locate the .aff and .dic dictionary files. - If the downloaded file has a .oxt extension, rename it to have a -.zip extension. - - - - Extract the content of the file and locate the .aff and -.dic dictionary files. + Another source for Open Office dictionaries is the + LibreOffice dictionary repository + LibreOffice dictionary repository + http://extensions.services.openoffice.org/dictionary + _blank + . Locate the language you want to use and download the .aff and +.dic dictionary files for it. diff --git a/Docs/Content/Installation.aml b/Docs/Content/Installation.aml index a32b320..9c95c55 100644 --- a/Docs/Content/Installation.aml +++ b/Docs/Content/Installation.aml @@ -36,11 +36,15 @@ them. Visual Studio 2013/2015 https://marketplace.visualstudio.com/items?itemName=EWoodruff.VisualStudioSpellChecker _blank - and +, Visual Studio 2017/2019 https://marketplace.visualstudio.com/items?itemName=EWoodruff.VisualStudioSpellCheckerVS2017andLater _blank +, and +Visual Studio 2022 and Later +https://marketplace.visualstudio.com/items?itemName=EWoodruff.VisualStudioSpellCheckerVS2022andLater +_blank ) using the Tools | Extension and Updates option (Visual Studio 2017) or Extensions | Manage Extensions option (Visual Studio 2019 or later). Select the online marketplace and search for "Visual Studio Spell Checker". Include the quote marks for an exact match and find the one created by diff --git a/Docs/Content/VersionHistory/VersionHistory.aml b/Docs/Content/VersionHistory/VersionHistory.aml index 3cef51f..76f17bf 100644 --- a/Docs/Content/VersionHistory/VersionHistory.aml +++ b/Docs/Content/VersionHistory/VersionHistory.aml @@ -9,6 +9,12 @@ project. Select a version below to see a description of its changes.
+ + + + + + diff --git a/Docs/Content/VersionHistory/v2022.1.3.0.aml b/Docs/Content/VersionHistory/v2022.1.3.0.aml new file mode 100644 index 0000000..8c3ce50 --- /dev/null +++ b/Docs/Content/VersionHistory/v2022.1.3.0.aml @@ -0,0 +1,48 @@ + + + + + Changes in this release: + + +
+ + + + Added support for Visual Studio 2022 in July 2021. Since it was the only change, no +help update was published for that release. + + + + Added .tsx as a recognized file extension for solution/project spell +checking. Both it and .jsx files are now handled by their own parser that takes into +account HTML elements that may be embedded in the code for spell checking. Because of the mix of code an HTML, +those two file types are now handled by the general tagger in the editor rather than the C# tagger. As such, the +C-style configuration options are not applied to those file types anymore. + + + + Added a case to the general tagger to ignore the text classification +for Python files when the Python workload is installed. When it is, the classifier for Python files flags many +elements as text even when they are not (variables etc.) + + + + Updated the HTML tagger so that it is used for Razor file content. + + + + Made several changes to the solution/project spell checking code to avoid responsiveness issues +in Visual Studio caused by garbage collections triggered by the code in prior releases. + + + + +
+ + + + + +
+
diff --git a/Docs/ContentLayout.content b/Docs/ContentLayout.content index 2e7063d..031cb74 100644 --- a/Docs/ContentLayout.content +++ b/Docs/ContentLayout.content @@ -153,12 +153,17 @@ + + + + + - + diff --git a/Docs/VSSpellCheckerDocs.shfbproj b/Docs/VSSpellCheckerDocs.shfbproj index 5fec750..66df430 100644 --- a/Docs/VSSpellCheckerDocs.shfbproj +++ b/Docs/VSSpellCheckerDocs.shfbproj @@ -41,7 +41,7 @@ Guid Visual Studio Spell Checker Documentation Eric%40EWoodruff.us - Copyright \xA9 2013-2021, Eric Woodruff, All rights reserved + Copyright \xA9 2013-2022, Eric Woodruff, All rights reserved https://GitHub.com/EWSoftware/VSSpellChecker AboveNamespaces @@ -49,7 +49,7 @@ - 2021.3.1.0 + 2022.1.3.0 0 ..\Source\ True @@ -184,6 +184,7 @@ + @@ -217,4 +218,4 @@ - + \ No newline at end of file diff --git a/LICENSE b/LICENSE index 40c510e..efc3161 100644 --- a/LICENSE +++ b/LICENSE @@ -65,15 +65,15 @@ Copyright Notices ----------------- The core Visual Studio package code related to the spell checker implementation was originally written by Noah Richards, Roman Golovin, and Michael Lehenbauer -and is Copyright (c) 2010-2021 Microsoft Corporation, All Rights Reserved. +and is Copyright (c) 2010-2022 Microsoft Corporation, All Rights Reserved. -The NHunspell library is Copyright (c) 2009-2021 Maierhofer Software, +The NHunspell library is Copyright (c) 2009-2022 Maierhofer Software, All Rights Reserved. -The HTML Agility Pack is Copyright (c) 2006-2021 Simon Mourier, All Rights +The HTML Agility Pack is Copyright (c) 2006-2022 Simon Mourier, All Rights Reserved. -All other code is Copyright (c) 2013-2021 Eric Woodruff, All Rights Reserved. +All other code is Copyright (c) 2013-2022 Eric Woodruff, All Rights Reserved. All dictionaries supplied with the package are property of their respective copyright holders. See the README files in the dictionary folder at the project diff --git a/Source/VSSpellChecker2017And2019/Classifications.config b/Source/VSSpellChecker2017And2019/Classifications.config index b9c482d..b1b8981 100644 --- a/Source/VSSpellChecker2017And2019/Classifications.config +++ b/Source/VSSpellChecker2017And2019/Classifications.config @@ -39,6 +39,18 @@ + + + + + + + + + @@ -211,9 +223,10 @@ - - + + + diff --git a/Source/VSSpellChecker2017And2019/License.rtf b/Source/VSSpellChecker2017And2019/License.rtf index 5879f0f..a47856c 100644 --- a/Source/VSSpellChecker2017And2019/License.rtf +++ b/Source/VSSpellChecker2017And2019/License.rtf @@ -38,10 +38,10 @@ \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1 \widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe1033\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf19 \sbasedon10 \sunhideused \styrsid11434769 Hyperlink;}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \cf20\chshdng0\chcfpat0\chcbpat21 -\sbasedon10 \ssemihidden \sunhideused \styrsid11434769 Unresolved Mention;}{\*\cs17 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf22 \sbasedon10 \ssemihidden \sunhideused \styrsid6572198 FollowedHyperlink;}}{\*\rsidtbl \rsid2829919\rsid5722927\rsid6572198 -\rsid7425990\rsid8406335\rsid10952994\rsid11434769\rsid12920148\rsid13042251\rsid13172878}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Eric Woodruff} -{\creatim\yr2019\mo4\dy14\hr13\min31}{\revtim\yr2021\mo11\dy14\hr15\min4}{\version9}{\edmins4}{\nofpages2}{\nofwords514}{\nofchars2935}{\nofcharsws3443}{\vern35}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}} -\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect +\sbasedon10 \ssemihidden \sunhideused \styrsid11434769 Unresolved Mention;}{\*\cs17 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf22 \sbasedon10 \ssemihidden \sunhideused \styrsid6572198 FollowedHyperlink;}}{\*\rsidtbl \rsid2829919\rsid5722927\rsid5969227 +\rsid6572198\rsid7425990\rsid8406335\rsid8610764\rsid10952994\rsid11434769\rsid12920148\rsid13042251\rsid13172878}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info +{\operator Eric Woodruff}{\creatim\yr2019\mo4\dy14\hr13\min31}{\revtim\yr2022\mo1\dy3\hr11\min32}{\version10}{\edmins4}{\nofpages2}{\nofwords514}{\nofchars2936}{\nofcharsws3444}{\vern39}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/ +wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect \widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701 \dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale115\rsidroot13042251 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2 \pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6 @@ -74,19 +74,21 @@ conditions. You may have additional consumer rights under your local laws which \par }{\rtlch\fcs1 \ab\af1\afs18 \ltrch\fcs0 \b\f1\fs18\ul\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Copyright Notices}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \par \hich\af1\dbch\af31505\loch\f1 The core Visual Studio package code related to the spell checker implementation was originally written by Noah Richards, Roman Golovin, and Michael Lehenbauer and}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13042251 \hich\af1\dbch\af31505\loch\f1 is Copyright (c) 2010-20}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid12920148 \hich\af1\dbch\af31505\loch\f1 2}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid8406335 \hich\af1\dbch\af31505\loch\f1 1}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Microsoft Corporation, All +\ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid5969227 \hich\af1\dbch\af31505\loch\f1 2}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Microsoft Corporation, All \hich\af1\dbch\af31505\loch\f1 Rights Reserved. \par \hich\af1\dbch\af31505\loch\f1 The NHunspell library is Copyright (c) 2009-20}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid12920148 \hich\af1\dbch\af31505\loch\f1 2}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\lang9\langfe1033\langnp9\insrsid8406335 \hich\af1\dbch\af31505\loch\f1 1}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Maierhofer Software, All Rights Reserved. +\f1\fs18\lang9\langfe1033\langnp9\insrsid5969227 \hich\af1\dbch\af31505\loch\f1 2}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Maierhofer Software, All Rights Reserved. \par \hich\af1\dbch\af31505\loch\f1 All other}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid12920148 \hich\af1\dbch\af31505\loch\f1 code is Copyright (c) 2013-202}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\lang9\langfe1033\langnp9\insrsid8406335 \hich\af1\dbch\af31505\loch\f1 1}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Eric Woodruff, All Rights Reserved. +\f1\fs18\lang9\langfe1033\langnp9\insrsid5969227 \hich\af1\dbch\af31505\loch\f1 2}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid13172878 \hich\af1\dbch\af31505\loch\f1 Eric Woodruff, All Rights Reserved. \par \hich\af1\dbch\af31505\loch\f1 All dictionaries supplied with the package are property of their resp\hich\af1\dbch\af31505\loch\f1 ective copyright holders. See the README files in the dictionary folder at the project site for details and licensing terms:}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid11434769 -\par }{\field{\*\fldinst {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid7425990 \hich\af1\dbch\af31505\loch\f1 \hich\af1\dbch\af31505\loch\f1 HYPERLIN\hich\af1\dbch\af31505\loch\f1 K \hich\af1\dbch\af31505\loch\f1 "}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid7425990\charrsid7425990 \hich\af1\dbch\af31505\loch\f1 https://github.com/EWSoftware/VSSpellChecker/tree/master/Source/VSSpellChecker2017And2019/NHunspell}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\lang9\langfe1033\langnp9\insrsid7425990 \hich\af1\dbch\af31505\loch\f1 "\hich\af1\dbch\af31505\loch\f1 }}{\fldrslt {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \cs15\f1\fs18\ul\cf19\lang9\langfe1033\langnp9\insrsid7425990\charrsid8610764 -\hich\af1\dbch\af31505\loch\f1 https://github.com/EWSoftware/VSSpellChecker/tree/master/Source/VSSpellChecker2017And2019/NHunspell}}}\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\lang9\langfe1033\langnp9\insrsid5722927 +\par }{\field{\*\fldinst {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid7425990 \hich\af1\dbch\af31505\loch\f1 HYPERLINK "}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid7425990\charrsid7425990 +\hich\af1\dbch\af31505\loch\f1 https://github.com/EWSoftware/VSSpellChecker/tree/master/Source/VSSpellChecker2017And2019/NHunspell}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid7425990 \hich\af1\dbch\af31505\loch\f1 " }{ +\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid5969227 {\*\datafield +00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90be0000000680074007400700073003a002f002f006700690074006800750062002e0063006f006d002f004500570053006f006600740077006100720065002f00560053005300700065006c006c004300680065006300 +6b00650072002f0074007200650065002f006d00610073007400650072002f0053006f0075007200630065002f00560053005300700065006c006c0043006800650063006b0065007200320030003100370041006e00640032003000310039002f004e00480075006e007300700065006c006c000000795881f43b1d7f48af +2c825dc485276300000000a5ab0003}}}{\fldrslt {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \cs15\f1\fs18\ul\cf19\lang9\langfe1033\langnp9\insrsid7425990\charrsid8610764 \hich\af1\dbch\af31505\loch\f1 https://github.co\hich\af1\dbch\af31505\loch\f1 +m/EWSoftware/VSSpellChecker/tree/master/Source/VSSpellChecker2017And2019/NHunspell}}}\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid5722927 \par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid7425990 \par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang9\langfe1033\langnp9\insrsid5722927 \par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a @@ -229,8 +231,8 @@ fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000008e -32feabd9d701feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000050db +59aed800d801feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/Source/VSSpellChecker2017And2019/source.extension.vsixmanifest b/Source/VSSpellChecker2017And2019/source.extension.vsixmanifest index 65d3d1d..eb1e40c 100644 --- a/Source/VSSpellChecker2017And2019/source.extension.vsixmanifest +++ b/Source/VSSpellChecker2017And2019/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Visual Studio Spell Checker (VS2017 and VS2019) An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with a tool window. It can also spell check an entire solution, project, or selected items. Options are available to define multiple languages to spell check against, define ignored words, control how elements and attributes in XML and MAML files are spell checked, and much more. https://ewsoftware.github.io/VSSpellChecker diff --git a/Source/VSSpellChecker2022AndLater/source.extension.vsixmanifest b/Source/VSSpellChecker2022AndLater/source.extension.vsixmanifest index 318fdd5..2c21a4c 100644 --- a/Source/VSSpellChecker2022AndLater/source.extension.vsixmanifest +++ b/Source/VSSpellChecker2022AndLater/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Visual Studio Spell Checker (VS2022 and Later) An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with a tool window. It can also spell check an entire solution, project, or selected items. Options are available to define multiple languages to spell check against, define ignored words, control how elements and attributes in XML and MAML files are spell checked, and much more. https://ewsoftware.github.io/VSSpellChecker diff --git a/Source/VSSpellCheckerDefinitionsShared/Properties/AssemblyInfoShared.cs b/Source/VSSpellCheckerDefinitionsShared/Properties/AssemblyInfoShared.cs index 88b4d40..7820d15 100644 --- a/Source/VSSpellCheckerDefinitionsShared/Properties/AssemblyInfoShared.cs +++ b/Source/VSSpellCheckerDefinitionsShared/Properties/AssemblyInfoShared.cs @@ -2,8 +2,8 @@ // System : Visual Studio Spell Checker // File : AssemblyInfoShared.cs // Author : Eric Woodruff (Eric@EWoodruff.us) -// Updated : 07/27/2021 -// Note : Copyright 2013-2021, Eric Woodruff, All rights reserved +// Updated : 01/03/2022 +// Note : Copyright 2013-2022, Eric Woodruff, All rights reserved // // Visual Studio spell checker common assembly attributes // @@ -82,15 +82,15 @@ internal static partial class AssemblyInfo // // This is used to set the assembly file version. This will change with each new release. MSIs only // support a Major value between 0 and 255 so we drop the century from the year on this one. - public const string FileVersion = "21.7.27.0"; + public const string FileVersion = "22.1.3.0"; // Common product version // // This may contain additional text to indicate Alpha or Beta states. The version number will always match // the file version above but includes the century on the year. - public const string ProductVersion = "2021.7.27.0"; + public const string ProductVersion = "2022.1.3.0"; // Assembly copyright information - public const string Copyright = "Copyright \xA9 2013-2021, Eric Woodruff, All Rights Reserved.\r\n" + - "Portions Copyright \xA9 2010-2021, Microsoft Corporation, All Rights Reserved."; + public const string Copyright = "Copyright \xA9 2013-2022, Eric Woodruff, All Rights Reserved.\r\n" + + "Portions Copyright \xA9 2010-2022, Microsoft Corporation, All Rights Reserved."; } diff --git a/Source/VSSpellCheckerShared/ProjectSpellCheck/ClassifierFactory.cs b/Source/VSSpellCheckerShared/ProjectSpellCheck/ClassifierFactory.cs index fe3ec54..980e4fa 100644 --- a/Source/VSSpellCheckerShared/ProjectSpellCheck/ClassifierFactory.cs +++ b/Source/VSSpellCheckerShared/ProjectSpellCheck/ClassifierFactory.cs @@ -2,8 +2,8 @@ // System : Visual Studio Spell Checker Package // File : ClassifierFactory.cs // Author : Eric Woodruff (Eric@EWoodruff.us) -// Updated : 07/24/2020 -// Note : Copyright 2015-2020, Eric Woodruff, All rights reserved +// Updated : 12/29/2021 +// Note : Copyright 2015-2021, Eric Woodruff, All rights reserved // // This file contains a class used to generate classifiers for files that need to be spell checked // @@ -268,6 +268,10 @@ public static TextClassifier GetClassifier(string filename, SpellCheckerConfigur classifier = new RegexClassifier(filename, spellCheckConfiguration, definition.Configuration); break; + case "ScriptWithHtmlClassifier": + classifier = new ScriptWithHtmlClassifier(filename, spellCheckConfiguration, definition.Configuration); + break; + default: break; } diff --git a/Source/VSSpellCheckerShared/ProjectSpellCheck/ScriptWithHtmlClassifier.cs b/Source/VSSpellCheckerShared/ProjectSpellCheck/ScriptWithHtmlClassifier.cs new file mode 100644 index 0000000..4739043 --- /dev/null +++ b/Source/VSSpellCheckerShared/ProjectSpellCheck/ScriptWithHtmlClassifier.cs @@ -0,0 +1,231 @@ +//=============================================================================================================== +// System : Visual Studio Spell Checker Package +// File : ScriptWithHtmlClassifier.cs +// Author : Eric Woodruff (Eric@EWoodruff.us) +// Updated : 12/29/2021 +// Note : Copyright 2021, Eric Woodruff, All rights reserved +// +// This file contains a class used to classify script files with a mix of code and HTML +// +// This code is published under the Microsoft Public License (Ms-PL). A copy of the license should be +// distributed with the code and can be found at the project website: https://github.com/EWSoftware/VSSpellChecker +// This notice, the author's name, and all copyright notices must remain intact in all applications, +// documentation, and source files. +// +// Date Who Comments +// ============================================================================================================== +// 12/29/2021 EFW Created the code +//=============================================================================================================== + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; + +using HtmlAgilityPack; + +using Microsoft.VisualStudio.Text; + +using VisualStudio.SpellChecker.Configuration; + +namespace VisualStudio.SpellChecker.ProjectSpellCheck +{ + /// + /// This class is used to classify source code file content using a set of regular expressions. In addition, + /// it further classifies literal string types and XML documentation comments. + /// + /// This should work for pretty much any type of source code. The configuration options can be + /// varied based on the language. + internal class ScriptWithHtmlClassifier : CodeClassifier + { + #region Private data members + //===================================================================== + + #endregion + + #region Constructor + //===================================================================== + + /// + /// Constructor + /// + /// The filename to load + /// The spell checker configuration for the file + /// The configuration element containing the classification + /// expressions and their range types. + public ScriptWithHtmlClassifier(string filename, SpellCheckerConfiguration spellCheckConfiguration, + XElement classifierConfiguration) : base(filename, spellCheckConfiguration, classifierConfiguration) + { + } + #endregion + + #region Method overrides + //===================================================================== + + /// + /// This classifier will ignore elements classified as undefined and append those elements + /// classified as HTML that are wanted. + public override IEnumerable Parse() + { + var spans = base.Parse().ToList(); + + // Parse as HTML and exclude the parts we don't want based on the results + HtmlDocument doc = new HtmlDocument(); + doc.LoadHtml(this.Text); + + var htmlSpans = new List(); + + this.ParseNode(doc.DocumentNode, htmlSpans); + + // If an HTML span is classified as undefined, exclude any code spans that fall within it. If an + // HTML span is not undefined but is covered by a code span, keep the code span and exclude the HTML + // span. + foreach(var html in htmlSpans) + { + foreach(var code in spans) + { + if(code.Span.IntersectsWith(html.Span)) + { + if(html.Classification == RangeClassification.Undefined) + code.Classification = RangeClassification.Undefined; + else + html.Classification = RangeClassification.Undefined; + } + } + } + + return spans.Concat(htmlSpans).Where(s => s.Classification != RangeClassification.Undefined); + } + #endregion + + #region Helper methods + //===================================================================== + + /// + /// Parse HTML in the file and return spans based on the settings. These spans may be ignored or + /// included in the results. + /// + /// The starting node + /// The list to which spell check spans are added + private void ParseNode(HtmlNode node, List spans) + { + switch(node.NodeType) + { + case HtmlNodeType.Document: + foreach(HtmlNode subnode in node.ChildNodes) + this.ParseNode(subnode, spans); + break; + + case HtmlNodeType.Comment: + var commentNode = (HtmlCommentNode)node; + + // Only spell check actual comments. Stuff like "" is also classified as a comment + // by the node parser but we don't want to include them. + if(commentNode.OuterHtml.StartsWith("