Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Editor.Tagging;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Collections;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;

namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;

// TODO: remove
internal abstract class VSTypeScriptAsynchronousTaggerProvider<TTag> : AsynchronousViewTaggerProvider<TTag>
where TTag : ITag
{
Expand All @@ -23,3 +29,30 @@ protected VSTypeScriptAsynchronousTaggerProvider(VSTypeScriptTaggerHost taggerHo
{
}
}

internal abstract class VSTypeScriptAsynchronousTaggerProvider2<TTag> : AsynchronousViewTaggerProvider<TTag>
where TTag : ITag
{
protected VSTypeScriptAsynchronousTaggerProvider2(VSTypeScriptTaggerHost taggerHost)
: base(taggerHost.UnderlyingObject, FeatureAttribute.Classification)
{
}

protected sealed override bool TryAddSpansToTag(ITextView? textView, ITextBuffer subjectBuffer, ref TemporaryArray<SnapshotSpan> result)
{
using var _ = ArrayBuilder<SnapshotSpan>.GetInstance(out var builder);
if (TryAddSpansToTagImpl(textView, subjectBuffer, builder))
{
foreach (var item in builder)
{
result.Add(item);
}

return true;
}

return false;
}

protected abstract bool TryAddSpansToTagImpl(ITextView? textView, ITextBuffer subjectBuffer, ICollection<SnapshotSpan> result);
}
Loading