From 6c8ebd8e5393b18d134f66f5fcb3a996a8b4af72 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 26 May 2024 12:52:08 -0700 Subject: [PATCH] Remove legacy api used only by vs4mac. --- .../Options/ILegacyDocumentOptionsProvider.cs | 15 --------------- .../Portable/Workspace/Solution/ProjectState.cs | 17 ++++------------- 2 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 src/Workspaces/Core/Portable/Options/ILegacyDocumentOptionsProvider.cs diff --git a/src/Workspaces/Core/Portable/Options/ILegacyDocumentOptionsProvider.cs b/src/Workspaces/Core/Portable/Options/ILegacyDocumentOptionsProvider.cs deleted file mode 100644 index 59c109c9578fa..0000000000000 --- a/src/Workspaces/Core/Portable/Options/ILegacyDocumentOptionsProvider.cs +++ /dev/null @@ -1,15 +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 Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Diagnostics; - -/// -/// Enables legacy APIs in VS Mac to provide options for a specified project and document path. -/// -internal interface ILegacyDocumentOptionsProvider : IWorkspaceService -{ - AnalyzerConfigOptions GetOptions(ProjectId projectId, string documentPath); -} diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs b/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs index 89f921005c4e1..c45b2002fbb71 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs @@ -334,18 +334,9 @@ private StructuredAnalyzerConfigOptions GetOptions(in AnalyzerConfigOptionsCache } var filePath = GetEffectiveFilePath(documentState); - if (filePath == null) - { - return StructuredAnalyzerConfigOptions.Empty; - } - - var legacyDocumentOptionsProvider = services.GetService(); - if (legacyDocumentOptionsProvider != null) - { - return StructuredAnalyzerConfigOptions.Create(legacyDocumentOptionsProvider.GetOptions(projectState.Id, filePath)); - } - - return GetOptionsForSourcePath(cache, filePath); + return filePath == null + ? StructuredAnalyzerConfigOptions.Empty + : GetOptionsForSourcePath(cache, filePath); } public override AnalyzerConfigOptions GetOptions(AdditionalText textFile) @@ -490,7 +481,7 @@ private readonly struct AnalyzerConfigOptionsCache(AnalyzerConfigSet configSet) { private readonly ConcurrentDictionary _sourcePathToResult = []; private readonly Func _computeFunction = path => new AnalyzerConfigData(configSet.GetOptionsForSourcePath(path)); - private readonly Lazy _global = new Lazy(() => new AnalyzerConfigData(configSet.GlobalConfigOptions)); + private readonly Lazy _global = new(() => new AnalyzerConfigData(configSet.GlobalConfigOptions)); public AnalyzerConfigData GlobalConfigOptions => _global.Value;