From dbb420309a5d75d0923cd5e30b40268f8171d7dc Mon Sep 17 00:00:00 2001 From: Mads Kristensen Date: Mon, 27 Dec 2021 06:43:33 -0800 Subject: [PATCH] Refactored the project [release] --- ...er.cs => TokenClassificationTaggerBase.cs} | 2 +- ...rBaseTagger.cs => TokenErrorTaggerBase.cs} | 2 +- ...eTagger.cs => TokenOutliningTaggerBase.cs} | 2 +- src/Language/BasicLanguageFeatures.cs | 49 ----------------- ...nLanguageFeatures.cs => EditorFeatures.cs} | 54 ++++++++++++++----- ...etionSourceProvider.cs => IntelliSense.cs} | 2 +- src/PkgdefLanguage.csproj | 11 ++-- 7 files changed, 51 insertions(+), 71 deletions(-) rename src/BaseClasses/{TokenClassificationBaseTagger.cs => TokenClassificationTaggerBase.cs} (96%) rename src/BaseClasses/{TokenErrorBaseTagger.cs => TokenErrorTaggerBase.cs} (95%) rename src/BaseClasses/{TokenOutliningBaseTagger.cs => TokenOutliningTaggerBase.cs} (96%) delete mode 100644 src/Language/BasicLanguageFeatures.cs rename src/Language/{TokenLanguageFeatures.cs => EditorFeatures.cs} (53%) rename src/Language/{AsyncCompletionSourceProvider.cs => IntelliSense.cs} (98%) diff --git a/src/BaseClasses/TokenClassificationBaseTagger.cs b/src/BaseClasses/TokenClassificationTaggerBase.cs similarity index 96% rename from src/BaseClasses/TokenClassificationBaseTagger.cs rename to src/BaseClasses/TokenClassificationTaggerBase.cs index e950fa3..e06e37b 100644 --- a/src/BaseClasses/TokenClassificationBaseTagger.cs +++ b/src/BaseClasses/TokenClassificationTaggerBase.cs @@ -6,7 +6,7 @@ namespace BaseClasses { - public abstract class TokenClassificationBaseTagger : ITaggerProvider + public abstract class TokenClassificationTaggerBase : ITaggerProvider { [Import] internal IClassificationTypeRegistryService _classificationRegistry = null; [Import] internal IBufferTagAggregatorFactoryService _bufferTagAggregator = null; diff --git a/src/BaseClasses/TokenErrorBaseTagger.cs b/src/BaseClasses/TokenErrorTaggerBase.cs similarity index 95% rename from src/BaseClasses/TokenErrorBaseTagger.cs rename to src/BaseClasses/TokenErrorTaggerBase.cs index c9a16a1..a1dc716 100644 --- a/src/BaseClasses/TokenErrorBaseTagger.cs +++ b/src/BaseClasses/TokenErrorTaggerBase.cs @@ -7,7 +7,7 @@ namespace BaseClasses { - public abstract class TokenErrorBaseTagger : ITaggerProvider + public abstract class TokenErrorTaggerBase : ITaggerProvider { [Import] internal IBufferTagAggregatorFactoryService _bufferTagAggregator = null; diff --git a/src/BaseClasses/TokenOutliningBaseTagger.cs b/src/BaseClasses/TokenOutliningTaggerBase.cs similarity index 96% rename from src/BaseClasses/TokenOutliningBaseTagger.cs rename to src/BaseClasses/TokenOutliningTaggerBase.cs index 21140e2..cfeb110 100644 --- a/src/BaseClasses/TokenOutliningBaseTagger.cs +++ b/src/BaseClasses/TokenOutliningTaggerBase.cs @@ -6,7 +6,7 @@ namespace BaseClasses { - public abstract class TokenOutliningBaseTagger : ITaggerProvider + public abstract class TokenOutliningTaggerBase : ITaggerProvider { [Import] internal IBufferTagAggregatorFactoryService _bufferTagAggregator = null; diff --git a/src/Language/BasicLanguageFeatures.cs b/src/Language/BasicLanguageFeatures.cs deleted file mode 100644 index 9b62bb4..0000000 --- a/src/Language/BasicLanguageFeatures.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.Composition; -using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; -using Microsoft.VisualStudio.Text.BraceCompletion; -using Microsoft.VisualStudio.Text.Tagging; -using Microsoft.VisualStudio.Utilities; - -namespace PkgdefLanguage -{ - [Export(typeof(IBraceCompletionContextProvider))] - [BracePair('(', ')')] - [BracePair('[', ']')] - [BracePair('{', '}')] - [BracePair('"', '"')] - [BracePair('$', '$')] - [ContentType(Constants.LanguageName)] - [Name(Constants.LanguageName)] - [ProvideBraceCompletion(Constants.LanguageName)] - internal sealed class BraceCompletion : BraceCompletionBase - { - // This is a default implementation of basic brace matching. - } - - [Export(typeof(IViewTaggerProvider))] - [TagType(typeof(TextMarkerTag))] - [ContentType(Constants.LanguageName)] - [Name(Constants.LanguageName)] - internal sealed class BraceMatchingTaggerProvider : BraceMatchingBase - { - // This will match parenthesis, curly brackets, and square brackets by default. - // Override the BraceList property to modify the list of braces to match. - } - - [Export(typeof(IAsyncCompletionCommitManagerProvider))] - [ContentType(Constants.LanguageName)] - [Name(Constants.LanguageName)] - internal sealed class CompletionCommitManager : CompletionCommitManagerBase - { - public override IEnumerable CommitChars => new char[] { ' ', '\'', '"', ',', '.', ';', ':', '\\' }; - } - - [Export(typeof(IViewTaggerProvider))] - [ContentType(Constants.LanguageName)] - [TagType(typeof(TextMarkerTag))] - public class SameWordHighlighter : SameWordHighlighterBase - { - // This is a default implementation of same word highlighting - } -} diff --git a/src/Language/TokenLanguageFeatures.cs b/src/Language/EditorFeatures.cs similarity index 53% rename from src/Language/TokenLanguageFeatures.cs rename to src/Language/EditorFeatures.cs index 0db2868..dc653ca 100644 --- a/src/Language/TokenLanguageFeatures.cs +++ b/src/Language/EditorFeatures.cs @@ -2,7 +2,9 @@ using System.ComponentModel.Composition; using BaseClasses; using Microsoft.VisualStudio.Language.Intellisense; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; using Microsoft.VisualStudio.Language.StandardClassification; +using Microsoft.VisualStudio.Text.BraceCompletion; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Tagging; using Microsoft.VisualStudio.Utilities; @@ -13,7 +15,7 @@ namespace PkgdefLanguage [TagType(typeof(IClassificationTag))] [ContentType(Constants.LanguageName)] [Name(Constants.LanguageName)] - public class SyntaxHighligting : TokenClassificationBaseTagger + public class SyntaxHighligting : TokenClassificationTaggerBase { public override Dictionary ClassificationMap { get; } = new() { @@ -30,34 +32,62 @@ public class SyntaxHighligting : TokenClassificationBaseTagger [TagType(typeof(IStructureTag))] [ContentType(Constants.LanguageName)] [Name(Constants.LanguageName)] - public class Outlining : TokenOutliningBaseTagger - { - // Adds outlining support based on the TokenTag.SupportsOutlining property. - } + public class Outlining : TokenOutliningTaggerBase + { } [Export(typeof(ITaggerProvider))] [TagType(typeof(IErrorTag))] [ContentType(Constants.LanguageName)] [Name(Constants.LanguageName)] - public class ErrorSquigglies : TokenErrorBaseTagger - { - - } + public class ErrorSquigglies : TokenErrorTaggerBase + { } [Export(typeof(IWpfTextViewCreationListener))] [ContentType(Constants.LanguageName)] [Name(Constants.LanguageName)] [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] internal sealed class ErrorList : TokenErrorListBase - { - - } + { } [Export(typeof(IAsyncQuickInfoSourceProvider))] [ContentType(Constants.LanguageName)] [Name(Constants.LanguageName)] internal sealed class Tooltips : TokenQuickInfoBase + { } + + [Export(typeof(IBraceCompletionContextProvider))] + [BracePair('(', ')')] + [BracePair('[', ']')] + [BracePair('{', '}')] + [BracePair('"', '"')] + [BracePair('$', '$')] + [ContentType(Constants.LanguageName)] + [Name(Constants.LanguageName)] + [ProvideBraceCompletion(Constants.LanguageName)] + internal sealed class BraceCompletion : BraceCompletionBase + { } + + [Export(typeof(IAsyncCompletionCommitManagerProvider))] + [ContentType(Constants.LanguageName)] + [Name(Constants.LanguageName)] + internal sealed class CompletionCommitManager : CompletionCommitManagerBase { + public override IEnumerable CommitChars => new char[] { ' ', '\'', '"', ',', '.', ';', ':', '\\', '$' }; + } + [Export(typeof(IViewTaggerProvider))] + [TagType(typeof(TextMarkerTag))] + [ContentType(Constants.LanguageName)] + [Name(Constants.LanguageName)] + internal sealed class BraceMatchingTaggerProvider : BraceMatchingBase + { + // This will match parenthesis, curly brackets, and square brackets by default. + // Override the BraceList property to modify the list of braces to match. } + + [Export(typeof(IViewTaggerProvider))] + [ContentType(Constants.LanguageName)] + [TagType(typeof(TextMarkerTag))] + public class SameWordHighlighter : SameWordHighlighterBase + { } } diff --git a/src/Language/AsyncCompletionSourceProvider.cs b/src/Language/IntelliSense.cs similarity index 98% rename from src/Language/AsyncCompletionSourceProvider.cs rename to src/Language/IntelliSense.cs index 84fcfe4..4aaf09b 100644 --- a/src/Language/AsyncCompletionSourceProvider.cs +++ b/src/Language/IntelliSense.cs @@ -22,7 +22,7 @@ namespace PkgdefLanguage [Export(typeof(IAsyncCompletionSourceProvider))] [ContentType(Constants.LanguageName)] [Name(Constants.LanguageName)] - public class AsyncCompletionSourceProvider : IAsyncCompletionSourceProvider + public class IntelliSense : IAsyncCompletionSourceProvider { public IAsyncCompletionSource GetOrCreate(ITextView textView) => textView.Properties.GetOrCreateSingletonProperty(() => new AsyncCompletionSource()); diff --git a/src/PkgdefLanguage.csproj b/src/PkgdefLanguage.csproj index fc768f3..3133de3 100644 --- a/src/PkgdefLanguage.csproj +++ b/src/PkgdefLanguage.csproj @@ -83,7 +83,6 @@ - @@ -91,13 +90,13 @@ - - - - + + + + - +