diff --git a/src/EditorFeatures/CSharpTest/Formatting/RazorLineFormattingOptionsTests.cs b/src/EditorFeatures/CSharpTest/Formatting/RazorLineFormattingOptionsTests.cs index 8e801c0ddd4e7..fbb1a3e15056d 100644 --- a/src/EditorFeatures/CSharpTest/Formatting/RazorLineFormattingOptionsTests.cs +++ b/src/EditorFeatures/CSharpTest/Formatting/RazorLineFormattingOptionsTests.cs @@ -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; diff --git a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/IVSTypeScriptTodoCommentDataServiceImplementation.cs b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/IVSTypeScriptTodoCommentDataServiceImplementation.cs index 870282e061486..ce11b8f3979b1 100644 --- a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/IVSTypeScriptTodoCommentDataServiceImplementation.cs +++ b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/IVSTypeScriptTodoCommentDataServiceImplementation.cs @@ -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; diff --git a/src/Features/Core/Portable/TaskList/AbstractTaskListService.cs b/src/Features/Core/Portable/TaskList/AbstractTaskListService.cs index 815b8568aa915..01c1f97c9a456 100644 --- a/src/Features/Core/Portable/TaskList/AbstractTaskListService.cs +++ b/src/Features/Core/Portable/TaskList/AbstractTaskListService.cs @@ -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 { diff --git a/src/Features/Core/Portable/TodoComments/ITodoCommentService.cs b/src/Features/Core/Portable/TodoComments/ITodoCommentService.cs deleted file mode 100644 index 3d5eb1bf035c2..0000000000000 --- a/src/Features/Core/Portable/TodoComments/ITodoCommentService.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.CodeAnalysis.TaskList; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis.TodoComments -{ - /// - /// A TODO comment that has been found within the user's code. - /// - [Obsolete($"Use {nameof(TaskListItem)} instead")] - internal readonly struct TodoComment - { - public TodoCommentDescriptor Descriptor { get; } - public string Message { get; } - public int Position { get; } - - public TodoComment(TodoCommentDescriptor descriptor, string message, int position) : this() - { - Descriptor = descriptor; - Message = message; - Position = position; - } - - private TaskListItem CreateTaskListItem( - Document document, SourceText text, SyntaxTree? tree) - { - // make sure given position is within valid text range. - var textSpan = new TextSpan(Math.Min(text.Length, Math.Max(0, Position)), 0); - - var location = tree == null - ? Location.Create(document.FilePath!, textSpan, text.Lines.GetLinePositionSpan(textSpan)) - : tree.GetLocation(textSpan); - - return new TaskListItem( - Descriptor.Priority, - Message, - document.Id, - location.GetLineSpan(), - location.GetMappedLineSpan()); - } - - public static async ValueTask> ConvertAsync( - Document document, - ImmutableArray todoComments, - CancellationToken cancellationToken) - { - if (todoComments.Length == 0) - return ImmutableArray.Empty; - - var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); - var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - - return todoComments.SelectAsArray(comment => comment.CreateTaskListItem(document, sourceText, syntaxTree)); - } - } - - [Obsolete($"Use {nameof(ITaskListService)} instead")] - internal interface ITodoCommentService : ILanguageService - { - [Obsolete($"Implement {nameof(ITaskListService.GetTaskListItemsAsync)} instead")] - Task> GetTodoCommentsAsync(Document document, ImmutableArray commentDescriptors, CancellationToken cancellationToken); - } -} diff --git a/src/Features/Core/Portable/TodoComments/TodoCommentDescriptor.cs b/src/Features/Core/Portable/TodoComments/TodoCommentDescriptor.cs deleted file mode 100644 index 72ec480123575..0000000000000 --- a/src/Features/Core/Portable/TodoComments/TodoCommentDescriptor.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Immutable; -using System.Runtime.Serialization; -using Microsoft.CodeAnalysis.TaskList; - -namespace Microsoft.CodeAnalysis.TodoComments -{ - /// - /// Description of a TODO comment type to find in a user's comments. - /// - [DataContract] - [Obsolete($"Use {nameof(TaskListItemDescriptor)} instead")] - internal readonly struct TodoCommentDescriptor - { - [DataMember(Order = 0)] - public string Text { get; } - [DataMember(Order = 1)] - public int Priority { get; } - - public TodoCommentDescriptor(string text, int priority) - { - Text = text; - Priority = priority; - } - - public static ImmutableArray Parse(ImmutableArray items) - => TaskListItemDescriptor.Parse(items).SelectAsArray(d => new TodoCommentDescriptor(d.Text, d.Priority)); - } -} diff --git a/src/Features/LanguageServer/Protocol/Features/TaskList/TaskListIncrementalAnalyzer.cs b/src/Features/LanguageServer/Protocol/Features/TaskList/TaskListIncrementalAnalyzer.cs index 31ac67f762069..b45f577330f83 100644 --- a/src/Features/LanguageServer/Protocol/Features/TaskList/TaskListIncrementalAnalyzer.cs +++ b/src/Features/LanguageServer/Protocol/Features/TaskList/TaskListIncrementalAnalyzer.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SolutionCrawler; -using Microsoft.CodeAnalysis.TodoComments; namespace Microsoft.CodeAnalysis.TaskList { @@ -60,27 +59,9 @@ private ImmutableArray GetDescriptors(ImmutableArray(); - 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(); - 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(); if (service == null) return; @@ -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> GetTaskListItemsAsync( - Document document, ImmutableArray 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); - } - } } } diff --git a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/IVsTypeScriptTodoCommentService.cs b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/IVsTypeScriptTodoCommentService.cs deleted file mode 100644 index c34a38711d582..0000000000000 --- a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/IVsTypeScriptTodoCommentService.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System; -using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.TaskList; -using Microsoft.CodeAnalysis.TodoComments; - -namespace Microsoft.VisualStudio.LanguageServices.ExternalAccess.VSTypeScript.Api -{ - internal interface IVsTypeScriptTodoCommentService - { - /// - /// Legacy entry-point to allow existing in-process TypeScript language service to report todo comments. - /// TypeScript is responsible for determining when to compute todo comments (for example, on ). This can be called on any thread. - /// - [Obsolete("Use {nameof(ReportTaskListItemsAsync)} instead.")] - Task ReportTodoCommentsAsync(Document document, ImmutableArray todoComments, CancellationToken cancellationToken); - - Task ReportTaskListItemsAsync(Document document, ImmutableArray items, CancellationToken cancellationToken); - } -} diff --git a/src/VisualStudio/Core/Def/TaskList/VisualStudioTaskListService.cs b/src/VisualStudio/Core/Def/TaskList/VisualStudioTaskListService.cs index aa41eef8cd281..063a95ab92c1b 100644 --- a/src/VisualStudio/Core/Def/TaskList/VisualStudioTaskListService.cs +++ b/src/VisualStudio/Core/Def/TaskList/VisualStudioTaskListService.cs @@ -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 { private readonly IThreadingContext _threadingContext; @@ -96,20 +93,6 @@ private async Task StartAsync(Workspace workspace) } } - /// - [Obsolete] - async Task IVsTypeScriptTodoCommentService.ReportTodoCommentsAsync( - Document document, ImmutableArray 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 items, CancellationToken cancellationToken) - => await _listener.ReportTaskListItemsAsync(document.Id, items, cancellationToken).ConfigureAwait(false); - public ImmutableArray GetTaskListItems(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) => _listener.GetTaskListItems(documentId); }