Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy 'todo list' support #64319

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
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,24 +3,15 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.TodoComments;
using Microsoft.CodeAnalysis.UnitTests;
using Microsoft.CodeAnalysis.VisualBasic.Formatting;
using Roslyn.Test.Utilities;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.TaskList;
using Microsoft.CodeAnalysis.TodoComments;

namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.TaskList;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.TodoComments;

namespace Microsoft.CodeAnalysis.TaskList
{
Expand Down
73 changes: 0 additions & 73 deletions src/Features/Core/Portable/TodoComments/ITodoCommentService.cs

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Microsoft.CodeAnalysis.TodoComments;

namespace Microsoft.CodeAnalysis.TaskList
{
Expand Down Expand Up @@ -60,27 +59,9 @@ private ImmutableArray<TaskListItemDescriptor> GetDescriptors(ImmutableArray<str
}
}

private static ITaskListService? GetTaskListService(Document document)
{
#pragma warning disable CS0612 // Type or member is obsolete
#pragma warning disable CS0618 // Type or member is obsolete
// Legacy compat until TypeScript moves to EA pattern.
var todoService = document.GetLanguageService<ITodoCommentService>();
if (todoService != null)
return new TodoCommentServiceWrapper(todoService);
#pragma warning restore CS0618 // Type or member is obsolete
#pragma warning restore CS0612 // Type or member is obsolete

var todoDataService = document.GetLanguageService<ITaskListService>();
if (todoDataService != null)
return todoDataService;

return null;
}

public override async Task AnalyzeSyntaxAsync(Document document, InvocationReasons reasons, CancellationToken cancellationToken)
{
var service = GetTaskListService(document);
var service = document.GetLanguageService<ITaskListService>();
if (service == null)
return;

Expand Down Expand Up @@ -108,24 +89,5 @@ public override async Task AnalyzeSyntaxAsync(Document document, InvocationReaso
// Now inform VS about this new information
await _listener.ReportTaskListItemsAsync(document.Id, items, cancellationToken).ConfigureAwait(false);
}

[Obsolete]
private sealed class TodoCommentServiceWrapper : ITaskListService
{
private readonly ITodoCommentService _todoService;

public TodoCommentServiceWrapper(ITodoCommentService todoService)
{
_todoService = todoService;
}

public async Task<ImmutableArray<TaskListItem>> GetTaskListItemsAsync(
Document document, ImmutableArray<TaskListItemDescriptor> descriptors, CancellationToken cancellationToken)
{
var comments = await _todoService.GetTodoCommentsAsync(
document, descriptors.SelectAsArray(d => new TodoCommentDescriptor(d.Text, d.Priority)), cancellationToken).ConfigureAwait(false);
return await TodoComment.ConvertAsync(document, comments, cancellationToken).ConfigureAwait(false);
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.TaskList;
using Microsoft.CodeAnalysis.TodoComments;
using Microsoft.VisualStudio.LanguageServices.ExternalAccess.VSTypeScript.Api;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;

namespace Microsoft.VisualStudio.LanguageServices.TaskList
{
[Export(typeof(IVsTypeScriptTodoCommentService))]
[ExportEventListener(WellKnownEventListeners.Workspace, WorkspaceKind.Host), Shared]
internal class VisualStudioTaskListService :
ITaskListProvider,
IVsTypeScriptTodoCommentService,
IEventListener<object>
{
private readonly IThreadingContext _threadingContext;
Expand Down Expand Up @@ -96,20 +93,6 @@ private async Task StartAsync(Workspace workspace)
}
}

/// <inheritdoc cref="IVsTypeScriptTodoCommentService.ReportTodoCommentsAsync(Document, ImmutableArray{TodoComment}, CancellationToken)"/>
[Obsolete]
async Task IVsTypeScriptTodoCommentService.ReportTodoCommentsAsync(
Document document, ImmutableArray<TodoComment> todoComments, CancellationToken cancellationToken)
{
var converted = await TodoComment.ConvertAsync(document, todoComments, cancellationToken).ConfigureAwait(false);

await _listener.ReportTaskListItemsAsync(
document.Id, converted, cancellationToken).ConfigureAwait(false);
}

async Task IVsTypeScriptTodoCommentService.ReportTaskListItemsAsync(Document document, ImmutableArray<TaskListItem> items, CancellationToken cancellationToken)
=> await _listener.ReportTaskListItemsAsync(document.Id, items, cancellationToken).ConfigureAwait(false);

public ImmutableArray<TaskListItem> GetTaskListItems(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
=> _listener.GetTaskListItems(documentId);
}
Expand Down