提交 6fad70bb 编写于 作者: C Cyrus Najmabadi

Simplify approach

上级 615c6391
......@@ -195,18 +195,6 @@ public ImmutableArray<TodoCommentData> GetTodoItems(Workspace workspace, Documen
return SpecializedCollections.EmptyEnumerable<UpdatedEventArgs>();
}
/// <summary>
/// Callback from the OOP service back into us.
/// </summary>
public async Task OnDocumentRemovedAsync(DocumentId documentId, CancellationToken cancellationToken)
{
var workQueue = await _workQueueSource.Task.ConfigureAwait(false);
// treat this as if we have no todo comments for this file. ProcessTodoCommentInfosAsync
// will handle actually clearing out the data.
workQueue.AddWork(new DocumentAndComments(documentId, ImmutableArray<TodoCommentData>.Empty));
}
/// <summary>
/// Callback from the OOP service back into us.
/// </summary>
......
......@@ -11,12 +11,10 @@
namespace Microsoft.CodeAnalysis.TodoComments
{
/// <summary>
/// Callback the host (VS) passes to the OOP service to allow it to send batch notifications
/// about todo comments.
/// Callback the host (VS) passes to the OOP service to allow it to send batch notifications about todo comments.
/// </summary>
internal interface ITodoCommentsListener
{
Task OnDocumentRemovedAsync(DocumentId documentId, CancellationToken cancellationToken);
Task ReportTodoCommentDataAsync(DocumentId documentId, ImmutableArray<TodoCommentData> data, CancellationToken cancellationToken);
}
}
......@@ -4,6 +4,7 @@
#nullable enable
using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -38,9 +39,10 @@ public override bool NeedsReanalysisOnOptionChanged(object sender, OptionChanged
public override Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken)
{
// Just report this back as there being no more comments for this document.
return _endPoint.InvokeAsync(
nameof(ITodoCommentsListener.OnDocumentRemovedAsync),
new object[] { documentId },
nameof(ITodoCommentsListener.ReportTodoCommentDataAsync),
new object[] { documentId, Array.Empty<TodoCommentData>() },
cancellationToken);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册