From e52d8ed57d7231494d023d7921465c6a9a4cf3d0 Mon Sep 17 00:00:00 2001 From: EWSoftware Date: Sun, 11 Dec 2022 11:27:42 -0800 Subject: [PATCH] Minor updates - Added support for the content type used by the Markdown Editor v2 extension. Fixes #268 . - Added support for C# 11 raw string literals. Fixes #265. --- .../Content/VersionHistory/VersionHistory.aml | 6 +++ Docs/Content/VersionHistory/v2022.12.11.0.aml | 29 ++++++++++ Docs/Content/VersionHistory/v2022.9.6.0.aml | 2 +- Docs/ContentLayout.content | 9 +++- Docs/VSSpellCheckerDocs.shfbproj | 3 +- .../Classifications.config | 2 +- .../source.extension.vsixmanifest | 2 +- .../source.extension.vsixmanifest | 2 +- .../Properties/AssemblyInfoShared.cs | 6 +-- .../Tagging/CSharp/CSharpCommentTextTagger.cs | 53 ++++++++++++++++--- .../Tagging/CommentTextTagger.cs | 4 +- 11 files changed, 100 insertions(+), 18 deletions(-) create mode 100644 Docs/Content/VersionHistory/v2022.12.11.0.aml diff --git a/Docs/Content/VersionHistory/VersionHistory.aml b/Docs/Content/VersionHistory/VersionHistory.aml index 28b76bc..5f9b58a 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.12.11.0.aml b/Docs/Content/VersionHistory/v2022.12.11.0.aml new file mode 100644 index 0000000..37fe367 --- /dev/null +++ b/Docs/Content/VersionHistory/v2022.12.11.0.aml @@ -0,0 +1,29 @@ + + + + + Changes in this release: + + +
+ + + + + Added support for the content type used by the Markdown Editor v2 extension. + + + + Added support for C# 11 raw string literals. + + + + +
+ + + + + +
+
diff --git a/Docs/Content/VersionHistory/v2022.9.6.0.aml b/Docs/Content/VersionHistory/v2022.9.6.0.aml index 04d4392..cb25277 100644 --- a/Docs/Content/VersionHistory/v2022.9.6.0.aml +++ b/Docs/Content/VersionHistory/v2022.9.6.0.aml @@ -2,7 +2,7 @@ - Changes in this release + Changes in this release:
diff --git a/Docs/ContentLayout.content b/Docs/ContentLayout.content index 8d080ec..703de5d 100644 --- a/Docs/ContentLayout.content +++ b/Docs/ContentLayout.content @@ -153,12 +153,17 @@ - + + + + + + - + diff --git a/Docs/VSSpellCheckerDocs.shfbproj b/Docs/VSSpellCheckerDocs.shfbproj index 7d04683..6015598 100644 --- a/Docs/VSSpellCheckerDocs.shfbproj +++ b/Docs/VSSpellCheckerDocs.shfbproj @@ -65,7 +65,7 @@ - 2022.1.3.0 + 2022.12.11.0 0 ..\Source\ True @@ -201,6 +201,7 @@ + diff --git a/Source/VSSpellChecker2017And2019/Classifications.config b/Source/VSSpellChecker2017And2019/Classifications.config index b1b8981..45eb330 100644 --- a/Source/VSSpellChecker2017And2019/Classifications.config +++ b/Source/VSSpellChecker2017And2019/Classifications.config @@ -22,7 +22,7 @@ - diff --git a/Source/VSSpellChecker2017And2019/source.extension.vsixmanifest b/Source/VSSpellChecker2017And2019/source.extension.vsixmanifest index 5fcada1..f78e636 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 161684e..66b7cc9 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 205cb79..9fd8ac3 100644 --- a/Source/VSSpellCheckerDefinitionsShared/Properties/AssemblyInfoShared.cs +++ b/Source/VSSpellCheckerDefinitionsShared/Properties/AssemblyInfoShared.cs @@ -2,7 +2,7 @@ // System : Visual Studio Spell Checker // File : AssemblyInfoShared.cs // Author : Eric Woodruff (Eric@EWoodruff.us) -// Updated : 09/06/2022 +// Updated : 12/11/2022 // Note : Copyright 2013-2022, Eric Woodruff, All rights reserved // // Visual Studio spell checker common assembly attributes @@ -82,13 +82,13 @@ 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 = "22.9.6.0"; + public const string FileVersion = "22.12.11.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 = "2022.9.6.0"; + public const string ProductVersion = "2022.12.11.0"; // Assembly copyright information public const string Copyright = "Copyright \xA9 2013-2022, Eric Woodruff, All Rights Reserved.\r\n" + diff --git a/Source/VSSpellCheckerShared/Tagging/CSharp/CSharpCommentTextTagger.cs b/Source/VSSpellCheckerShared/Tagging/CSharp/CSharpCommentTextTagger.cs index f4c0ce6..6771e81 100644 --- a/Source/VSSpellCheckerShared/Tagging/CSharp/CSharpCommentTextTagger.cs +++ b/Source/VSSpellCheckerShared/Tagging/CSharp/CSharpCommentTextTagger.cs @@ -2,9 +2,9 @@ // System : Visual Studio Spell Checker Package // File : CSharpCommentTextTagger.cs // Authors : Noah Richards, Roman Golovin, Michael Lehenbauer, Eric Woodruff -// Updated : 07/24/2020 -// Note : Copyright 2010-2020, Microsoft Corporation, All rights reserved -// Portions Copyright 2013-2020, Eric Woodruff, All rights reserved +// Updated : 11/23/2022 +// Note : Copyright 2010-2022, Microsoft Corporation, All rights reserved +// Portions Copyright 2013-2022, Eric Woodruff, All rights reserved // // This file contains a class used to provide tags for C# code // @@ -50,6 +50,8 @@ internal class CSharpCommentTextTagger : ITagger, IDisposable private readonly ITextBuffer buffer; private ITextSnapshot lineCacheSnapshot; private readonly List lineCache; + private string endQuotes; + private int quoteSize; #endregion @@ -384,9 +386,12 @@ private void ScanDefault(LineProgress p) } else if(((p.Char() == '@' || p.Char() == 'R') && p.NextChar() == '"') || (p.Char() == '$' && p.NextChar() == '@' && p.NextNextChar() == '"') || - (p.Char() == '@' && p.NextChar() == '$' && p.NextNextChar() == '"')) // Verbatim, raw, or interpolated verbatim string + (p.Char() == '@' && p.NextChar() == '$' && p.NextNextChar() == '"') || + (p.Char() == '"' && p.NextSegment(3) == "\"\"\"") || + (p.Char() == '$' && p.NextSegment(4) == "$\"\"\"")) // Verbatim, raw, or interpolated verbatim string { // Keep the leading text so that we can handle escape sequences properly + quoteSize = 0; p.State = State.MultiLineString; ScanMultiLineString(p, true); } @@ -635,11 +640,47 @@ private void ScanMultiLineString(LineProgress p, bool isVerbatimString) // For verbatim/raw/interpolated strings, skip the leading format identifier. We keep it so that we // can skip escape sequence checking and properties in them. if(isVerbatimString) - p.Advance((p.NextChar() == '$' || p.NextChar() == '@') ? 3 : 2); + { + if(p.NextSegment(3) == "\"\"\"") + { + while(!p.EndOfLine && p.Char() == '"') + { + quoteSize++; + p.Advance(); + } + + endQuotes = new String('"', quoteSize); + } + else if(p.NextSegment(4) == "$\"\"\"") + { + p.Advance(); + + while(!p.EndOfLine && p.Char() == '"') + { + quoteSize++; + p.Advance(); + } + + endQuotes = new String('"', quoteSize); + } + else + p.Advance((p.NextChar() == '$' || p.NextChar() == '@') ? 3 : 2); + } while(!p.EndOfLine) { - if(p.Char() == '"' && p.NextChar() == '"') // "" is allowed within multi-line string. + if(quoteSize != 0 && p.NextSegment(quoteSize) == endQuotes) + { + // End raw string literal + if(markText) + p.EndNaturalText(); + + p.Advance(quoteSize); + p.State = State.Default; + quoteSize = 0; + return; + } + else if(p.Char() == '"' && p.NextChar() == '"') // "" is allowed within multi-line string. { p.Advance(2); } diff --git a/Source/VSSpellCheckerShared/Tagging/CommentTextTagger.cs b/Source/VSSpellCheckerShared/Tagging/CommentTextTagger.cs index ba36297..dde33bf 100644 --- a/Source/VSSpellCheckerShared/Tagging/CommentTextTagger.cs +++ b/Source/VSSpellCheckerShared/Tagging/CommentTextTagger.cs @@ -2,7 +2,7 @@ // System : Visual Studio Spell Checker Package // File : CommentTextTagger.cs // Authors : Noah Richards, Roman Golovin, Michael Lehenbauer, Eric Woodruff -// Updated : 01/03/2022 +// Updated : 11/23/2022 // Note : Copyright 2010-2022, Microsoft Corporation, All rights reserved // Portions Copyright 2013-2022, Eric Woodruff, All rights reserved // @@ -90,7 +90,7 @@ public ITagger CreateTagger(ITextBuffer buffer) where T : ITag return null; // Markdown has its own tagger - if(buffer.ContentType.IsOfType("Markdown")) + if(buffer.ContentType.IsOfType("Markdown") || buffer.ContentType.IsOfType("code++.Markdown")) return new MarkdownTextTagger(buffer, classifierAggregatorService.GetClassifier(buffer), config.IgnoredClassificationsFor(buffer.ContentType.TypeName)) as ITagger;