提交 7d918b29 编写于 作者: S Sam Harwell

Provide external access APIs for LegacyCodeAnalysis

See #35080
上级 ebd2fb79
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis
{
internal interface ILegacyCodeAnalysisVisualStudioDiagnosticAnalyzerServiceAccessor
{
IReadOnlyDictionary<string, IEnumerable<DiagnosticDescriptor>> GetAllDiagnosticDescriptors(IVsHierarchy hierarchyOpt);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis
{
internal interface ILegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor
{
bool CanSuppressSelectedEntries { get; }
bool CanSuppressSelectedEntriesInSource { get; }
bool CanSuppressSelectedEntriesInSuppressionFiles { get; }
bool CanRemoveSuppressionsSelectedEntries { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis
{
internal interface ILegacyCodeAnalysisVisualStudioSuppressionFixServiceAccessor
{
bool AddSuppressions(IVsHierarchy projectHierarchyOpt);
bool AddSuppressions(bool selectedErrorListEntriesOnly, bool suppressInSource, IVsHierarchy projectHierarchyOpt);
bool RemoveSuppressions(bool selectedErrorListEntriesOnly, IVsHierarchy projectHierarchyOpt);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis.Internal
{
[Export(typeof(ILegacyCodeAnalysisVisualStudioDiagnosticAnalyzerServiceAccessor))]
[Shared]
internal sealed class LegacyCodeAnalysisVisualStudioDiagnosticAnalyzerServiceAccessor
: ILegacyCodeAnalysisVisualStudioDiagnosticAnalyzerServiceAccessor
{
private readonly IVisualStudioDiagnosticAnalyzerService _implementation;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LegacyCodeAnalysisVisualStudioDiagnosticAnalyzerServiceAccessor(IVisualStudioDiagnosticAnalyzerService implementation)
{
_implementation = implementation;
}
public IReadOnlyDictionary<string, IEnumerable<DiagnosticDescriptor>> GetAllDiagnosticDescriptors(IVsHierarchy hierarchyOpt)
=> _implementation.GetAllDiagnosticDescriptors(hierarchyOpt);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource;
namespace Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis.Internal
{
[Export(typeof(ILegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor))]
[Shared]
internal sealed class LegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor
: ILegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor
{
private readonly IVisualStudioDiagnosticListSuppressionStateService _implementation;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor(IVisualStudioDiagnosticListSuppressionStateService implementation)
{
_implementation = implementation;
}
public bool CanSuppressSelectedEntries => _implementation.CanSuppressSelectedEntries;
public bool CanSuppressSelectedEntriesInSource => _implementation.CanSuppressSelectedEntriesInSource;
public bool CanSuppressSelectedEntriesInSuppressionFiles => _implementation.CanSuppressSelectedEntriesInSuppressionFiles;
public bool CanRemoveSuppressionsSelectedEntries => _implementation.CanRemoveSuppressionsSelectedEntries;
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.Suppression;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis.Internal
{
[Export(typeof(ILegacyCodeAnalysisVisualStudioSuppressionFixServiceAccessor))]
[Shared]
internal sealed class LegacyCodeAnalysisVisualStudioSuppressionFixServiceAccessor
: ILegacyCodeAnalysisVisualStudioSuppressionFixServiceAccessor
{
private readonly IVisualStudioSuppressionFixService _implementation;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LegacyCodeAnalysisVisualStudioSuppressionFixServiceAccessor(IVisualStudioSuppressionFixService implementation)
{
_implementation = implementation;
}
public bool AddSuppressions(IVsHierarchy projectHierarchyOpt)
=> _implementation.AddSuppressions(projectHierarchyOpt);
public bool AddSuppressions(bool selectedErrorListEntriesOnly, bool suppressInSource, IVsHierarchy projectHierarchyOpt)
=> _implementation.AddSuppressions(selectedErrorListEntriesOnly, suppressInSource, projectHierarchyOpt);
public bool RemoveSuppressions(bool selectedErrorListEntriesOnly, IVsHierarchy projectHierarchyOpt)
=> _implementation.RemoveSuppressions(selectedErrorListEntriesOnly, projectHierarchyOpt);
}
}
......@@ -117,9 +117,9 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TypeScript.EditorFeatures" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.TypeScript" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="Roslyn.Services.Editor.TypeScript.UnitTests" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="ManagedSourceCodeAnalysis" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35080" />
<InternalsVisibleTo Include="CodeAnalysis" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35080" />
<InternalsVisibleTo Include="StanCore" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35080" />
<RestrictedInternalsVisibleTo Include="ManagedSourceCodeAnalysis" Key="$(TypeScriptKey)" Partner="LegacyCodeAnalysis" />
<RestrictedInternalsVisibleTo Include="CodeAnalysis" Key="$(TypeScriptKey)" Partner="LegacyCodeAnalysis" />
<RestrictedInternalsVisibleTo Include="StanCore" Key="$(TypeScriptKey)" Partner="LegacyCodeAnalysis" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Remote" Key="$(RemoteLanguageServiceKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35074" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Remote.15.7" Key="$(RemoteLanguageServiceKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35074" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Remote.15.8" Key="$(RemoteLanguageServiceKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35074" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册