From 1097a1bcf186c9a0509ad42aba3daadbe67c66b1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 27 Jul 2015 16:58:36 -0700 Subject: [PATCH] Rename method. Make it clearer that a method is for testing only. --- .../BraceMatching/InteractiveBraceHighlightingTests.cs | 2 +- .../SemanticClassificationTaggerProvider.cs | 2 +- .../ReferenceHighlightingViewTaggerProvider.cs | 2 +- .../Tagging/AbstractAsynchronousTaggerProvider.Tagger.cs | 4 ++-- .../Core/Tagging/AbstractAsynchronousTaggerProvider.cs | 8 ++++++-- .../BraceHighlighting/AbstractBraceHighlightingTests.cs | 2 +- src/EditorFeatures/Test/Outlining/OutliningTaggerTests.cs | 2 +- .../AbstractKeywordHighlightingTests.vb | 2 +- .../AbstractReferenceHighlightingTests.vb | 2 +- .../BraceMatching/BraceHighlightingTests.vb | 2 +- 10 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs b/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs index d3128947411..92edfc12411 100644 --- a/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs +++ b/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs @@ -42,7 +42,7 @@ private IEnumerable Enumerable(params T[] array) var context = new TaggerContext( buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault(), buffer.CurrentSnapshot, new SnapshotPoint(buffer.CurrentSnapshot, position)); - producer.ProduceTagsAsync(context).Wait(); + producer.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait(); return context.tagSpans; } diff --git a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationTaggerProvider.cs index ebe43151da1..55192b1ffd3 100644 --- a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationTaggerProvider.cs @@ -65,7 +65,7 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer, TaggerDelay.Short)); } - protected internal override async Task ProduceTagsAsync(TaggerContext context) + protected override async Task ProduceTagsAsync(TaggerContext context) { Debug.Assert(context.SpansToTag.IsSingle()); Debug.Assert(context.CaretPosition == null); diff --git a/src/EditorFeatures/Core/Implementation/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs index 96b9516902b..cf4799fa534 100644 --- a/src/EditorFeatures/Core/Implementation/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs @@ -69,7 +69,7 @@ protected override IEnumerable GetSpansToTag(ITextView textViewOpt .ToList(); } - protected internal override Task ProduceTagsAsync(TaggerContext context) + protected override Task ProduceTagsAsync(TaggerContext context) { // NOTE(cyrusn): Normally we'd limit ourselves to producing tags in the span we were // asked about. However, we want to produce all tags here so that the user can actually diff --git a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.Tagger.cs b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.Tagger.cs index 99f32b9b676..828b33d49ac 100644 --- a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.Tagger.cs +++ b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.Tagger.cs @@ -133,14 +133,14 @@ public IEnumerable> GetAllTags(NormalizedSnapshotSpanCollection r return SpecializedCollections.EmptyEnumerable>(); } - var result = GetTags(requestedSpans, tags); + var result = GetIntersectingTagSpans(requestedSpans, tags); DebugVerifyTags(requestedSpans, result); return result; } - private static IEnumerable> GetTags(NormalizedSnapshotSpanCollection requestedSpans, TagSpanIntervalTree tags) + private static IEnumerable> GetIntersectingTagSpans(NormalizedSnapshotSpanCollection requestedSpans, TagSpanIntervalTree tags) { // Special case the case where there is only one requested span. In that case, we don't // need to allocate any intermediate collections diff --git a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs index 18b6226a85c..34dfb6d0182 100644 --- a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs +++ b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs @@ -174,11 +174,15 @@ protected virtual IEnumerable GetSpansToTag(ITextView textViewOpt, /// protected abstract ITaggerEventSource CreateEventSource(ITextView textViewOpt, ITextBuffer subjectBuffer); + internal Task ProduceTagsAsync_ForTestingPurposesOnly(TaggerContext context) + { + return ProduceTagsAsync(context); + } + /// /// Produce tags for the given context. /// - // internal for testing purposes only. - protected internal virtual async Task ProduceTagsAsync(TaggerContext context) + protected virtual async Task ProduceTagsAsync(TaggerContext context) { foreach (var spanToTag in context.SpansToTag) { diff --git a/src/EditorFeatures/Test/BraceHighlighting/AbstractBraceHighlightingTests.cs b/src/EditorFeatures/Test/BraceHighlighting/AbstractBraceHighlightingTests.cs index aee93610f51..bb5ccce8c45 100644 --- a/src/EditorFeatures/Test/BraceHighlighting/AbstractBraceHighlightingTests.cs +++ b/src/EditorFeatures/Test/BraceHighlighting/AbstractBraceHighlightingTests.cs @@ -27,7 +27,7 @@ protected void TestBraceHighlighting(string markup) var context = new TaggerContext( document, buffer.CurrentSnapshot, new SnapshotPoint(buffer.CurrentSnapshot, testDocument.CursorPosition.Value)); - provider.ProduceTagsAsync(context).Wait(); + provider.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait(); var expectedHighlights = testDocument.SelectedSpans.Select(ts => ts.ToSpan()).OrderBy(s => s.Start).ToList(); var actualHighlights = context.tagSpans.Select(ts => ts.Span.Span).OrderBy(s => s.Start).ToList(); diff --git a/src/EditorFeatures/Test/Outlining/OutliningTaggerTests.cs b/src/EditorFeatures/Test/Outlining/OutliningTaggerTests.cs index f3176ecaa75..08f0f33888b 100644 --- a/src/EditorFeatures/Test/Outlining/OutliningTaggerTests.cs +++ b/src/EditorFeatures/Test/Outlining/OutliningTaggerTests.cs @@ -142,7 +142,7 @@ private static List GetTagsFromWorkspace(TestWorkspace work var document = workspace.CurrentSolution.GetDocument(hostdoc.Id); var context = new TaggerContext(document, view.TextSnapshot); - provider.ProduceTagsAsync(context).Wait(); + provider.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait(); return context.tagSpans.Select(x => x.Tag).ToList(); } diff --git a/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb b/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb index 24a1007e611..46c4bc30984 100644 --- a/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb +++ b/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb @@ -35,7 +35,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.KeywordHighlighting AggregateAsynchronousOperationListener.EmptyListeners) Dim context = New TaggerContext(Of KeywordHighlightTag)(document, snapshot, New SnapshotPoint(snapshot, caretPosition)) - tagProducer.ProduceTagsAsync(context).Wait() + tagProducer.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait() Dim producedTags = From tag In context.tagSpans Order By tag.Span.Start diff --git a/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb b/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb index 51204e67ff0..c1a71b85712 100644 --- a/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb +++ b/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb @@ -37,7 +37,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.ReferenceHighlighting Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id) Dim context = New TaggerContext(Of NavigableHighlightTag)( document, snapshot, New SnapshotPoint(snapshot, caretPosition)) - tagProducer.ProduceTagsAsync(context).Wait() + tagProducer.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait() Dim producedTags = From tag In context.tagSpans Order By tag.Span.Start diff --git a/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb b/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb index a5341dd501a..dce0556ee8c 100644 --- a/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb +++ b/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb @@ -34,7 +34,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.BraceMatching Dim doc = buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault() Dim context = New TaggerContext(Of BraceHighlightTag)( doc, buffer.CurrentSnapshot, New SnapshotPoint(buffer.CurrentSnapshot, position)) - producer.ProduceTagsAsync(context).Wait() + producer.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait() Return context.tagSpans End Function -- GitLab