From 195dba8614f70cb4469a815a8a7fc1eee05f778d Mon Sep 17 00:00:00 2001 From: Evgeny Tvorun Date: Thu, 23 May 2024 12:25:17 -0700 Subject: [PATCH] Expose XAML IDiagnosticSourceProvider names --- .../VisualDiagnostics/Contracts/Constants.cs | 10 ++++++++++ .../Internal/HotReloadDiagnosticSourceProvider.cs | 2 +- .../VisualDiagnostics/InternalAPI.Unshipped.txt | 2 ++ src/Tools/ExternalAccess/Xaml/External/Constants.cs | 10 ++++++++++ .../Xaml/Internal/XamlDiagnosticSourceProvider.cs | 2 +- .../ExternalAccess/Xaml/InternalAPI.Unshipped.txt | 2 ++ 6 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/Tools/ExternalAccess/VisualDiagnostics/Contracts/Constants.cs create mode 100644 src/Tools/ExternalAccess/Xaml/External/Constants.cs diff --git a/src/Tools/ExternalAccess/VisualDiagnostics/Contracts/Constants.cs b/src/Tools/ExternalAccess/VisualDiagnostics/Contracts/Constants.cs new file mode 100644 index 0000000000000..3235dd776ee72 --- /dev/null +++ b/src/Tools/ExternalAccess/VisualDiagnostics/Contracts/Constants.cs @@ -0,0 +1,10 @@ +// 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. + +namespace Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Contracts; + +internal static class Constants +{ + public const string DiagnosticSourceProviderName = "HotReloadDiagnostics"; +} diff --git a/src/Tools/ExternalAccess/VisualDiagnostics/Internal/HotReloadDiagnosticSourceProvider.cs b/src/Tools/ExternalAccess/VisualDiagnostics/Internal/HotReloadDiagnosticSourceProvider.cs index 88bd5cceb9f90..bdf530f4a9732 100644 --- a/src/Tools/ExternalAccess/VisualDiagnostics/Internal/HotReloadDiagnosticSourceProvider.cs +++ b/src/Tools/ExternalAccess/VisualDiagnostics/Internal/HotReloadDiagnosticSourceProvider.cs @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Internal; internal abstract class HotReloadDiagnosticSourceProvider(IHotReloadDiagnosticManager diagnosticManager, bool isDocument) : IDiagnosticSourceProvider { - public string Name => "HotReloadDiagnostics"; + public string Name => Constants.DiagnosticSourceProviderName; public bool IsDocument => isDocument; public bool IsEnabled(ClientCapabilities clientCapabilities) => true; diff --git a/src/Tools/ExternalAccess/VisualDiagnostics/InternalAPI.Unshipped.txt b/src/Tools/ExternalAccess/VisualDiagnostics/InternalAPI.Unshipped.txt index a831db9ed8865..a4ff274284a28 100644 --- a/src/Tools/ExternalAccess/VisualDiagnostics/InternalAPI.Unshipped.txt +++ b/src/Tools/ExternalAccess/VisualDiagnostics/InternalAPI.Unshipped.txt @@ -1,3 +1,5 @@ +const Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Contracts.Constants.DiagnosticSourceProviderName = "HotReloadDiagnostics" -> string! +Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Contracts.Constants Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Contracts.HotReloadRequestContext Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Contracts.HotReloadRequestContext.ClientCapabilities.get -> Roslyn.LanguageServer.Protocol.ClientCapabilities! Microsoft.CodeAnalysis.ExternalAccess.VisualDiagnostics.Contracts.HotReloadRequestContext.HotReloadRequestContext(Microsoft.CodeAnalysis.LanguageServer.Handler.RequestContext context) -> void diff --git a/src/Tools/ExternalAccess/Xaml/External/Constants.cs b/src/Tools/ExternalAccess/Xaml/External/Constants.cs new file mode 100644 index 0000000000000..c088b0c18b172 --- /dev/null +++ b/src/Tools/ExternalAccess/Xaml/External/Constants.cs @@ -0,0 +1,10 @@ +// 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. + +namespace Microsoft.CodeAnalysis.ExternalAccess.Xaml; + +internal static class Constants +{ + public const string DiagnosticSourceProviderName = "XamlDiagnostics"; +} diff --git a/src/Tools/ExternalAccess/Xaml/Internal/XamlDiagnosticSourceProvider.cs b/src/Tools/ExternalAccess/Xaml/Internal/XamlDiagnosticSourceProvider.cs index 526a26f5e57e8..89db320c103dc 100644 --- a/src/Tools/ExternalAccess/Xaml/Internal/XamlDiagnosticSourceProvider.cs +++ b/src/Tools/ExternalAccess/Xaml/Internal/XamlDiagnosticSourceProvider.cs @@ -21,7 +21,7 @@ internal sealed class XamlDiagnosticSourceProvider([Import(AllowDefault = true)] { bool IDiagnosticSourceProvider.IsDocument => true; - string IDiagnosticSourceProvider.Name => "XamlDiagnostics"; + string IDiagnosticSourceProvider.Name => Constants.DiagnosticSourceProviderName; bool IDiagnosticSourceProvider.IsEnabled(ClientCapabilities clientCapabilities) => true; diff --git a/src/Tools/ExternalAccess/Xaml/InternalAPI.Unshipped.txt b/src/Tools/ExternalAccess/Xaml/InternalAPI.Unshipped.txt index c8d63468defae..70cc3d4b4e678 100644 --- a/src/Tools/ExternalAccess/Xaml/InternalAPI.Unshipped.txt +++ b/src/Tools/ExternalAccess/Xaml/InternalAPI.Unshipped.txt @@ -1,5 +1,6 @@ abstract Microsoft.CodeAnalysis.ExternalAccess.Xaml.XamlRequestHandlerBase.GetTextDocumentUri(TRequest request) -> System.Uri! abstract Microsoft.CodeAnalysis.ExternalAccess.Xaml.XamlRequestHandlerFactoryBase.CreateHandler(Microsoft.CodeAnalysis.ExternalAccess.Xaml.IXamlRequestHandler? xamlRequestHandler, Microsoft.CodeAnalysis.ExternalAccess.Xaml.IResolveCachedDataService! resolveDataService) -> Microsoft.CodeAnalysis.ExternalAccess.Xaml.XamlRequestHandlerBase! +const Microsoft.CodeAnalysis.ExternalAccess.Xaml.Constants.DiagnosticSourceProviderName = "XamlDiagnostics" -> string! const Microsoft.CodeAnalysis.ExternalAccess.Xaml.StringConstants.FactoryMethodMessage = "This factory method only provides services for the MEF export provider." -> string! const Microsoft.CodeAnalysis.ExternalAccess.Xaml.StringConstants.ImportingConstructorMessage = "This exported object must be obtained through the MEF export provider." -> string! const Microsoft.CodeAnalysis.ExternalAccess.Xaml.StringConstants.XamlFileExtension = ".xaml" -> string! @@ -9,6 +10,7 @@ Microsoft.CodeAnalysis.ExternalAccess.Xaml.ClientCapabilityProvider.ClientCapabi Microsoft.CodeAnalysis.ExternalAccess.Xaml.ClientCapabilityProvider.IsDynamicRegistrationSupported(string! methodName) -> bool Microsoft.CodeAnalysis.ExternalAccess.Xaml.ClientCapabilityProvider.SupportsCompletionListData.get -> bool Microsoft.CodeAnalysis.ExternalAccess.Xaml.ClientCapabilityProvider.SupportsMarkdownDocumentation.get -> bool +Microsoft.CodeAnalysis.ExternalAccess.Xaml.Constants Microsoft.CodeAnalysis.ExternalAccess.Xaml.ConversionHelpers Microsoft.CodeAnalysis.ExternalAccess.Xaml.DescriptionService Microsoft.CodeAnalysis.ExternalAccess.Xaml.DescriptionService.DescriptionService(Microsoft.CodeAnalysis.Options.IGlobalOptionService! globalOptions) -> void