From d963f6b943283bbbd97756c32f9a37075971a0f6 Mon Sep 17 00:00:00 2001 From: tmat Date: Wed, 9 Feb 2022 12:37:58 -0800 Subject: [PATCH] Remove obsolete APIs --- .../Razor/IRazorDocumentExcerptService.cs | 6 ----- .../RazorDocumentExcerptServiceWrapper.cs | 25 ++----------------- .../RazorDocumentServiceProviderWrapper.cs | 14 +---------- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/src/Tools/ExternalAccess/Razor/IRazorDocumentExcerptService.cs b/src/Tools/ExternalAccess/Razor/IRazorDocumentExcerptService.cs index fed026d507d1c..8f108e50f09d8 100644 --- a/src/Tools/ExternalAccess/Razor/IRazorDocumentExcerptService.cs +++ b/src/Tools/ExternalAccess/Razor/IRazorDocumentExcerptService.cs @@ -9,12 +9,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { - [Obsolete("Use IRazorDocumentExcerptServiceImplementation instead")] - internal interface IRazorDocumentExcerptService - { - Task TryExcerptAsync(Document document, TextSpan span, RazorExcerptMode mode, CancellationToken cancellationToken); - } - internal interface IRazorDocumentExcerptServiceImplementation { Task TryExcerptAsync(Document document, TextSpan span, RazorExcerptMode mode, RazorClassificationOptionsWrapper options, CancellationToken cancellationToken); diff --git a/src/Tools/ExternalAccess/Razor/RazorDocumentExcerptServiceWrapper.cs b/src/Tools/ExternalAccess/Razor/RazorDocumentExcerptServiceWrapper.cs index 717e8cb681b7c..ff0cdfc1b8e6b 100644 --- a/src/Tools/ExternalAccess/Razor/RazorDocumentExcerptServiceWrapper.cs +++ b/src/Tools/ExternalAccess/Razor/RazorDocumentExcerptServiceWrapper.cs @@ -2,8 +2,6 @@ // 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.ComponentModel; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Classification; @@ -15,14 +13,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { internal sealed class RazorDocumentExcerptServiceWrapper : IDocumentExcerptService { - [Obsolete] - private readonly IRazorDocumentExcerptService? _legacyRazorDocumentExcerptService; - - private readonly IRazorDocumentExcerptServiceImplementation? _impl; - - [Obsolete] - public RazorDocumentExcerptServiceWrapper(IRazorDocumentExcerptService razorDocumentExcerptService) - => _legacyRazorDocumentExcerptService = razorDocumentExcerptService; + private readonly IRazorDocumentExcerptServiceImplementation _impl; public RazorDocumentExcerptServiceWrapper(IRazorDocumentExcerptServiceImplementation impl) => _impl = impl; @@ -36,19 +27,7 @@ public RazorDocumentExcerptServiceWrapper(IRazorDocumentExcerptServiceImplementa _ => throw ExceptionUtilities.UnexpectedValue(mode), }; - RazorExcerptResult? result; - if (_impl != null) - { - result = await _impl.TryExcerptAsync(document, span, razorMode, new RazorClassificationOptionsWrapper(classificationOptions), cancellationToken).ConfigureAwait(false); - } - else - { -#pragma warning disable CS0612 // Type or member is obsolete - Contract.ThrowIfNull(_legacyRazorDocumentExcerptService); - result = await _legacyRazorDocumentExcerptService.TryExcerptAsync(document, span, razorMode, cancellationToken).ConfigureAwait(false); -#pragma warning restore - } - + var result = await _impl.TryExcerptAsync(document, span, razorMode, new RazorClassificationOptionsWrapper(classificationOptions), cancellationToken).ConfigureAwait(false); var razorExcerpt = result.Value; return new ExcerptResult(razorExcerpt.Content, razorExcerpt.MappedSpan, razorExcerpt.ClassifiedSpans, razorExcerpt.Document, razorExcerpt.Span); } diff --git a/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs b/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs index b490d3b5c7089..d2817e421d4d0 100644 --- a/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs +++ b/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs @@ -51,19 +51,7 @@ public RazorDocumentServiceProviderWrapper(IRazorDocumentServiceProvider innerDo static documentServiceProvider => { var impl = documentServiceProvider.GetService(); - if (impl != null) - { - return new RazorDocumentExcerptServiceWrapper(impl); - } - -#pragma warning disable CS0612, CS0618 // Type or member is obsolete - var legacyImpl = documentServiceProvider.GetService(); - if (legacyImpl != null) - { - return new RazorDocumentExcerptServiceWrapper(legacyImpl); - } -#pragma warning restore - return null; + return (impl != null) ? new RazorDocumentExcerptServiceWrapper(impl) : null; }, _innerDocumentServiceProvider);