提交 1097a1bc 编写于 作者: C Cyrus Najmabadi

Rename method.

Make it clearer that a method is for testing only.
上级 31db7a25
......@@ -42,7 +42,7 @@ private IEnumerable<T> Enumerable<T>(params T[] array)
var context = new TaggerContext<BraceHighlightTag>(
buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault(),
buffer.CurrentSnapshot, new SnapshotPoint(buffer.CurrentSnapshot, position));
producer.ProduceTagsAsync(context).Wait();
producer.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait();
return context.tagSpans;
}
......
......@@ -65,7 +65,7 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I
TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer, TaggerDelay.Short));
}
protected internal override async Task ProduceTagsAsync(TaggerContext<IClassificationTag> context)
protected override async Task ProduceTagsAsync(TaggerContext<IClassificationTag> context)
{
Debug.Assert(context.SpansToTag.IsSingle());
Debug.Assert(context.CaretPosition == null);
......
......@@ -69,7 +69,7 @@ protected override IEnumerable<SnapshotSpan> GetSpansToTag(ITextView textViewOpt
.ToList();
}
protected internal override Task ProduceTagsAsync(TaggerContext<NavigableHighlightTag> context)
protected override Task ProduceTagsAsync(TaggerContext<NavigableHighlightTag> 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
......
......@@ -133,14 +133,14 @@ public IEnumerable<ITagSpan<TTag>> GetAllTags(NormalizedSnapshotSpanCollection r
return SpecializedCollections.EmptyEnumerable<ITagSpan<TTag>>();
}
var result = GetTags(requestedSpans, tags);
var result = GetIntersectingTagSpans(requestedSpans, tags);
DebugVerifyTags(requestedSpans, result);
return result;
}
private static IEnumerable<ITagSpan<TTag>> GetTags(NormalizedSnapshotSpanCollection requestedSpans, TagSpanIntervalTree<TTag> tags)
private static IEnumerable<ITagSpan<TTag>> GetIntersectingTagSpans(NormalizedSnapshotSpanCollection requestedSpans, TagSpanIntervalTree<TTag> tags)
{
// Special case the case where there is only one requested span. In that case, we don't
// need to allocate any intermediate collections
......
......@@ -174,11 +174,15 @@ protected virtual IEnumerable<SnapshotSpan> GetSpansToTag(ITextView textViewOpt,
/// </summary>
protected abstract ITaggerEventSource CreateEventSource(ITextView textViewOpt, ITextBuffer subjectBuffer);
internal Task ProduceTagsAsync_ForTestingPurposesOnly(TaggerContext<TTag> context)
{
return ProduceTagsAsync(context);
}
/// <summary>
/// Produce tags for the given context.
/// </summary>
// internal for testing purposes only.
protected internal virtual async Task ProduceTagsAsync(TaggerContext<TTag> context)
protected virtual async Task ProduceTagsAsync(TaggerContext<TTag> context)
{
foreach (var spanToTag in context.SpansToTag)
{
......
......@@ -27,7 +27,7 @@ protected void TestBraceHighlighting(string markup)
var context = new TaggerContext<BraceHighlightTag>(
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();
......
......@@ -142,7 +142,7 @@ private static List<IOutliningRegionTag> GetTagsFromWorkspace(TestWorkspace work
var document = workspace.CurrentSolution.GetDocument(hostdoc.Id);
var context = new TaggerContext<IOutliningRegionTag>(document, view.TextSnapshot);
provider.ProduceTagsAsync(context).Wait();
provider.ProduceTagsAsync_ForTestingPurposesOnly(context).Wait();
return context.tagSpans.Select(x => x.Tag).ToList();
}
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册