From d26d69f0203b401cc30c8019bf1c27c1d8480f4f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 14:31:39 +1100 Subject: [PATCH 01/10] Remove references that we don't want to load in VS --- .../Microsoft.AspNetCore.Razor.Microbenchmarks.csproj | 1 - .../Microsoft.AspNetCore.Razor.LanguageServer.csproj | 2 -- .../Microsoft.CodeAnalysis.Razor.Workspaces.csproj | 1 - .../Microsoft.CodeAnalysis.Remote.Razor.CoreComponents.csproj | 1 - .../Microsoft.VisualStudio.LanguageServerClient.Razor.csproj | 2 -- .../Microsoft.VisualStudio.RazorExtension.csproj | 2 -- .../source.extension.vsixmanifest | 2 -- .../Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj | 1 - 8 files changed, 12 deletions(-) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj index 58def5258e1..1184bce9841 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj @@ -56,7 +56,6 @@ - diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Microsoft.AspNetCore.Razor.LanguageServer.csproj b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Microsoft.AspNetCore.Razor.LanguageServer.csproj index f412871b184..55e955e8d38 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Microsoft.AspNetCore.Razor.LanguageServer.csproj +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Microsoft.AspNetCore.Razor.LanguageServer.csproj @@ -22,8 +22,6 @@ - - diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj index 1270f1275c4..496bff9eab4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj @@ -22,7 +22,6 @@ - diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents.csproj index 990b86a5cc1..5fa47a1fc07 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents.csproj +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents/Microsoft.CodeAnalysis.Remote.Razor.CoreComponents.csproj @@ -28,7 +28,6 @@ <_PublishedFiles Include="$(PublishDir)**\Microsoft.CodeAnalysis.Razor.*" /> <_PublishedFiles Include="$(PublishDir)**\Microsoft.CodeAnalysis.Remote.Razor.*" Exclude="@(_ExcludedFiles)"/> <_PublishedFiles Include="$(PublishDir)**\Microsoft.AspNetCore.*" /> - <_PublishedFiles Include="$(PublishDir)**\Microsoft.Extensions.Logging.Abstractions.dll" /> <_PublishedFiles Include="$(PublishDir)**\Microsoft.Extensions.ObjectPool.dll" /> <_PublishedFiles Include="$(PublishDir)**\Microsoft.VisualStudio.LanguageServer.Protocol.*" /> diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Microsoft.VisualStudio.LanguageServerClient.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Microsoft.VisualStudio.LanguageServerClient.Razor.csproj index c2f969db354..784476a0c21 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Microsoft.VisualStudio.LanguageServerClient.Razor.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Microsoft.VisualStudio.LanguageServerClient.Razor.csproj @@ -21,8 +21,6 @@ - - diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj index 684f2cd4cda..d92dd49118e 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj @@ -143,8 +143,6 @@ - - diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest index a91565b64d7..16eab7ca5c6 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest @@ -39,8 +39,6 @@ - - diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj index 6794aba3522..e5cf60a2a4a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj @@ -44,7 +44,6 @@ - From 1710959a5db9f714a10e8bc88fcabfe47ee3f642 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 14:34:20 +1100 Subject: [PATCH 02/10] Reimplement the bits of logging that we actually use ie, no BeginScope, no EventIds. Message formatter could go in future too. --- ...tractRazorLoggerFactory.AggregateLogger.cs | 44 ++++++++++++++ .../Logging/AbstractRazorLoggerFactory.cs | 48 ++++++++------- .../Logging/ILogger.cs | 13 ++++ .../Logging/ILoggerExtensions.cs | 59 +++++++++++++++++++ .../Logging/IRazorLoggerFactory.cs | 5 +- .../Logging/IRazorLoggerFactoryExtensions.cs | 1 - .../Logging/IRazorLoggerProvider.cs | 5 +- .../Logging/LogLevel.cs | 15 +++++ 8 files changed, 162 insertions(+), 28 deletions(-) create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILogger.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/LogLevel.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs new file mode 100644 index 00000000000..e02f3da8d85 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs @@ -0,0 +1,44 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; + +namespace Microsoft.CodeAnalysis.Razor.Logging; + +internal abstract partial class AbstractRazorLoggerFactory +{ + private class AggregateLogger(ImmutableArray loggers) : ILogger + { + private ImmutableArray _loggers = loggers; + + public bool IsEnabled(LogLevel logLevel) + { + foreach (var logger in _loggers) + { + if (logger.IsEnabled(logLevel)) + { + return true; + } + } + + return false; + } + + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) + { + foreach (var logger in _loggers) + { + if (logger.IsEnabled(logLevel)) + { + logger.Log(logLevel, state, exception, formatter); + } + } + } + + internal void AddLogger(ILogger logger) + { + ImmutableInterlocked.Update(ref _loggers, (set, l) => set.Add(l), logger); + } + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs index 857827b29e2..2b3a44eb934 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs @@ -1,41 +1,49 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; -using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.CodeAnalysis.Razor.Logging; -internal abstract class AbstractRazorLoggerFactory : IRazorLoggerFactory +internal abstract partial class AbstractRazorLoggerFactory : IRazorLoggerFactory { - private readonly ILoggerFactory _loggerFactory; + private ImmutableDictionary _loggers; + private ImmutableArray _providers; protected AbstractRazorLoggerFactory(ImmutableArray providers) { - _loggerFactory = LoggerFactory.Create(b => - { - // We let everything through, and expect individual loggers to control their own levels - b.AddFilter(level => true); - - foreach (var provider in providers) - { - b.AddProvider(provider); - } - }); + _providers = providers; + _loggers = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase); } public ILogger CreateLogger(string categoryName) { - return _loggerFactory.CreateLogger(categoryName); - } + if (_loggers.TryGetValue(categoryName, out var logger)) + { + return logger; + } - public void AddLoggerProvider(IRazorLoggerProvider provider) - { - _loggerFactory.AddProvider(provider); + using var loggers = new PooledArrayBuilder(_providers.Length); + + foreach (var provider in _providers) + { + loggers.Add(provider.CreateLogger(categoryName)); + } + + var result = new AggregateLogger(loggers.DrainToImmutable()); + return ImmutableInterlocked.AddOrUpdate(ref _loggers, categoryName, result, (k, v) => v); } - public void Dispose() + public void AddLoggerProvider(IRazorLoggerProvider provider) { - _loggerFactory.Dispose(); + if (ImmutableInterlocked.Update(ref _providers, (set, p) => set.Add(p), provider)) + { + foreach (var entry in _loggers) + { + entry.Value.AddLogger(provider.CreateLogger(entry.Key)); + } + } } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILogger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILogger.cs new file mode 100644 index 00000000000..a00d7b6a661 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILogger.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.CodeAnalysis.Razor.Logging; + +internal interface ILogger +{ + void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter); + + bool IsEnabled(LogLevel logLevel); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs new file mode 100644 index 00000000000..44549c618cb --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs @@ -0,0 +1,59 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.CodeAnalysis.Razor.Logging; + +internal static class ILoggerExtensions +{ + public static void LogTrace(this ILogger logger, string? message, params object?[] args) + { + Log(logger, LogLevel.Trace, exception: null, message, args); + } + + public static void LogDebug(this ILogger logger, string? message, params object?[] args) + { + Log(logger, LogLevel.Debug, exception: null, message, args); + } + + public static void LogInformation(this ILogger logger, string? message, params object?[] args) + { + Log(logger, LogLevel.Information, exception: null, message, args); + } + + public static void LogWarning(this ILogger logger, string? message, params object?[] args) + { + Log(logger, LogLevel.Warning, exception: null, message, args); + } + + public static void LogWarning(this ILogger logger, Exception exception, string? message, params object?[] args) + { + Log(logger, LogLevel.Warning, exception, message, args); + } + + public static void LogError(this ILogger logger, string? message, params object?[] args) + { + Log(logger, LogLevel.Error, exception: null, message, args); + } + + public static void LogError(this ILogger logger, Exception exception, string? message, params object?[] args) + { + Log(logger, LogLevel.Error, exception, message, args); + } + + public static void LogCritical(this ILogger logger, Exception exception, string? message, params object?[] args) + { + Log(logger, LogLevel.Critical, exception, message, args); + } + + private static void Log(ILogger logger, LogLevel level, Exception? exception, string? message, object?[] args) + { + logger.Log(level, (message, args), exception, FormatMessage); + } + + private static string FormatMessage((string? message, object?[] args) s, Exception? exception) + { + return s.message is null ? "[null]" : string.Format(s.message, s.args); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs index 03c0de5e3c8..e497569b621 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs @@ -1,13 +1,10 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; -using Microsoft.Extensions.Logging; - namespace Microsoft.CodeAnalysis.Razor.Logging; // Our version of ILoggerFactory, so that we're not MEF importing general use types -internal interface IRazorLoggerFactory : IDisposable +internal interface IRazorLoggerFactory { void AddLoggerProvider(IRazorLoggerProvider provider); ILogger CreateLogger(string categoryName); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs index 5cf892be690..632b086f429 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Razor.Logging; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs index 1763d269093..c0d5ac5812b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs @@ -1,11 +1,10 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.Extensions.Logging; - namespace Microsoft.CodeAnalysis.Razor.Logging; // Very very light wrapper for ILoggerProvider, so that we're not MEF importing general use types -internal interface IRazorLoggerProvider : ILoggerProvider +internal interface IRazorLoggerProvider { + ILogger CreateLogger(string categoryName); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/LogLevel.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/LogLevel.cs new file mode 100644 index 00000000000..a5d591f995e --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/LogLevel.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Razor.Logging; + +internal enum LogLevel +{ + Trace, + Debug, + Information, + Warning, + Error, + Critical, + None +} From 50475a5258184a4bc5b08f2753f5504b69ad08d1 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 14:52:42 +1100 Subject: [PATCH 03/10] Replace IOptionsMonitor with just our implementation --- .../RazorLSPOptionsMonitor.cs | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLSPOptionsMonitor.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLSPOptionsMonitor.cs index 65c969ca342..ff1d28611cc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLSPOptionsMonitor.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLSPOptionsMonitor.cs @@ -5,43 +5,29 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Razor.LanguageServer; -internal class RazorLSPOptionsMonitor : IOptionsMonitor +internal class RazorLSPOptionsMonitor { private readonly IConfigurationSyncService _configurationService; - private readonly IOptionsMonitorCache _cache; - private event Action? OnChangeEvent; + private event Action? OnChangeEvent; private RazorLSPOptions _currentValue; - public RazorLSPOptionsMonitor(IConfigurationSyncService configurationService, IOptionsMonitorCache cache, RazorLSPOptions currentOptions) + public RazorLSPOptionsMonitor(IConfigurationSyncService configurationService, RazorLSPOptions currentOptions) { if (configurationService is null) { throw new ArgumentNullException(nameof(configurationService)); } - if (cache is null) - { - throw new ArgumentNullException(nameof(cache)); - } - _configurationService = configurationService; - _cache = cache; _currentValue = currentOptions; } - public RazorLSPOptions CurrentValue => Get(Options.DefaultName); - - public RazorLSPOptions Get(string name) - { - name ??= Options.DefaultName; - return _cache.GetOrAdd(name, () => _currentValue); - } + public RazorLSPOptions CurrentValue => _currentValue; - public IDisposable OnChange(Action listener) + public IDisposable OnChange(Action listener) { var disposable = new ChangeTrackerDisposable(this, listener); OnChangeEvent += disposable.OnChange; @@ -60,24 +46,21 @@ public virtual async Task UpdateAsync(CancellationToken cancellationToken = defa private void InvokeChanged() { - var name = Options.DefaultName; - _cache.TryRemove(name); - var options = Get(name); - OnChangeEvent?.Invoke(options, name); + OnChangeEvent?.Invoke(_currentValue); } internal class ChangeTrackerDisposable : IDisposable { - private readonly Action _listener; + private readonly Action _listener; private readonly RazorLSPOptionsMonitor _monitor; - public ChangeTrackerDisposable(RazorLSPOptionsMonitor monitor, Action listener) + public ChangeTrackerDisposable(RazorLSPOptionsMonitor monitor, Action listener) { _listener = listener; _monitor = monitor; } - public void OnChange(RazorLSPOptions options, string name) => _listener.Invoke(options, name); + public void OnChange(RazorLSPOptions options) => _listener.Invoke(options); public void Dispose() => _monitor.OnChangeEvent -= OnChange; } From aa3c40266763d3933061169ae266b8093f21b39c Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 14:52:53 +1100 Subject: [PATCH 04/10] Update calling and consuming code This is mostly mechanical fixing of namespace, plus some test mock changes --- .../RazorCompletionBenchmark.cs | 4 ++- .../RazorLanguageServerBenchmarkBase.cs | 8 +----- .../ProjectSnapshotManagerBenchmarkBase.cs | 1 - .../BenchmarkConfigurationSyncService.cs | 17 +++++++++++ .../Serialization/BenchmarkOptionsMonitor.cs | 28 ------------------- .../CompletionListSerializationBenchmark.cs | 4 ++- .../AbstractRazorDelegatingEndpoint.cs | 2 +- .../AutoClosingTagOnAutoInsertProvider.cs | 7 ++--- .../CloseTextTagOnAutoInsertProvider.cs | 7 ++--- .../AutoInsert/OnAutoInsertEndpoint.cs | 6 ++-- ...AttributeValuesDocumentPositionStrategy.cs | 2 +- .../CodeActions/CodeActionEndpoint.cs | 1 - .../CodeActions/CodeActionResolveEndpoint.cs | 1 - .../ExtractToCodeBehindCodeActionProvider.cs | 1 - .../AggregateCompletionItemResolver.cs | 1 - .../LegacyRazorCompletionEndpoint.cs | 1 - .../LegacyRazorCompletionResolveEndpoint.cs | 1 - .../Completion/RazorCompletionEndpoint.cs | 7 ++--- .../Completion/RazorCompletionListProvider.cs | 1 - .../Completion/TagHelperCompletionProvider.cs | 6 ++-- .../Debugging/RazorBreakpointSpanEndpoint.cs | 1 - .../RazorProximityExpressionsEndpoint.cs | 1 - .../ValidateBreakpointRangeEndpoint.cs | 1 - .../DefaultDocumentPositionInfoStrategy.cs | 2 +- .../DefaultRazorComponentSearchEngine.cs | 1 - .../DefaultRazorConfigurationService.cs | 1 - .../Definition/DefinitionEndpoint.cs | 1 - .../Diagnostics/RazorDiagnosticsPublisher.cs | 1 - .../RazorTranslateDiagnosticsEndpoint.cs | 1 - .../RazorTranslateDiagnosticsService.cs | 1 - .../DirectoryHelper.cs | 2 +- .../DocumentContextFactory.cs | 1 - .../DocumentHighlightEndpoint.cs | 1 - ...actTextDocumentPresentationEndpointBase.cs | 2 +- .../TextDocumentUriPresentationEndpoint.cs | 1 - .../DocumentDidChangeEndpoint.cs | 1 - .../DocumentDidSaveEndpoint.cs | 1 - .../IServiceCollectionExtensions.cs | 4 --- .../FindAllReferencesEndpoint.cs | 1 - .../Folding/FoldingRangeEndpoint.cs | 3 -- .../Formatting/CSharpFormattingPass.cs | 1 - .../Formatting/CSharpOnTypeFormattingPass.cs | 6 ++-- .../Formatting/DocumentFormattingEndpoint.cs | 6 ++-- .../DocumentOnTypeFormattingEndpoint.cs | 7 ++--- .../DocumentRangeFormattingEndpoint.cs | 6 ++-- .../FormattingContentValidationPass.cs | 1 - .../FormattingDiagnosticValidationPass.cs | 1 - .../Formatting/HtmlFormattingPass.cs | 6 ++-- .../Formatting/RazorFormattingPass.cs | 6 ++-- .../GeneratedDocumentPublisher.cs | 1 - .../Hosting/ClaspLoggingBridge.cs | 16 ----------- .../Hosting/LspLogger.cs | 16 ++--------- .../Hover/HoverEndpoint.cs | 1 - .../IDocumentPositionInfoStrategy.cs | 2 +- .../ILoggerExtensions.cs | 2 +- .../Implementation/ImplementationEndpoint.cs | 1 - .../InlineCompletionEndPoint.cs | 1 - .../LanguageServerErrorReporter.cs | 1 - .../LinkedEditingRangeEndpoint.cs | 1 - .../LspProjectEngineFactoryProvider.cs | 8 ++---- .../Mapping/RazorLanguageQueryEndpoint.cs | 1 - ...tributeNameDocumentPositionInfoStrategy.cs | 2 +- .../ProjectConfigurationFileChangeDetector.cs | 3 -- .../ProjectConfigurationStateSynchronizer.cs | 1 - ...torProjectConfigurationFilePathEndpoint.cs | 1 - .../ProjectSystem/RazorProjectService.cs | 1 - .../ProjectSystem/SnapshotResolver.cs | 1 - .../RazorConfigurationEndpoint.cs | 1 - .../RazorDocumentMappingService.cs | 1 - ...azorLanguageServer.LoggerFactoryWrapper.cs | 6 ---- .../RazorLanguageServer.cs | 3 +- .../RazorRequestContextFactory.cs | 1 - .../Refactoring/RenameEndpoint.cs | 1 - .../LSPCSharpSemanticTokensProvider.cs | 1 - .../SignatureHelp/SignatureHelpEndpoint.cs | 4 +-- .../WorkspaceSemanticTokensRefreshNotifier.cs | 2 +- .../WrapWithTag/WrapWithTagEndpoint.cs | 1 - .../AbstractRazorDocumentMappingService.cs | 2 +- .../Extensions/LinePositionExtensions.cs | 2 +- .../Extensions/PositionExtensions.cs | 2 +- .../Extensions/RazorSyntaxTreeExtensions.cs | 2 +- .../Extensions/SourceTextExtensions.cs | 2 +- .../AbstractRazorSemanticTokensInfoService.cs | 2 +- .../Settings/ClientSettings.cs | 2 +- .../Logging/RemoteLoggerFactory.Logger.cs | 6 ++-- .../Logging/RemoteLoggerFactory.cs | 1 - .../RazorSemanticTokensInfoService.cs | 3 +- .../Snippets/XmlSnippetParser.cs | 2 +- .../Telemetry/VSTelemetryReporter.cs | 1 - .../CSharpVirtualDocumentAddListener.cs | 1 - .../CSharpVirtualDocumentFactory.cs | 1 - .../CohostSemanticTokensRangeEndpoint.cs | 1 - .../Cohost/CohostTextDocumentSyncHandler.cs | 1 - .../DefaultLSPBreakpointSpanProvider.cs | 1 - .../DefaultLSPProximityExpressionsProvider.cs | 1 - .../Endpoints/Diagnostics.cs | 2 +- .../Endpoints/SemanticTokens.cs | 2 +- .../Endpoints/UpdateCSharpBuffer.cs | 2 +- .../RazorCohostRequestContextExtensions.cs | 2 +- .../Logging/RazorLogHubLogger.cs | 6 ++-- .../Logging/RazorLogHubLoggerProvider.cs | 1 - .../Options/OptionsStorage.cs | 2 +- .../RazorCustomMessageTarget.cs | 1 - .../Logging/MemoryLoggerProvider.Logger.cs | 7 ++--- .../Logging/MemoryLoggerProvider.cs | 1 - .../Logging/OutputWindowLoggerProvider.cs | 8 +----- .../Remote/OutOfProcSemanticTokensService.cs | 1 - .../Options/AdvancedOptionPage.cs | 2 +- .../Options/Readme.md | 2 +- src/Razor/src/rzls/LoggerProvider.cs | 1 - src/Razor/src/rzls/Program.cs | 2 +- .../AutoClosingTagOnAutoInsertProviderTest.cs | 7 ++--- .../CloseTextTagOnAutoInsertProviderTest.cs | 8 +++--- .../TestDelegatedCompletionListProvider.cs | 1 - .../RazorCompletionListProviderTest.cs | 4 +-- .../TestRazorFormattingService.cs | 7 +---- .../Hover/HoverServiceTest.cs | 1 - .../RazorConfigurationEndpointTest.cs | 8 +----- .../RazorLSPOptionsMonitorTest.cs | 14 +++------- .../RazorSemanticTokensRefreshEndpointTest.cs | 6 +--- .../Semantic/SemanticTokensTest.cs | 6 +--- .../SignatureHelpEndpointTest.cs | 4 +-- .../TestRazorLSPOptionsMonitor.cs | 19 +++++-------- ...kspaceSemanticTokensRefreshNotifierTest.cs | 6 +--- .../LanguageServer/LanguageServerTestBase.cs | 12 ++++---- .../Logging/TestOutputLogger.cs | 9 ++---- .../Logging/TestOutputLoggerProvider.cs | 3 +- .../ToolingTestBase.TestErrorReporter.cs | 2 +- .../ToolingTestBase.cs | 2 -- .../AbstractRazorEditorTest.cs | 2 +- .../InProcess/OutputInProcess.cs | 17 +++++++++-- 131 files changed, 139 insertions(+), 329 deletions(-) create mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkConfigurationSyncService.cs delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkOptionsMonitor.cs diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs index 470ad0df740..f8dd46a48b7 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; +using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.AspNetCore.Razor.LanguageServer.Completion; using Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; @@ -47,7 +48,8 @@ public async Task SetupAsync() var delegatedCompletionListProvider = new TestDelegatedCompletionListProvider(responseRewriters, documentMappingService, clientConnection, completionListCache); var completionListProvider = new CompletionListProvider(razorCompletionListProvider, delegatedCompletionListProvider); - var optionsMonitor = new BenchmarkOptionsMonitor(RazorLSPOptions.Default); + var configurationService = new DefaultRazorConfigurationService(clientConnection, loggerFactory); + var optionsMonitor = new RazorLSPOptionsMonitor(configurationService, RazorLSPOptions.Default); CompletionEndpoint = new RazorCompletionEndpoint(completionListProvider, telemetryReporter: null, optionsMonitor, loggerFactory); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs index 815f989742a..da1f9c32dd4 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs @@ -19,7 +19,6 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Nerdbank.Streams; @@ -125,17 +124,12 @@ public void Dispose() internal class NoopLogger : ILogger, ILspLogger { - public IDisposable BeginScope(TState state) - { - throw new NotImplementedException(); - } - public bool IsEnabled(LogLevel logLevel) { return true; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception exception, Func formatter) { } diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs index b7a3be10427..61fbeae62bf 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Moq; namespace Microsoft.AspNetCore.Razor.Microbenchmarks; diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkConfigurationSyncService.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkConfigurationSyncService.cs new file mode 100644 index 00000000000..eb9ce26a080 --- /dev/null +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkConfigurationSyncService.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.LanguageServer; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; + +namespace Microsoft.AspNetCore.Razor.Microbenchmarks.Serialization; + +internal class BenchmarkConfigurationSyncService : IConfigurationSyncService +{ + public Task GetLatestOptionsAsync(CancellationToken cancellationToken) + { + return Task.FromResult(null); + } +} diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkOptionsMonitor.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkOptionsMonitor.cs deleted file mode 100644 index b27463767e1..00000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/BenchmarkOptionsMonitor.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.Extensions.Options; - -namespace Microsoft.AspNetCore.Razor.Microbenchmarks.Serialization; - -internal class BenchmarkOptionsMonitor : IOptionsMonitor -{ - public BenchmarkOptionsMonitor(T value) - { - CurrentValue = value; - } - - public T CurrentValue { get; } - - public T Get(string name) => CurrentValue; - - public IDisposable OnChange(Action listener) => new Disposable(); - - private class Disposable : IDisposable - { - public void Dispose() - { - } - } -} diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/CompletionListSerializationBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/CompletionListSerializationBenchmark.cs index 83ca12d7f64..811f9e7d574 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/CompletionListSerializationBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Serialization/CompletionListSerializationBenchmark.cs @@ -5,6 +5,7 @@ using System.Text; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.AspNetCore.Razor.LanguageServer.Completion; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Completion; @@ -24,7 +25,8 @@ public class CompletionListSerializationBenchmark public CompletionListSerializationBenchmark() { var completionService = new LspTagHelperCompletionService(); - var optionsMonitor = new BenchmarkOptionsMonitor(RazorLSPOptions.Default); + var configurationService = new BenchmarkConfigurationSyncService(); + var optionsMonitor = new RazorLSPOptionsMonitor(configurationService, RazorLSPOptions.Default); var tagHelperCompletionProvider = new TagHelperCompletionProvider(completionService, optionsMonitor); _serializer = JsonSerializer.Create(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs index 25cffbb9a0f..c5d7eb826ea 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs @@ -9,9 +9,9 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Telemetry; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using StreamJsonRpc; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs index c9443dfec11..2eb628eba72 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs @@ -8,11 +8,8 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; @@ -41,10 +38,10 @@ internal sealed class AutoClosingTagOnAutoInsertProvider : IOnAutoInsertProvider ); private static readonly ImmutableHashSet s_voidElementsCaseSensitive = s_voidElements.WithComparer(StringComparer.Ordinal); - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; private readonly ILogger _logger; - public AutoClosingTagOnAutoInsertProvider(IOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) + public AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) { if (optionsMonitor is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs index 5164b71b3a1..2a811bd4b44 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs @@ -8,21 +8,18 @@ using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; internal sealed class CloseTextTagOnAutoInsertProvider : IOnAutoInsertProvider { - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; private readonly ILogger _logger; - public CloseTextTagOnAutoInsertProvider(IOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) + public CloseTextTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) { if (optionsMonitor is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index 6500b92fb3d..461fe68a16a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -14,8 +14,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; @@ -26,7 +24,7 @@ internal class OnAutoInsertEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IEnumerable onAutoInsertProvider, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()), ICapabilitiesProvider { @@ -34,7 +32,7 @@ internal class OnAutoInsertEndpoint( private static readonly HashSet s_cSharpAllowedTriggerCharacters = new(StringComparer.Ordinal) { "'", "/", "\n" }; private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions)); - private readonly IOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); private readonly IReadOnlyList _onAutoInsertProviders = onAutoInsertProvider?.ToList() ?? throw new ArgumentNullException(nameof(onAutoInsertProvider)); protected override string CustomMessageTarget => CustomMessageNames.RazorOnAutoInsertEndpointName; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs index ea3ccde841b..70454c11b6a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs @@ -5,9 +5,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs index 44cd850d306..5e5a098090e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs @@ -21,7 +21,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.CodeActions; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using StreamJsonRpc; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs index acf4f940157..283708b8b93 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs @@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json.Linq; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs index 6656104acf5..abeb71dd6b1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs @@ -16,7 +16,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs index 5351da8a910..36e78273756 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs @@ -7,7 +7,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs index f5c64f4ca04..4ff60e702f7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Razor.Completion; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs index 710b551b286..f8678e630a4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Completion; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text.Adornments; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs index 748ab3269b9..d25785b4e95 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -7,12 +7,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Telemetry; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; @@ -20,13 +17,13 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; internal class RazorCompletionEndpoint( CompletionListProvider completionListProvider, ITelemetryReporter? telemetryReporter, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) : IVSCompletionEndpoint { private readonly CompletionListProvider _completionListProvider = completionListProvider; private readonly ITelemetryReporter? _telemetryReporter = telemetryReporter; - private readonly IOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly ILogger _logger = loggerFactory.CreateLogger(); private VSInternalClientCapabilities? _clientCapabilities; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs index 480f9f88e14..f60247d75c7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/TagHelperCompletionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/TagHelperCompletionProvider.cs index 40a8181277e..45eaf100a43 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/TagHelperCompletionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/TagHelperCompletionProvider.cs @@ -9,11 +9,9 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.Completion; using Microsoft.CodeAnalysis.Razor.Tooltip; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.Editor.Razor; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; @@ -29,11 +27,11 @@ internal class TagHelperCompletionProvider : IRazorCompletionItemProvider private static readonly ImmutableArray s_elementCommitCharacters_WithoutSpace = RazorCommitCharacter.CreateArray([">"]); private readonly ITagHelperCompletionService _tagHelperCompletionService; - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; public TagHelperCompletionProvider( ITagHelperCompletionService tagHelperCompletionService, - IOptionsMonitor optionsMonitor) + RazorLSPOptionsMonitor optionsMonitor) { _tagHelperCompletionService = tagHelperCompletionService; _optionsMonitor = optionsMonitor; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs index d25377e6b23..781a73155ea 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs @@ -15,7 +15,6 @@ using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs index 5c9fea53968..3f4429644d8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs @@ -15,7 +15,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs index cfd67d62f05..ae6cab7cd88 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs index 5d927303e09..c421b4e8e97 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs @@ -4,9 +4,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs index d5cc8fb4884..534d9b677aa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs index 68d6e9e1993..f4df8805e33 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs @@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Settings; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs index 7ebc1f43a2b..fb864ac5026 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs @@ -16,7 +16,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using DefinitionResult = Microsoft.VisualStudio.LanguageServer.Protocol.SumType< Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs index 7a82dd04f50..019d03a5c22 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Threading; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs index f1440fb1449..a1e1ceada39 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Diagnostics; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs index 18d74c32f4f..7bf615ec099 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs @@ -16,7 +16,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Diagnostic = Microsoft.VisualStudio.LanguageServer.Protocol.Diagnostic; using DiagnosticSeverity = Microsoft.VisualStudio.LanguageServer.Protocol.DiagnosticSeverity; using Position = Microsoft.VisualStudio.LanguageServer.Protocol.Position; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs index 859f87f208c..cfc2e6cd256 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs @@ -6,7 +6,7 @@ using System.IO; using System.Linq; using Microsoft.CodeAnalysis.Razor; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs index 9c603951971..b1677b602e8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs index a59a1e60e3b..0fe45e83aaf 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentHighlighting; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs index 21cbd83f3bc..87ea3bb798a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs @@ -11,11 +11,11 @@ using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.DocumentPresentation; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentPresentation; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs index e5041f357d5..69602e60c16 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs @@ -16,7 +16,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.DocumentPresentation; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentPresentation; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs index 2d485f44915..f05b11df641 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs index c15899f843e..31c94395262 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index db727510bfe..a79efd8810e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -30,7 +30,6 @@ using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Extensions; @@ -194,11 +193,8 @@ public static void AddOptionsServices(this IServiceCollection services, RazorLSP { return new RazorLSPOptionsMonitor( s.GetRequiredService(), - s.GetRequiredService>(), currentOptions); }); - - services.AddSingleton, RazorLSPOptionsMonitor>(s => s.GetRequiredService()); } public static void AddDocumentManagementServices(this IServiceCollection services, LanguageServerFeatureOptions featureOptions) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs index aea07ae9e5b..68d7151281b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text.Adornments; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs index fde872180a2..8abf339d8ee 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs @@ -17,7 +17,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Folding; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Folding; @@ -56,8 +55,6 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(FoldingRangeParams reque public async Task?> HandleRequestAsync(FoldingRangeParams @params, RazorRequestContext requestContext, CancellationToken cancellationToken) { - using var _ = _logger.BeginScope("FoldingRangeEndpoint.Handle"); - var documentContext = requestContext.DocumentContext; if (documentContext is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs index 76c4a123765..a00bb4406a9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs index 88de23f6483..bdf0a104b6e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs @@ -21,8 +21,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; @@ -32,12 +30,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class CSharpOnTypeFormattingPass : CSharpFormattingPassBase { private readonly ILogger _logger; - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; public CSharpOnTypeFormattingPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index 24f67f8afcb..1c074702874 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -6,8 +6,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -16,11 +14,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class DocumentFormattingEndpoint : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService; - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; public DocumentFormattingEndpoint( IRazorFormattingService razorFormattingService, - IOptionsMonitor optionsMonitor) + RazorLSPOptionsMonitor optionsMonitor) { _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index a723df1cf28..db0efdb06a9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -9,13 +9,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -24,13 +21,13 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class DocumentOnTypeFormattingEndpoint( IRazorFormattingService razorFormattingService, IRazorDocumentMappingService razorDocumentMappingService, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); private readonly IRazorDocumentMappingService _razorDocumentMappingService = razorDocumentMappingService ?? throw new ArgumentNullException(nameof(razorDocumentMappingService)); - private readonly IOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); private readonly ILogger _logger = loggerFactory.CreateLogger(); private static readonly IReadOnlyList s_csharpTriggerCharacters = new[] { "}", ";" }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index d92100b8b7f..414a1bf1ef5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -6,8 +6,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -16,11 +14,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class DocumentRangeFormattingEndpoint : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService; - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; public DocumentRangeFormattingEndpoint( IRazorFormattingService razorFormattingService, - IOptionsMonitor optionsMonitor) + RazorLSPOptionsMonitor optionsMonitor) { _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs index f7d3c210cc1..954eed085e5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs index 1524295be61..bdc625d2964 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs index 30a49a33bb1..b00e124a7e9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs @@ -14,8 +14,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; @@ -24,13 +22,13 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class HtmlFormattingPass : FormattingPassBase { private readonly ILogger _logger; - private readonly IOptionsMonitor _optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor; public HtmlFormattingPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IDocumentVersionCache documentVersionCache, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs index bc534c96a43..1b3e806c5a7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs @@ -14,8 +14,6 @@ using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -23,12 +21,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class RazorFormattingPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) : FormattingPassBase(documentMappingService, clientConnection) { private readonly ILogger _logger = loggerFactory.CreateLogger(); - private readonly IOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; // Run after the C# formatter pass. public override int Order => DefaultOrder - 4; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index fdd4c21bb09..0d50c02278f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs index f0001c41bb3..810af2cbbb7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Razor.Telemetry; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.Hosting; @@ -27,21 +26,6 @@ public ClaspLoggingBridge(IRazorLoggerFactory loggerFactory, ITelemetryReporter? _telemetryReporter = telemetryReporter; } - public IDisposable BeginScope(TState state) - { - return _logger.BeginScope(state); - } - - public bool IsEnabled(LogLevel logLevel) - { - return _logger.IsEnabled(logLevel); - } - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) - { - _logger.Log(logLevel, eventId, state, exception, formatter); - } - public void LogStartContext(string message, params object[] @params) { // This is a special log message formatted so that the LogHub logger can detect it, and trigger the right trace event diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspLogger.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspLogger.cs index 92dc23724f7..f73f87ed56c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspLogger.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspLogger.cs @@ -3,7 +3,7 @@ using System; using System.Threading; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Hosting; @@ -24,17 +24,12 @@ public LspLogger(string categoryName, LogLevel logLevel, IClientConnection clien _clientConnection = clientConnection; } - public IDisposable BeginScope(TState state) - { - return new Disposable(); - } - public bool IsEnabled(LogLevel logLevel) { return logLevel >= _logLevel; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { if (!IsEnabled(logLevel)) { @@ -70,11 +65,4 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except _ = _clientConnection.SendNotificationAsync(Methods.WindowLogMessageName, @params, CancellationToken.None); } - - private class Disposable : IDisposable - { - public void Dispose() - { - } - } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs index 7c57c1948b3..efe3f94a466 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Hover; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs index 7410740f36f..b2cdbc19a05 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs @@ -4,8 +4,8 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs index aa8d16440f6..94018346769 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Diagnostics; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs index e9e23cbb1b0..e8293ba8ea7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using ImplementationResult = Microsoft.VisualStudio.LanguageServer.Protocol.SumType< Microsoft.VisualStudio.LanguageServer.Protocol.Location[], diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index 4b1027362a5..dffe0b837ff 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -19,7 +19,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol.Completion; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.InlineCompletion; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs index 8a9f54837f0..d838ee08b7f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs @@ -6,7 +6,6 @@ using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs index 367ea6a1f73..2c65fd4717b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.LinkedEditingRange; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspProjectEngineFactoryProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspProjectEngineFactoryProvider.cs index 745a9a54e49..54e1ef845a9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspProjectEngineFactoryProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspProjectEngineFactoryProvider.cs @@ -3,9 +3,7 @@ using System; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.ProjectEngineHost; -using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Razor.LanguageServer; @@ -14,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; /// and configure every /// with the current code-gen options. /// -internal sealed class LspProjectEngineFactoryProvider(IOptionsMonitor optionsMonitor) : IProjectEngineFactoryProvider +internal sealed class LspProjectEngineFactoryProvider(RazorLSPOptionsMonitor optionsMonitor) : IProjectEngineFactoryProvider { public IProjectEngineFactory GetFactory(RazorConfiguration configuration) { @@ -23,7 +21,7 @@ public IProjectEngineFactory GetFactory(RazorConfiguration configuration) return new Factory(factory, optionsMonitor); } - private class Factory(IProjectEngineFactory innerFactory, IOptionsMonitor optionsMonitor) : IProjectEngineFactory + private class Factory(IProjectEngineFactory innerFactory, RazorLSPOptionsMonitor optionsMonitor) : IProjectEngineFactory { public string ConfigurationName => innerFactory.ConfigurationName; @@ -47,7 +45,7 @@ void Configure(RazorProjectEngineBuilder builder) } } - private class CodeGenFeature(IOptionsMonitor optionsMonitor) : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature + private class CodeGenFeature(RazorLSPOptionsMonitor optionsMonitor) : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature { public int Order { get; set; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs index 15b9c43e66a..1f861744437 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs @@ -9,7 +9,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Mapping; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs index fb501e6249b..bf829aade9e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs @@ -4,9 +4,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs index 421afa2759d..02d944c1376 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; @@ -150,8 +149,6 @@ protected virtual void OnInitializationFinished() // Protected virtual for testing protected virtual IEnumerable GetExistingConfigurationFiles(string workspaceDirectory) { - using var _ = _logger.BeginScope("Searching for existing project configuration files"); - return DirectoryHelper.GetFilteredFiles( workspaceDirectory, _options.ProjectConfigurationFileName, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs index e56d6043ad1..275d343bcb2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs @@ -15,7 +15,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs index c24f6dd2598..fb44e7b5c9f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.ProjectSystem; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs index bfa6dbc1d81..3c6773d6d35 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs @@ -19,7 +19,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs index 58a379a4331..aeaf5b701f5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs index 3e29bd90b04..1496605eb23 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs index 96cc594b905..03d6c56af31 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs @@ -5,7 +5,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs index 507d1d492ad..04b8f3bef3a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; @@ -28,10 +27,5 @@ public ILogger CreateLogger(string categoryName) // It looks weird because the category is surround with square brackets, so this ends up being [LSP][Category] return _loggerFactory.CreateLogger($"LSP][{categoryName}"); } - - public void Dispose() - { - _loggerFactory.Dispose(); - } } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs index 51889eb080e..e4130ec5323 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs @@ -90,8 +90,7 @@ protected override IRequestExecutionQueue ConstructRequestE protected override ILspServices ConstructLspServices() { - var services = new ServiceCollection() - .AddOptions(); + var services = new ServiceCollection(); var loggerFactoryWrapper = new LoggerFactoryWrapper(_loggerFactory); // Wrap the logger factory so that we can add [LSP] to the start of all the categories diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs index 88f7b9ff3e3..cb76e61bba2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs @@ -9,7 +9,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs index b6ab0ce757b..0ebc4f45405 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs @@ -20,7 +20,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Refactoring; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs index 5aa9f675810..48fbbba0e7d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.SemanticTokens; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer.Semantic; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs index f7cb1cab436..27ecb9357c2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs @@ -9,8 +9,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using LS = Microsoft.VisualStudio.LanguageServer.Protocol; @@ -21,7 +19,7 @@ internal sealed class SignatureHelpEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IOptionsMonitor optionsMonitor, + RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerProvider) : AbstractRazorDelegatingEndpoint( languageServerFeatureOptions, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WorkspaceSemanticTokensRefreshNotifier.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WorkspaceSemanticTokensRefreshNotifier.cs index d71a0c57af1..4233dadff58 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WorkspaceSemanticTokensRefreshNotifier.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WorkspaceSemanticTokensRefreshNotifier.cs @@ -49,7 +49,7 @@ public void Dispose() _disposeTokenSource.Dispose(); } - private void HandleOptionsChange(RazorLSPOptions options, string _) + private void HandleOptionsChange(RazorLSPOptions options) { if (options.ColorBackground != _isColoringBackground) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs index 9f1d91f7708..c98ae9056dc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.WrapWithTag; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractRazorDocumentMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractRazorDocumentMappingService.cs index 8ef20fec93f..5bcc6cbaba0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractRazorDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractRazorDocumentMappingService.cs @@ -12,11 +12,11 @@ using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionExtensions.cs index f8e544f3304..0e547fe85a1 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionExtensions.cs @@ -1,8 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Workspaces; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/PositionExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/PositionExtensions.cs index 9dc90a02fdd..767b310176a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/PositionExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/PositionExtensions.cs @@ -4,8 +4,8 @@ using System; using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Workspaces; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs index 3d3b6498435..c5b229d910d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs @@ -6,12 +6,12 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.CodeAnalysis.Razor.Logging; internal static class RazorSyntaxTreeExtensions { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs index b02579ee195..c4d4a1ed24e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs @@ -4,8 +4,8 @@ using System; using System.Diagnostics; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Razor.Workspaces; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs index a8046b2fed2..76a01fc54aa 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs @@ -12,10 +12,10 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Razor.SemanticTokens; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Settings/ClientSettings.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Settings/ClientSettings.cs index 10379aeb4c4..568b7f38da7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Settings/ClientSettings.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Settings/ClientSettings.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.CodeAnalysis.Razor.Settings; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.Logger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.Logger.cs index fd418a01aba..72eabb57b56 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.Logger.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.Logger.cs @@ -3,7 +3,7 @@ using System; using System.Diagnostics; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.CodeAnalysis.Remote.Razor.Logging; @@ -11,11 +11,9 @@ internal partial class RemoteLoggerFactory { private class Logger(string categoryName) : ILogger { - public IDisposable BeginScope(TState state) => Scope.Instance; - public bool IsEnabled(LogLevel logLevel) => true; - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { if (s_traceSource is null) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs index c4f1b3e2d39..42c978688ef 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs @@ -4,7 +4,6 @@ using System.Composition; using System.Diagnostics; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Remote.Razor.Logging; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs index 61e60c540a7..4cfc05db10a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Remote.Razor.DocumentMapping; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Remote.Razor.SemanticTokens; @@ -22,7 +21,7 @@ internal class RazorSemanticTokensInfoService( : AbstractRazorSemanticTokensInfoService( documentMappingService, semanticTokensLegendService, -csharpSemanticTokensProvider, + csharpSemanticTokensProvider, languageServerFeatureOptions, loggerFactory.CreateLogger()) { diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Snippets/XmlSnippetParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Snippets/XmlSnippetParser.cs index e5aa193fa13..93f59342f81 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Snippets/XmlSnippetParser.cs +++ b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Snippets/XmlSnippetParser.cs @@ -3,7 +3,7 @@ using System; using System.IO; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.VisualStudio.Editor.Razor.Snippets; diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs index a79e2f23178..ade04e412d4 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs +++ b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs @@ -5,7 +5,6 @@ using System.Collections.Immutable; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Telemetry; using StreamJsonRpc; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs index b2d2f99522a..1d2569726f9 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs @@ -6,7 +6,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Editor.Razor; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.Utilities; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs index ca91e5bd102..436d05d38f8 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Editor.Razor; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs index d4f1e0d9af8..f888f30caa1 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServerClient.Razor.Extensions; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs index 6ba70e01f47..26e60fd0de6 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Remote; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Threading; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs index 644d141b21c..a0c82e8d086 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs @@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json.Linq; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs index 0d1d2088bd9..4657ed1df12 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json.Linq; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/Diagnostics.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/Diagnostics.cs index b1cb8ab7777..0ebd683253d 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/Diagnostics.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/Diagnostics.cs @@ -4,10 +4,10 @@ using System; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Diagnostics; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServerClient.Razor.Extensions; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/SemanticTokens.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/SemanticTokens.cs index 0fc5f8b5b24..55d45b52b1a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/SemanticTokens.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/SemanticTokens.cs @@ -6,9 +6,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.SemanticTokens; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using StreamJsonRpc; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/UpdateCSharpBuffer.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/UpdateCSharpBuffer.cs index b285113eb74..54c6e9fbfdb 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/UpdateCSharpBuffer.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Endpoints/UpdateCSharpBuffer.cs @@ -6,9 +6,9 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.LanguageServerClient.Razor.Extensions; using StreamJsonRpc; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Extensions/RazorCohostRequestContextExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Extensions/RazorCohostRequestContextExtensions.cs index 98860f63f0b..03dd697637e 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Extensions/RazorCohostRequestContextExtensions.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Extensions/RazorCohostRequestContextExtensions.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.VisualStudio.LanguageServerClient.Razor.Cohost; using StreamJsonRpc; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLogger.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLogger.cs index cf71b981655..d189760a7c5 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLogger.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLogger.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.VisualStudio.Editor.Razor.Logging; namespace Microsoft.VisualStudio.LanguageServerClient.Razor.Logging; @@ -20,14 +20,12 @@ public RazorLogHubLogger(string categoryName, RazorLogHubTraceProvider traceProv _traceProvider = traceProvider; } - public IDisposable BeginScope(TState state) => Scope.Instance; - public bool IsEnabled(LogLevel logLevel) { return true; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { var traceSource = _traceProvider.TryGetTraceSource(); if (traceSource is null) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs index 613fca9ba29..ddbd898f35a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs @@ -3,7 +3,6 @@ using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Editor.Razor.Logging; namespace Microsoft.VisualStudio.LanguageServerClient.Razor.Logging; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Options/OptionsStorage.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Options/OptionsStorage.cs index 213c7bf2e68..4d614dfe702 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Options/OptionsStorage.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Options/OptionsStorage.cs @@ -6,8 +6,8 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Telemetry; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Settings; -using Microsoft.Extensions.Logging; using Microsoft.Internal.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Editor.Razor.Settings; using Microsoft.VisualStudio.Settings; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs index aec678919ac..169a6f089fe 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Editor.Razor.Settings; using Microsoft.VisualStudio.Editor.Razor.Snippets; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.Logger.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.Logger.cs index 5dea7265f67..df626e240f4 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.Logger.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.Logger.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.VisualStudio.LanguageServices.Razor.Logging; @@ -13,13 +13,10 @@ private class Logger(Buffer buffer, string categoryName) : ILogger private readonly Buffer _buffer = buffer; private readonly string _categoryName = categoryName; - public IDisposable BeginScope(TState state) - => Scope.Instance; - public bool IsEnabled(LogLevel logLevel) => true; - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { _buffer.Append($"{DateTime.Now:h:mm:ss.fff} [{_categoryName}] {formatter(state, exception)}"); if (exception is not null) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs index 29b149c721b..439c6b1a126 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs @@ -3,7 +3,6 @@ using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; namespace Microsoft.VisualStudio.LanguageServices.Razor.Logging; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs index 71c9bae068f..59f21c97123 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs @@ -6,7 +6,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Editor.Razor; using Microsoft.VisualStudio.Editor.Razor.Settings; using Microsoft.VisualStudio.Shell; @@ -50,17 +49,12 @@ public OutputPaneLogger(string categoryName, OutputPane outputPane, IClientSetti _clientSettingsManager = clientSettingsManager; } - public IDisposable BeginScope(TState state) - { - return Scope.Instance; - } - public bool IsEnabled(LogLevel logLevel) { return logLevel >= _clientSettingsManager.GetClientSettings().AdvancedSettings.LogLevel; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { if (IsEnabled(logLevel)) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs index a391bed8d5b..ca3d5ccc110 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs @@ -9,7 +9,6 @@ using Microsoft.CodeAnalysis.Razor.Remote; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Editor.Razor.Settings; namespace Microsoft.CodeAnalysis.Remote.Razor; diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/AdvancedOptionPage.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/AdvancedOptionPage.cs index 552e7539e6d..fdddd567f96 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/AdvancedOptionPage.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/AdvancedOptionPage.cs @@ -3,8 +3,8 @@ using System; using System.Runtime.InteropServices; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Settings; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.LanguageServerClient.Razor.Options; using Microsoft.VisualStudio.Shell; diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/Readme.md b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/Readme.md index 0dbb322f4d8..85b1b0258c1 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/Readme.md +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Options/Readme.md @@ -9,4 +9,4 @@ These are the steps needed to add a new option: 3. Add a property with `LocCategory`, `LocDescription`, and `LocDisplayName`, with the argument being the `nameof` operator on the resource accessor. 4. Add the property to the `ClientAdvancedSettings` record and update `OptionsStorage.GetAdvancedSettings` to appropriately construct the type. 5. Add the appropriate setting to `RazorLSPOptions` if it needs to be used on the LSP side. This represents the LSP Server understanding of any client side settings that need to be enabled. There is a constructor that takes `ClientSettings` and applies to properties as needed. -6. In whatever place you need the option, import an `IOptionsMonitor` to get the current value as needed. \ No newline at end of file +6. In whatever place you need the option, import an `RazorLSPOptionsMonitor` to get the current value as needed. \ No newline at end of file diff --git a/src/Razor/src/rzls/LoggerProvider.cs b/src/Razor/src/rzls/LoggerProvider.cs index c945bb8b571..2a2527f0321 100644 --- a/src/Razor/src/rzls/LoggerProvider.cs +++ b/src/Razor/src/rzls/LoggerProvider.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/rzls/Program.cs b/src/Razor/src/rzls/Program.cs index a5299e284ab..2b7cf1ba999 100644 --- a/src/Razor/src/rzls/Program.cs +++ b/src/Razor/src/rzls/Program.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Telemetry; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs index e4c2d51b252..62dfbe5e0c6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common; -using Microsoft.Extensions.Options; using Moq; using Xunit; using Xunit.Abstractions; @@ -950,10 +949,10 @@ public void OnTypeCloseAngle_AutoInsertDisabled_Noops() internal override IOnAutoInsertProvider CreateProvider() { - var optionsMonitor = new Mock>(MockBehavior.Strict); - optionsMonitor.SetupGet(o => o.CurrentValue).Returns(Options); + var configService = StrictMock.Of(); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, Options); - var provider = new AutoClosingTagOnAutoInsertProvider(optionsMonitor.Object, LoggerFactory); + var provider = new AutoClosingTagOnAutoInsertProvider(optionsMonitor, LoggerFactory); return provider; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs index 6d0c0c9e8ca..53d858846da 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.Extensions.Options; +using Microsoft.AspNetCore.Razor.Test.Common; using Moq; using Xunit; using Xunit.Abstractions; @@ -41,10 +41,10 @@ public void OnTypeCloseAngle_OutsideRazorBlock_DoesNotCloseTextTag() internal override IOnAutoInsertProvider CreateProvider() { - var optionsMonitor = new Mock>(MockBehavior.Strict); - optionsMonitor.SetupGet(o => o.CurrentValue).Returns(RazorLSPOptions.Default); - var provider = new CloseTextTagOnAutoInsertProvider(optionsMonitor.Object, LoggerFactory); + var configService = StrictMock.Of(); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, RazorLSPOptions.Default); + var provider = new CloseTextTagOnAutoInsertProvider(optionsMonitor, LoggerFactory); return provider; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs index ce8662bc153..3d4f3141a7e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs index d5b73c67538..e21f59116c0 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs @@ -9,13 +9,11 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Components; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.Completion; using Microsoft.CodeAnalysis.Razor.Tooltip; using Microsoft.CodeAnalysis.Testing; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json; using Xunit; @@ -58,7 +56,7 @@ public RazorCompletionListProviderTest(ITestOutputHelper testOutput) _defaultCompletionContext = new VSInternalCompletionContext(); } - private static IEnumerable GetCompletionProviders(IOptionsMonitor optionsMonitor = null) + private static IEnumerable GetCompletionProviders(RazorLSPOptionsMonitor optionsMonitor = null) { // Working around strong naming restriction. var tagHelperCompletionService = new LspTagHelperCompletionService(); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index d7a873f6d12..970dcfd5289 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -13,8 +13,6 @@ using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.Extensions.Options; using Moq; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -51,11 +49,8 @@ await dispatcher.RunAsync(() => .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) .Returns(Task.FromResult(razorLSPOptions)); - var optionsMonitorCache = new OptionsCache(); - var optionsMonitor = TestRazorLSPOptionsMonitor.Create( - configurationSyncService.Object, - optionsMonitorCache); + configurationSyncService.Object); if (razorLSPOptions is not null) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs index 380b09a63ae..13def471594 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs @@ -4,7 +4,6 @@ #nullable disable using System; -using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorConfigurationEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorConfigurationEndpointTest.cs index 272111a62fb..c044d347085 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorConfigurationEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorConfigurationEndpointTest.cs @@ -5,8 +5,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; @@ -16,15 +14,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; public class RazorConfigurationEndpointTest : LanguageServerTestBase { - private readonly IOptionsMonitorCache _cache; private readonly IConfigurationSyncService _configurationService; public RazorConfigurationEndpointTest(ITestOutputHelper testOutput) : base(testOutput) { - var services = new ServiceCollection().AddOptions(); - _cache = services.BuildServiceProvider().GetRequiredService>(); - var configServiceMock = new Mock(MockBehavior.Strict); configServiceMock .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) @@ -37,7 +31,7 @@ public RazorConfigurationEndpointTest(ITestOutputHelper testOutput) public async Task Handle_UpdatesOptions() { // Arrange - var optionsMonitor = TestRazorLSPOptionsMonitor.Create(_configurationService, _cache); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(_configurationService); var endpoint = new RazorConfigurationEndpoint(optionsMonitor, LoggerFactory); var request = new DidChangeConfigurationParams(); var requestContext = CreateRazorRequestContext(documentContext: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorLSPOptionsMonitorTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorLSPOptionsMonitorTest.cs index a20f6a0556c..923c290ca46 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorLSPOptionsMonitorTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorLSPOptionsMonitorTest.cs @@ -6,8 +6,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using Moq; using Xunit; using Xunit.Abstractions; @@ -16,13 +14,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; public class RazorLSPOptionsMonitorTest : ToolingTestBase { - private readonly IOptionsMonitorCache _cache; - public RazorLSPOptionsMonitorTest(ITestOutputHelper testOutput) : base(testOutput) { - var services = new ServiceCollection().AddOptions(); - _cache = services.BuildServiceProvider().GetRequiredService>(); } [Fact] @@ -33,7 +27,7 @@ public async Task UpdateAsync_Invokes_OnChangeRegistration() var configService = Mock.Of( f => f.GetLatestOptionsAsync(DisposalToken) == Task.FromResult(expectedOptions), MockBehavior.Strict); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, _cache, RazorLSPOptions.Default); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, RazorLSPOptions.Default); var called = false; // Act & Assert @@ -55,7 +49,7 @@ public async Task UpdateAsync_DoesNotInvoke_OnChangeRegistration_AfterDispose() var configService = Mock.Of( f => f.GetLatestOptionsAsync(DisposalToken) == Task.FromResult(expectedOptions), MockBehavior.Strict); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, _cache, RazorLSPOptions.Default); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, RazorLSPOptions.Default); var called = false; var onChangeToken = optionsMonitor.OnChange(options => called = true); @@ -82,7 +76,7 @@ public async Task UpdateAsync_ConfigReturnsNull_DoesNotInvoke_OnChangeRegistrati Mock.Get(configService) .Setup(s => s.GetLatestOptionsAsync(DisposalToken)) .ReturnsAsync(value: null); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, _cache, RazorLSPOptions.Default); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, RazorLSPOptions.Default); var called = false; var onChangeToken = optionsMonitor.OnChange(options => called = true); @@ -101,7 +95,7 @@ public void InitializedOptionsAreCurrent() var configService = Mock.Of( f => f.GetLatestOptionsAsync(DisposalToken) == Task.FromResult(expectedOptions), MockBehavior.Strict); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, _cache, expectedOptions); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, expectedOptions); // Act & Assert Assert.Same(expectedOptions, optionsMonitor.CurrentValue); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/RazorSemanticTokensRefreshEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/RazorSemanticTokensRefreshEndpointTest.cs index 8b915342066..5211453c5da 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/RazorSemanticTokensRefreshEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/RazorSemanticTokensRefreshEndpointTest.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.SemanticTokens; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; @@ -62,11 +61,8 @@ private static RazorLSPOptionsMonitor GetOptionsMonitor() .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) .Returns(Task.FromResult(options)); - var optionsMonitorCache = new OptionsCache(); - var optionsMonitor = TestRazorLSPOptionsMonitor.Create( - configurationSyncService.Object, - optionsMonitorCache); + configurationSyncService.Object); return optionsMonitor; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs index 2027d8e6061..bef1fa86c72 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs @@ -27,7 +27,6 @@ using Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.SemanticTokens; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; @@ -992,11 +991,8 @@ private async Task CreateServiceAsync( .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) .Returns(Task.FromResult(options)); - var optionsMonitorCache = new OptionsCache(); - var optionsMonitor = TestRazorLSPOptionsMonitor.Create( - configurationSyncService.Object, - optionsMonitorCache); + configurationSyncService.Object); await optionsMonitor.UpdateAsync(CancellationToken.None); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs index 90dd4b68932..a04ee0e851e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs @@ -6,12 +6,10 @@ using System; using System.Collections.Immutable; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -93,7 +91,7 @@ private Task VerifySignatureHelpAsync(string input, params string[] signatures) return VerifySignatureHelpWithContextAndOptionsAsync(input, optionsMonitor: null, signatureHelpContext: null, signatures); } - private async Task VerifySignatureHelpWithContextAndOptionsAsync(string input, IOptionsMonitor optionsMonitor = null, SignatureHelpContext signatureHelpContext = null, params string[] signatures) + private async Task VerifySignatureHelpWithContextAndOptionsAsync(string input, RazorLSPOptionsMonitor optionsMonitor = null, SignatureHelpContext signatureHelpContext = null, params string[] signatures) { // Arrange TestFileMarkupParser.GetPositionAndSpans(input, out var output, out int cursorPosition, out ImmutableArray _); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorLSPOptionsMonitor.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorLSPOptionsMonitor.cs index 1ca6453676f..497c71c42b9 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorLSPOptionsMonitor.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorLSPOptionsMonitor.cs @@ -5,21 +5,18 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Razor.LanguageServer; internal class TestRazorLSPOptionsMonitor : RazorLSPOptionsMonitor { - private readonly IConfigurationSyncService _configuruationSyncService; + private readonly IConfigurationSyncService _configurationSyncService; private TestRazorLSPOptionsMonitor( - IConfigurationSyncService configurationService, - IOptionsMonitorCache cache) - : base(configurationService, cache, RazorLSPOptions.Default) + IConfigurationSyncService configurationService) + : base(configurationService, RazorLSPOptions.Default) { - _configuruationSyncService = configurationService; + _configurationSyncService = configurationService; } public bool Called { get; private set; } @@ -32,7 +29,7 @@ public override Task UpdateAsync(CancellationToken cancellationToken) public Task UpdateAsync(RazorLSPOptions options, CancellationToken cancellationToken) { - if (_configuruationSyncService is not ConfigurationSyncService configurationSyncService) + if (_configurationSyncService is not ConfigurationSyncService configurationSyncService) { throw new InvalidOperationException(); } @@ -42,13 +39,11 @@ public Task UpdateAsync(RazorLSPOptions options, CancellationToken cancellationT } public static TestRazorLSPOptionsMonitor Create( - IConfigurationSyncService? configurationService = null, - IOptionsMonitorCache? cache = null) + IConfigurationSyncService? configurationService = null) { configurationService ??= new ConfigurationSyncService(); - cache ??= new ServiceCollection().AddOptions().BuildServiceProvider().GetRequiredService>(); - return new(configurationService, cache); + return new(configurationService); } private class ConfigurationSyncService : IConfigurationSyncService diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WorkspaceSemanticTokensRefreshNotifierTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WorkspaceSemanticTokensRefreshNotifierTest.cs index fb3151c2f5e..3cf9d0fbc02 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WorkspaceSemanticTokensRefreshNotifierTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WorkspaceSemanticTokensRefreshNotifierTest.cs @@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Test; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; @@ -106,11 +105,8 @@ private static TestRazorLSPOptionsMonitor GetOptionsMonitor(bool withCSharpBackg .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) .Returns(Task.FromResult(options)); - var optionsMonitorCache = new OptionsCache(); - var optionsMonitor = TestRazorLSPOptionsMonitor.Create( - configurationSyncService.Object, - optionsMonitorCache); + configurationSyncService.Object); return optionsMonitor; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs index 1fea3218b7d..15ac2df8687 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs @@ -21,11 +21,11 @@ using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.Extensions.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Newtonsoft.Json; using Xunit.Abstractions; +using static Nerdbank.Streams.MultiplexingStream; namespace Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; @@ -130,11 +130,13 @@ internal static VersionedDocumentContext CreateDocumentContext(Uri uri, IDocumen return new VersionedDocumentContext(uri, snapshot, projectContext: null, version: 0); } - internal static IOptionsMonitor GetOptionsMonitor(bool enableFormatting = true, bool autoShowCompletion = true, bool autoListParams = true, bool formatOnType = true, bool autoInsertAttributeQuotes = true, bool colorBackground = false, bool codeBlockBraceOnNextLine = false, bool commitElementsWithSpace = true) + internal static RazorLSPOptionsMonitor GetOptionsMonitor(bool enableFormatting = true, bool autoShowCompletion = true, bool autoListParams = true, bool formatOnType = true, bool autoInsertAttributeQuotes = true, bool colorBackground = false, bool codeBlockBraceOnNextLine = false, bool commitElementsWithSpace = true) { - var monitor = new Mock>(MockBehavior.Strict); - monitor.SetupGet(m => m.CurrentValue).Returns(new RazorLSPOptions(enableFormatting, true, InsertSpaces: true, TabSize: 4, autoShowCompletion, autoListParams, formatOnType, autoInsertAttributeQuotes, colorBackground, codeBlockBraceOnNextLine, commitElementsWithSpace)); - return monitor.Object; + var configService = StrictMock.Of(); + + var options = new RazorLSPOptions(enableFormatting, true, InsertSpaces: true, TabSize: 4, autoShowCompletion, autoListParams, formatOnType, autoInsertAttributeQuotes, colorBackground, codeBlockBraceOnNextLine, commitElementsWithSpace); + var optionsMonitor = new RazorLSPOptionsMonitor(configService, options); + return optionsMonitor; } private class ThrowingRazorSpanMappingService : IRazorSpanMappingService diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLogger.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLogger.cs index 203c1f8798b..18cfb6a7103 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLogger.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLogger.cs @@ -4,11 +4,11 @@ using System; using System.Collections.Generic; using System.Text; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; namespace Microsoft.AspNetCore.Razor.Test.Common.Logging; -public partial class TestOutputLogger : ILogger +internal partial class TestOutputLogger : ILogger { [ThreadStatic] private static StringBuilder? g_builder; @@ -28,13 +28,10 @@ public TestOutputLogger( LogLevel = logLevel; } - public IDisposable BeginScope(TState state) - => NoOpDisposable.Instance; - public bool IsEnabled(LogLevel logLevel) => logLevel >= LogLevel; - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) { if (!IsEnabled(logLevel) || _provider.TestOutputHelper is null) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs index 021a4b4b70c..b0ddbf1ca0a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs @@ -2,12 +2,11 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.Test.Common.Logging; -public class TestOutputLoggerProvider(ITestOutputHelper output) : IRazorLoggerProvider +internal class TestOutputLoggerProvider(ITestOutputHelper output) : IRazorLoggerProvider { private ITestOutputHelper? _output = output; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.TestErrorReporter.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.TestErrorReporter.cs index e17c4ff0173..b35f9fe9c89 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.TestErrorReporter.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.TestErrorReporter.cs @@ -4,8 +4,8 @@ using System; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Razor.Test.Common; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs index 8781138a669..7d2db2295c4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs @@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Razor.Test.Common.Logging; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Threading; using Xunit; using Xunit.Abstractions; @@ -145,7 +144,6 @@ async Task IAsyncLifetime.DisposeAsync() _disposalTokenSource.Dispose(); } - LoggerFactory.Dispose(); JoinableTaskContext.Dispose(); } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs index c14ee5058b4..0371fbbf563 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.Internal.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Settings; using Microsoft.VisualStudio.Shell; diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/OutputInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/OutputInProcess.cs index 3c14398afd3..5d4e6a5a477 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/OutputInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/OutputInProcess.cs @@ -4,8 +4,7 @@ using System; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.VisualStudio.Razor.IntegrationTests.Extensions; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; @@ -109,4 +108,18 @@ static IVsTextView OutputWindowPaneToIVsTextView(EnvDTE.OutputWindowPane outputW return textView; } } + + private class NullLogger : ILogger + { + public static ILogger Instance { get; } = new NullLogger(); + + public bool IsEnabled(LogLevel logLevel) + { + return false; + } + + public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) + { + } + } } From dc4f835e2656a5521538b1d75b3f2e671772999d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 15:43:20 +1100 Subject: [PATCH 05/10] Implement a proper log message formatting routine Copies from MS.Ext.Logging :) In future we should use a proper interpolated string handler --- .../Logging/ILoggerExtensions.cs | 94 ++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs index 44549c618cb..9889495a28c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.CodeAnalysis.Razor.Logging; @@ -54,6 +55,97 @@ private static void Log(ILogger logger, LogLevel level, Exception? exception, st private static string FormatMessage((string? message, object?[] args) s, Exception? exception) { - return s.message is null ? "[null]" : string.Format(s.message, s.args); + var (format, args) = s; + if (format is null) + { + return "[null]"; + } + + // from: https://github.com/dotnet/runtime/blob/ec4437be46d8b90bc9fa6740c556bd860d9fe5ab/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatter.cs + using var _ = StringBuilderPool.GetPooledObject(out var vsb); + var scanIndex = 0; + var endIndex = format.Length; + + var count = 0; + + while (scanIndex < endIndex) + { + var openBraceIndex = FindBraceIndex(format, '{', scanIndex, endIndex); + if (scanIndex == 0 && openBraceIndex == endIndex) + { + // No holes found. + return format; + } + + var closeBraceIndex = FindBraceIndex(format, '}', openBraceIndex, endIndex); + + if (closeBraceIndex == endIndex) + { + vsb.Append(format, scanIndex, endIndex - scanIndex); + scanIndex = endIndex; + } + else + { + // Format item syntax : { index[,alignment][ :formatString] }. + var formatDelimiterIndex = format.AsSpan(openBraceIndex, closeBraceIndex - openBraceIndex).IndexOfAny(',', ':'); + formatDelimiterIndex = formatDelimiterIndex < 0 ? closeBraceIndex : formatDelimiterIndex + openBraceIndex; + + vsb.Append(format, scanIndex, openBraceIndex - scanIndex + 1); + vsb.Append(count++); + vsb.Append(format, formatDelimiterIndex, closeBraceIndex - formatDelimiterIndex + 1); + + scanIndex = closeBraceIndex + 1; + } + } + + return string.Format(vsb.ToString(), args); + } + + private static int FindBraceIndex(string format, char brace, int startIndex, int endIndex) + { + // Example: {{prefix{{{Argument}}}suffix}}. + var braceIndex = endIndex; + var scanIndex = startIndex; + var braceOccurrenceCount = 0; + + while (scanIndex < endIndex) + { + if (braceOccurrenceCount > 0 && format[scanIndex] != brace) + { + if (braceOccurrenceCount % 2 == 0) + { + // Even number of '{' or '}' found. Proceed search with next occurrence of '{' or '}'. + braceOccurrenceCount = 0; + braceIndex = endIndex; + } + else + { + // An unescaped '{' or '}' found. + break; + } + } + else if (format[scanIndex] == brace) + { + if (brace == '}') + { + if (braceOccurrenceCount == 0) + { + // For '}' pick the first occurrence. + braceIndex = scanIndex; + } + } + else + { + // For '{' pick the last occurrence. + braceIndex = scanIndex; + } + + braceOccurrenceCount++; + } + + scanIndex++; + } + + return braceIndex; } } From 2ce3aa0f36878c71423c265b886e928f3010369e Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 21:00:10 +1100 Subject: [PATCH 06/10] Remove a few other things --- .../AssemblyBindingRedirects.cs | 14 -------------- .../AssemblyCodeBases.cs | 2 -- 2 files changed, 16 deletions(-) diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs index 56e2a00ad86..afca00efbb3 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs @@ -3,20 +3,6 @@ using Microsoft.VisualStudio.Shell; -[assembly: ProvideBindingRedirection( - AssemblyName = "Microsoft.Extensions.Logging.Abstractions", - GenerateCodeBase = true, - PublicKeyToken = "adb9793829ddae60", - OldVersionLowerBound = "0.0.0.0", - OldVersionUpperBound = "6.0.0.0", - NewVersion = "6.0.0.0")] -[assembly: ProvideBindingRedirection( - AssemblyName = "Microsoft.Extensions.Logging", - GenerateCodeBase = true, - PublicKeyToken = "adb9793829ddae60", - OldVersionLowerBound = "0.0.0.0", - OldVersionUpperBound = "6.0.0.0", - NewVersion = "6.0.0.0")] [assembly: ProvideBindingRedirection( AssemblyName = "Microsoft.Extensions.DependencyInjection", GenerateCodeBase = true, diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs index 1fbe118454a..d28cd752a26 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs @@ -10,7 +10,5 @@ [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.DependencyInjection.Abstractions.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.Configuration.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.Configuration.Abstractions.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.Logging.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.Logging.Abstractions.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\System.IO.Pipelines.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\System.Threading.Channels.dll")] From dfb5099ed1d1d12b14e420a327fe0983a23b8d3b Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 2 Apr 2024 21:46:55 +1100 Subject: [PATCH 07/10] Remove Microsoft.Extensions.Options --- .../AssemblyBindingRedirects.cs | 7 ------- .../AssemblyCodeBases.cs | 1 - .../Microsoft.VisualStudio.RazorExtension.csproj | 1 - .../source.extension.vsixmanifest | 1 - 4 files changed, 10 deletions(-) diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs index afca00efbb3..9de502ed62a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyBindingRedirects.cs @@ -24,13 +24,6 @@ OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "8.0.0.0", NewVersion = "8.0.0.0")] -[assembly: ProvideBindingRedirection( - AssemblyName = "Microsoft.Extensions.Options", - GenerateCodeBase = true, - PublicKeyToken = "adb9793829ddae60", - OldVersionLowerBound = "0.0.0.0", - OldVersionUpperBound = "6.0.0.0", - NewVersion = "6.0.0.0")] [assembly: ProvideBindingRedirection( AssemblyName = "Microsoft.Extensions.Configuration.Abstractions", GenerateCodeBase = true, diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs index d28cd752a26..797a3a07ed6 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/AssemblyCodeBases.cs @@ -4,7 +4,6 @@ using Microsoft.VisualStudio.Shell; [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.ObjectPool.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.Options.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.Primitives.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.DependencyInjection.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Extensions.DependencyInjection.Abstractions.dll")] diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj index d92dd49118e..9745b7bcdc4 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj @@ -137,7 +137,6 @@ *************************************************************************************************************************************** --> - diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest index 16eab7ca5c6..b73de451278 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest @@ -33,7 +33,6 @@ - From 63b1d80f01b18abfd8044d444ff184075da9c925 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 3 Apr 2024 07:48:18 +1100 Subject: [PATCH 08/10] Minor PR feedback --- .../Extensions/RazorSyntaxTreeExtensions.cs | 2 +- .../Logging/AbstractRazorLoggerFactory.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs index c5b229d910d..e7c3ad83dd5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxTreeExtensions.cs @@ -5,13 +5,13 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.Logging; internal static class RazorSyntaxTreeExtensions { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs index 2b3a44eb934..e5caf64b3f8 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.PooledObjects; @@ -40,9 +41,9 @@ public void AddLoggerProvider(IRazorLoggerProvider provider) { if (ImmutableInterlocked.Update(ref _providers, (set, p) => set.Add(p), provider)) { - foreach (var entry in _loggers) + foreach (var (category, logger) in _loggers) { - entry.Value.AddLogger(provider.CreateLogger(entry.Key)); + logger.AddLogger(provider.CreateLogger(category)); } } } From de5ba340699073f9354a30c4303716f3abdefd25 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 3 Apr 2024 08:08:16 +1100 Subject: [PATCH 09/10] Rename CreateLogger to GetOrCreateLogger --- .../LanguageServer/RazorDiagnosticsBenchmark.cs | 2 +- .../ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs | 2 +- .../AutoInsert/AutoClosingTagOnAutoInsertProvider.cs | 2 +- .../AutoInsert/CloseTextTagOnAutoInsertProvider.cs | 2 +- .../AutoInsert/OnAutoInsertEndpoint.cs | 2 +- .../CodeActions/CodeActionEndpoint.cs | 2 +- .../CodeActions/CodeActionResolveEndpoint.cs | 2 +- .../Razor/ExtractToCodeBehindCodeActionProvider.cs | 2 +- .../Completion/AggregateCompletionItemResolver.cs | 2 +- .../Completion/LegacyRazorCompletionEndpoint.cs | 2 +- .../Completion/LegacyRazorCompletionResolveEndpoint.cs | 2 +- .../Completion/RazorCompletionEndpoint.cs | 2 +- .../Completion/RazorCompletionListProvider.cs | 2 +- .../Debugging/RazorBreakpointSpanEndpoint.cs | 2 +- .../Debugging/RazorProximityExpressionsEndpoint.cs | 2 +- .../Debugging/ValidateBreakpointRangeEndpoint.cs | 2 +- .../DefaultRazorComponentSearchEngine.cs | 2 +- .../DefaultRazorConfigurationService.cs | 2 +- .../Definition/DefinitionEndpoint.cs | 2 +- .../Diagnostics/RazorDiagnosticsPublisher.cs | 2 +- .../Diagnostics/RazorTranslateDiagnosticsEndpoint.cs | 2 +- .../Diagnostics/RazorTranslateDiagnosticsService.cs | 2 +- .../DocumentContextFactory.cs | 2 +- .../DocumentHighlighting/DocumentHighlightEndpoint.cs | 2 +- .../TextDocumentTextPresentationEndpoint.cs | 2 +- .../TextDocumentUriPresentationEndpoint.cs | 2 +- .../DocumentSynchronization/DocumentDidChangeEndpoint.cs | 2 +- .../DocumentSynchronization/DocumentDidSaveEndpoint.cs | 2 +- .../FindAllReferences/FindAllReferencesEndpoint.cs | 2 +- .../Folding/FoldingRangeEndpoint.cs | 2 +- .../Formatting/CSharpFormattingPass.cs | 2 +- .../Formatting/CSharpOnTypeFormattingPass.cs | 2 +- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 2 +- .../Formatting/FormattingContentValidationPass.cs | 2 +- .../Formatting/FormattingDiagnosticValidationPass.cs | 2 +- .../Formatting/HtmlFormattingPass.cs | 2 +- .../Formatting/RazorFormattingPass.cs | 2 +- .../GeneratedDocumentPublisher.cs | 2 +- .../Hosting/ClaspLoggingBridge.cs | 2 +- .../Hover/HoverEndpoint.cs | 2 +- .../Implementation/ImplementationEndpoint.cs | 2 +- .../InlineCompletion/InlineCompletionEndPoint.cs | 2 +- .../LanguageServerErrorReporter.cs | 2 +- .../LinkedEditingRange/LinkedEditingRangeEndpoint.cs | 2 +- .../Mapping/RazorLanguageQueryEndpoint.cs | 2 +- .../ProjectConfigurationFileChangeDetector.cs | 2 +- .../ProjectConfigurationStateSynchronizer.cs | 2 +- .../MonitorProjectConfigurationFilePathEndpoint.cs | 2 +- .../ProjectSystem/RazorProjectService.cs | 2 +- .../ProjectSystem/SnapshotResolver.cs | 2 +- .../RazorConfigurationEndpoint.cs | 2 +- .../RazorDocumentMappingService.cs | 2 +- .../RazorLanguageServer.LoggerFactoryWrapper.cs | 4 ++-- .../RazorRequestContextFactory.cs | 2 +- .../Refactoring/RenameEndpoint.cs | 2 +- .../Semantic/Services/LSPCSharpSemanticTokensProvider.cs | 2 +- .../Semantic/Services/RazorSemanticTokensInfoService.cs | 2 +- .../SignatureHelp/SignatureHelpEndpoint.cs | 2 +- .../WrapWithTag/WrapWithTagEndpoint.cs | 2 +- .../Logging/AbstractRazorLoggerFactory.cs | 2 +- .../Logging/IRazorLoggerFactory.cs | 2 +- .../Logging/IRazorLoggerFactoryExtensions.cs | 4 ++-- .../DocumentMapping/RemoteDocumentMappingService.cs | 2 +- .../Logging/RemoteLoggerFactory.cs | 2 +- .../SemanticTokens/RazorSemanticTokensInfoService.cs | 2 +- .../Telemetry/VSTelemetryReporter.cs | 2 +- .../CSharpVirtualDocumentAddListener.cs | 2 +- .../CSharpVirtualDocumentFactory.cs | 2 +- .../Cohost/CohostSemanticTokensRangeEndpoint.cs | 2 +- .../Cohost/CohostTextDocumentSyncHandler.cs | 2 +- .../Debugging/DefaultLSPBreakpointSpanProvider.cs | 2 +- .../Debugging/DefaultLSPProximityExpressionsProvider.cs | 2 +- .../RazorCustomMessageTarget.cs | 2 +- .../Remote/OutOfProcSemanticTokensService.cs | 2 +- src/Razor/src/rzls/Program.cs | 2 +- .../Definition/DefinitionEndpointTest.cs | 2 +- .../ToolingTestBase.cs | 2 +- 77 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index 80571e96049..e0d8d5dc7b8 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -149,7 +149,7 @@ private IRazorDocumentMappingService BuildRazorDocumentMappingService() } private IRazorLoggerFactory BuildLoggerFactory() => Mock.Of( - r => r.CreateLogger( + r => r.GetOrCreateLogger( It.IsAny()) == new NoopLogger(), MockBehavior.Strict); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs index 61fbeae62bf..4a61096d9fb 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs @@ -64,7 +64,7 @@ protected ProjectSnapshotManagerBenchmarkBase(int documentCount = 100) var loggerFactoryMock = new Mock(MockBehavior.Strict); loggerFactoryMock - .Setup(x => x.CreateLogger(It.IsAny())) + .Setup(x => x.GetOrCreateLogger(It.IsAny())) .Returns(Mock.Of(MockBehavior.Strict)); ErrorReporter = new TestErrorReporter(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs index 2eb628eba72..35c4ff0e7d4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs @@ -54,7 +54,7 @@ public AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, } _optionsMonitor = optionsMonitor; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public string TriggerCharacter => ">"; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs index 2a811bd4b44..d99c9c78e96 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs @@ -32,7 +32,7 @@ public CloseTextTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, I } _optionsMonitor = optionsMonitor; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public string TriggerCharacter => ">"; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index 461fe68a16a..86c44fe2c08 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -26,7 +26,7 @@ internal class OnAutoInsertEndpoint( IEnumerable onAutoInsertProvider, RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) - : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()), ICapabilitiesProvider + : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { private static readonly HashSet s_htmlAllowedTriggerCharacters = new(StringComparer.Ordinal) { "=", }; private static readonly HashSet s_cSharpAllowedTriggerCharacters = new(StringComparer.Ordinal) { "'", "/", "\n" }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs index 5e5a098090e..ad44420ff28 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs @@ -47,7 +47,7 @@ internal sealed class CodeActionEndpoint( private readonly IEnumerable _htmlCodeActionProviders = htmlCodeActionProviders ?? throw new ArgumentNullException(nameof(htmlCodeActionProviders)); private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions)); private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private readonly ITelemetryReporter? _telemetryReporter = telemetryReporter; internal bool _supportsCodeActionResolve = false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs index 283708b8b93..1f5b6a5e55d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs @@ -52,7 +52,7 @@ public CodeActionResolveEndpoint( throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _razorCodeActionResolvers = CreateResolverMap(razorCodeActionResolvers); _csharpCodeActionResolvers = CreateResolverMap(csharpCodeActionResolvers); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs index abeb71dd6b1..eb04171cd66 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs @@ -31,7 +31,7 @@ public ExtractToCodeBehindCodeActionProvider(IRazorLoggerFactory loggerFactory) throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public Task?> ProvideAsync(RazorCodeActionContext context, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs index 36e78273756..2207e3e9785 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs @@ -19,7 +19,7 @@ internal class AggregateCompletionItemResolver public AggregateCompletionItemResolver(IEnumerable completionItemResolvers, IRazorLoggerFactory loggerFactory) { _completionItemResolvers = completionItemResolvers.ToArray(); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public async Task ResolveAsync( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs index 4ff60e702f7..11a8667fe8b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs @@ -29,7 +29,7 @@ internal class LegacyRazorCompletionEndpoint( { private readonly IRazorCompletionFactsService _completionFactsService = completionFactsService; private readonly CompletionListCache _completionListCache = completionListCache; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private static readonly Command s_retriggerCompletionCommand = new() { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs index f8678e630a4..8c33f235087 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs @@ -63,7 +63,7 @@ public LegacyRazorCompletionResolveEndpoint( _lspTagHelperTooltipFactory = lspTagHelperTooltipFactory; _vsLspTagHelperTooltipFactory = vsLspTagHelperTooltipFactory; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _completionListCache = completionListCache; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs index d25785b4e95..16460a4157c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -24,7 +24,7 @@ internal class RazorCompletionEndpoint( private readonly CompletionListProvider _completionListProvider = completionListProvider; private readonly ITelemetryReporter? _telemetryReporter = telemetryReporter; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private VSInternalClientCapabilities? _clientCapabilities; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs index f60247d75c7..6f4ff35aafc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs @@ -25,7 +25,7 @@ internal class RazorCompletionListProvider( { private readonly IRazorCompletionFactsService _completionFactsService = completionFactsService; private readonly CompletionListCache _completionListCache = completionListCache; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private static readonly Command s_retriggerCompletionCommand = new() { CommandIdentifier = "editor.action.triggerSuggest", diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs index 781a73155ea..0ab035581af 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs @@ -37,7 +37,7 @@ public RazorBreakpointSpanEndpoint( } _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public Uri GetTextDocumentIdentifier(RazorBreakpointSpanParams request) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs index 3f4429644d8..acae00d53ed 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs @@ -39,7 +39,7 @@ public RazorProximityExpressionsEndpoint( } _documentMappingService = documentMappingService; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs index ae6cab7cd88..c5e51c5b6dd 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/ValidateBreakpointRangeEndpoint.cs @@ -24,7 +24,7 @@ internal class ValidateBreakpointRangeEndpoint( languageServerFeatureOptions, documentMappingService, clientConnection, - loggerFactory.CreateLogger()), ICapabilitiesProvider + loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { private readonly IRazorDocumentMappingService _documentMappingService = documentMappingService; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs index 534d9b677aa..7de9b21d1dd 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs @@ -21,7 +21,7 @@ internal class DefaultRazorComponentSearchEngine( : RazorComponentSearchEngine { private readonly IProjectSnapshotManager _projectManager = projectManager; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async override Task TryGetTagHelperDescriptorAsync(IDocumentSnapshot documentSnapshot, CancellationToken cancellationToken) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs index f4df8805e33..45f8306c0ed 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs @@ -31,7 +31,7 @@ public DefaultRazorConfigurationService(IClientConnection clientConnection, IRaz } _clientConnection = clientConnection; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public async Task GetLatestOptionsAsync(CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs index fb864ac5026..6915642e930 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs @@ -32,7 +32,7 @@ internal sealed class DefinitionEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) - : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()), ICapabilitiesProvider + : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { private readonly RazorComponentSearchEngine _componentSearchEngine = componentSearchEngine ?? throw new ArgumentNullException(nameof(componentSearchEngine)); private readonly IRazorDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs index 019d03a5c22..415b8d7b2b3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs @@ -84,7 +84,7 @@ public RazorDiagnosticsPublisher( PublishedRazorDiagnostics = new Dictionary>(FilePathComparer.Instance); PublishedCSharpDiagnostics = new Dictionary>(FilePathComparer.Instance); _work = new Dictionary(FilePathComparer.Instance); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } // Used in tests to ensure we can control when background work completes. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs index a1e1ceada39..5bb4f2e87e0 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs @@ -29,7 +29,7 @@ public RazorTranslateDiagnosticsEndpoint( } _translateDiagnosticsService = translateDiagnosticsService ?? throw new ArgumentNullException(nameof(translateDiagnosticsService)); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public async Task HandleRequestAsync(RazorDiagnosticsParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs index 7bf615ec099..237d59aeed4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs @@ -57,7 +57,7 @@ public RazorTranslateDiagnosticsService(IRazorDocumentMappingService documentMap } _documentMappingService = documentMappingService; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } /// diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs index b1677b602e8..d669cde63f4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs @@ -24,7 +24,7 @@ internal sealed class DocumentContextFactory( private readonly IProjectSnapshotManager _projectManager = projectManager; private readonly ISnapshotResolver _snapshotResolver = snapshotResolver; private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public DocumentContext? TryCreate(Uri documentUri, VSProjectContext? projectContext, bool versioned) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs index 0fe45e83aaf..3ac8038020f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs @@ -24,7 +24,7 @@ public DocumentHighlightEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) - : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()) + : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs index 31562a6c5d4..d43757bb044 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs @@ -18,7 +18,7 @@ internal class TextDocumentTextPresentationEndpoint( IClientConnection clientConnection, IFilePathService filePathService, IRazorLoggerFactory loggerFactory) - : AbstractTextDocumentPresentationEndpointBase(razorDocumentMappingService, clientConnection, filePathService, loggerFactory.CreateLogger()), ITextDocumentTextPresentationHandler + : AbstractTextDocumentPresentationEndpointBase(razorDocumentMappingService, clientConnection, filePathService, loggerFactory.GetOrCreateLogger()), ITextDocumentTextPresentationHandler { public override string EndpointName => CustomMessageNames.RazorTextPresentationEndpoint; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs index 69602e60c16..6a2988b4458 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs @@ -27,7 +27,7 @@ internal class TextDocumentUriPresentationEndpoint( IFilePathService filePathService, IDocumentContextFactory documentContextFactory, IRazorLoggerFactory loggerFactory) - : AbstractTextDocumentPresentationEndpointBase(razorDocumentMappingService, clientConnection, filePathService, loggerFactory.CreateLogger()), ITextDocumentUriPresentationHandler + : AbstractTextDocumentPresentationEndpointBase(razorDocumentMappingService, clientConnection, filePathService, loggerFactory.GetOrCreateLogger()), ITextDocumentUriPresentationHandler { private readonly RazorComponentSearchEngine _razorComponentSearchEngine = razorComponentSearchEngine ?? throw new ArgumentNullException(nameof(razorComponentSearchEngine)); private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory ?? throw new ArgumentNullException(nameof(documentContextFactory)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs index f05b11df641..cb27555c085 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs @@ -27,7 +27,7 @@ internal class DocumentDidChangeEndpoint( private readonly ProjectSnapshotManagerDispatcher _projectSnapshotManagerDispatcher = projectSnapshotManagerDispatcher; private readonly IRazorProjectService _projectService = razorProjectService; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs index 31c94395262..32c55b6507b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs @@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization; internal class DocumentDidSaveEndpoint(IRazorLoggerFactory loggerFactory) : IRazorNotificationHandler, ITextDocumentIdentifierHandler { - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs index 68d7151281b..d5250aa7c67 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs @@ -29,7 +29,7 @@ public FindAllReferencesEndpoint( IClientConnection clientConnection, IRazorLoggerFactory loggerFactory, IFilePathService filePathService) - : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()) + : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _filePathService = filePathService ?? throw new ArgumentNullException(nameof(filePathService)); _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs index 8abf339d8ee..048191ec443 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs @@ -40,7 +40,7 @@ public FoldingRangeEndpoint( _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); _foldingRangeProviders = foldingRangeProviders ?? throw new ArgumentNullException(nameof(foldingRangeProviders)); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs index a00bb4406a9..88a424f36ee 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs @@ -32,7 +32,7 @@ public CSharpFormattingPass( throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } // Run after the HTML and Razor formatter pass. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs index bdf0a104b6e..27132045c94 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs @@ -44,7 +44,7 @@ public CSharpOnTypeFormattingPass( throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _optionsMonitor = optionsMonitor; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index db0efdb06a9..5fc901a0c04 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -28,7 +28,7 @@ internal class DocumentOnTypeFormattingEndpoint( private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); private readonly IRazorDocumentMappingService _razorDocumentMappingService = razorDocumentMappingService ?? throw new ArgumentNullException(nameof(razorDocumentMappingService)); private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private static readonly IReadOnlyList s_csharpTriggerCharacters = new[] { "}", ";" }; private static readonly IReadOnlyList s_htmlTriggerCharacters = new[] { "\n", "{", "}", ";" }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs index 954eed085e5..7155a9f2c67 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs @@ -30,7 +30,7 @@ public FormattingContentValidationPass( throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } // We want this to run at the very end. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs index bdc625d2964..eaf9c6ef033 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs @@ -32,7 +32,7 @@ public FormattingDiagnosticValidationPass( throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } // We want this to run at the very end. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs index b00e124a7e9..b32a24b9100 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs @@ -37,7 +37,7 @@ public HtmlFormattingPass( throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); HtmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); _optionsMonitor = optionsMonitor; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs index 1b3e806c5a7..9e63225770f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs @@ -25,7 +25,7 @@ internal class RazorFormattingPass( IRazorLoggerFactory loggerFactory) : FormattingPassBase(documentMappingService, clientConnection) { - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; // Run after the C# formatter pass. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index 0d50c02278f..693452ac46a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -38,7 +38,7 @@ public GeneratedDocumentPublisher( _dispatcher = dispatcher; _clientConnection = clientConnection; _options = options; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _publishedCSharpData = new Dictionary(); // We don't generate individual Html documents per-project, so in order to ensure diffs are calculated correctly diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs index 810af2cbbb7..1b6610cd579 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs @@ -22,7 +22,7 @@ internal class ClaspLoggingBridge : ILspLogger public ClaspLoggingBridge(IRazorLoggerFactory loggerFactory, ITelemetryReporter? telemetryReporter = null) { // We're creating this on behalf of CLaSP, because it doesn't know how to use IRazorLoggerFactory, so using that as the category name. - _logger = loggerFactory.CreateLogger("CLaSP"); + _logger = loggerFactory.GetOrCreateLogger("CLaSP"); _telemetryReporter = telemetryReporter; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs index efe3f94a466..dd7714ab9ce 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs @@ -25,7 +25,7 @@ public HoverEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) - : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()) + : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _hoverService = hoverService ?? throw new ArgumentNullException(nameof(hoverService)); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs index e8293ba8ea7..f83d01344b5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs @@ -27,7 +27,7 @@ public ImplementationEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) - : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger()) + : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index dffe0b837ff..4f4d5d46e6f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -39,7 +39,7 @@ internal sealed class InlineCompletionEndpoint( private readonly IRazorDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); private readonly IAdhocWorkspaceFactory _adhocWorkspaceFactory = adhocWorkspaceFactory ?? throw new ArgumentNullException(nameof(adhocWorkspaceFactory)); - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs index d838ee08b7f..4195b4cd1f1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs @@ -20,7 +20,7 @@ public LanguageServerErrorReporter(IRazorLoggerFactory loggerFactory) throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public void ReportError(Exception exception) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs index 2c65fd4717b..3edc4418421 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs @@ -33,7 +33,7 @@ public LinkedEditingRangeEndpoint(IRazorLoggerFactory loggerFactory) throw new ArgumentNullException(nameof(loggerFactory)); } - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs index 1f861744437..e81d498afb4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs @@ -18,7 +18,7 @@ internal sealed class RazorLanguageQueryEndpoint(IRazorDocumentMappingService do : IRazorRequestHandler { private readonly IRazorDocumentMappingService _documentMappingService = documentMappingService; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState { get; } = false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs index 02d944c1376..c79dc8f1398 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs @@ -43,7 +43,7 @@ public ProjectConfigurationFileChangeDetector( _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); _listeners = listeners ?? throw new ArgumentNullException(nameof(listeners)); _options = options ?? throw new ArgumentNullException(nameof(options)); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } public async Task StartAsync(string workspaceDirectory, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs index 275d343bcb2..260ce449a33 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs @@ -36,7 +36,7 @@ public ProjectConfigurationStateSynchronizer( _projectSnapshotManagerDispatcher = projectSnapshotManagerDispatcher; _projectService = projectService; _languageServerFeatureOptions = languageServerFeatureOptions; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _configurationToProjectMap = new Dictionary(FilePathComparer.Instance); ProjectInfoMap = new Dictionary(); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs index fb44e7b5c9f..660ab34f26c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs @@ -47,7 +47,7 @@ public MonitorProjectConfigurationFilePathEndpoint( _listeners = listeners; _options = options; _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _outputPathMonitors = new ConcurrentDictionary(FilePathComparer.Instance); _disposeLock = new object(); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs index 3c6773d6d35..9eee0df92bb 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs @@ -36,7 +36,7 @@ internal class RazorProjectService( private readonly RemoteTextLoaderFactory _remoteTextLoaderFactory = remoteTextLoaderFactory; private readonly ISnapshotResolver _snapshotResolver = snapshotResolver; private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public void AddDocument(string filePath) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs index aeaf5b701f5..4c5c48c6e5f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs @@ -24,7 +24,7 @@ internal sealed class SnapshotResolver : ISnapshotResolver public SnapshotResolver(IProjectSnapshotManager projectManager, IRazorLoggerFactory loggerFactory) { _projectManager = projectManager; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); var miscellaneousProjectPath = Path.Combine(TempDirectory.Instance.DirectoryPath, "__MISC_RAZOR_PROJECT__"); var normalizedPath = FilePathNormalizer.Normalize(miscellaneousProjectPath); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs index 1496605eb23..586987a1d5d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs @@ -14,7 +14,7 @@ internal class RazorConfigurationEndpoint(RazorLSPOptionsMonitor optionsMonitor, : IDidChangeConfigurationEndpoint, IOnInitialized { private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => true; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs index 03d6c56af31..e039a65baf4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs @@ -12,6 +12,6 @@ internal sealed class RazorDocumentMappingService( IFilePathService filePathService, IDocumentContextFactory documentContextFactory, IRazorLoggerFactory loggerFactory) - : AbstractRazorDocumentMappingService(filePathService, documentContextFactory, loggerFactory.CreateLogger()) + : AbstractRazorDocumentMappingService(filePathService, documentContextFactory, loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs index 04b8f3bef3a..fae664aac92 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs @@ -21,11 +21,11 @@ public void AddLoggerProvider(IRazorLoggerProvider provider) _loggerFactory.AddLoggerProvider(provider); } - public ILogger CreateLogger(string categoryName) + public ILogger GetOrCreateLogger(string categoryName) { // Adding [LSP] to the start to identify the LSP server, as some of our services exist in the server, and in VS // It looks weird because the category is surround with square brackets, so this ends up being [LSP][Category] - return _loggerFactory.CreateLogger($"LSP][{categoryName}"); + return _loggerFactory.GetOrCreateLogger($"LSP][{categoryName}"); } } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs index cb76e61bba2..a9713ef9a22 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs @@ -19,7 +19,7 @@ internal class RazorRequestContextFactory(ILspServices lspServices) : AbstractRe public override Task CreateRequestContextAsync(IQueueItem queueItem, IMethodHandler methodHandler, TRequestParams @params, CancellationToken cancellationToken) { - var logger = _lspServices.GetRequiredService().CreateLogger(); + var logger = _lspServices.GetRequiredService().GetOrCreateLogger(); VersionedDocumentContext? documentContext = null; var textDocumentHandler = methodHandler as ITextDocumentIdentifierHandler; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs index 0ebc4f45405..02972f161ee 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs @@ -37,7 +37,7 @@ internal sealed class RenameEndpoint( languageServerFeatureOptions, documentMappingService, clientConnection, - loggerFactory.CreateLogger()), ICapabilitiesProvider + loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { private readonly ProjectSnapshotManagerDispatcher _dispatcher = dispatcher; private readonly IProjectSnapshotManager _projectManager = projectManager; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs index 48fbbba0e7d..c6535a673aa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs @@ -21,7 +21,7 @@ internal class LSPCSharpSemanticTokensProvider(LanguageServerFeatureOptions lang { private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; private readonly IClientConnection _clientConnection = clientConnection; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async Task GetCSharpSemanticTokensResponseAsync( VersionedDocumentContext documentContext, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs index b480c3b1198..c26568aae92 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs @@ -14,6 +14,6 @@ internal class RazorSemanticTokensInfoService( ICSharpSemanticTokensProvider csharpSemanticTokensProvider, LanguageServerFeatureOptions languageServerFeatureOptions, IRazorLoggerFactory loggerFactory) - : AbstractRazorSemanticTokensInfoService(documentMappingService, semanticTokensLegendService, csharpSemanticTokensProvider, languageServerFeatureOptions, loggerFactory.CreateLogger()) + : AbstractRazorSemanticTokensInfoService(documentMappingService, semanticTokensLegendService, csharpSemanticTokensProvider, languageServerFeatureOptions, loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs index 27ecb9357c2..1268fcb7616 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs @@ -25,7 +25,7 @@ internal sealed class SignatureHelpEndpoint( languageServerFeatureOptions, documentMappingService, clientConnection, - loggerProvider.CreateLogger()), + loggerProvider.GetOrCreateLogger()), ICapabilitiesProvider { protected override string CustomMessageTarget => CustomMessageNames.RazorSignatureHelpEndpointName; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs index c98ae9056dc..50a7b40fa31 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs @@ -26,7 +26,7 @@ internal class WrapWithTagEndpoint( { private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); private readonly IRazorDocumentMappingService _razorDocumentMappingService = razorDocumentMappingService ?? throw new ArgumentNullException(nameof(razorDocumentMappingService)); - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs index e5caf64b3f8..5f1328a5591 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs @@ -19,7 +19,7 @@ protected AbstractRazorLoggerFactory(ImmutableArray provid _loggers = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase); } - public ILogger CreateLogger(string categoryName) + public ILogger GetOrCreateLogger(string categoryName) { if (_loggers.TryGetValue(categoryName, out var logger)) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs index e497569b621..5180c740864 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs @@ -7,5 +7,5 @@ namespace Microsoft.CodeAnalysis.Razor.Logging; internal interface IRazorLoggerFactory { void AddLoggerProvider(IRazorLoggerProvider provider); - ILogger CreateLogger(string categoryName); + ILogger GetOrCreateLogger(string categoryName); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs index 632b086f429..e4841644254 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs @@ -7,9 +7,9 @@ namespace Microsoft.CodeAnalysis.Razor.Logging; internal static class IRazorLoggerFactoryExtensions { - public static ILogger CreateLogger(this IRazorLoggerFactory factory) + public static ILogger GetOrCreateLogger(this IRazorLoggerFactory factory) { - return factory.CreateLogger(TrimTypeName(typeof(T).FullName)); + return factory.GetOrCreateLogger(TrimTypeName(typeof(T).FullName)); } private static string TrimTypeName(string name) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs index 1003ec0ca92..98ec6a750a8 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs @@ -18,6 +18,6 @@ internal sealed class RemoteDocumentMappingService( : AbstractRazorDocumentMappingService( filePathService, documentContextFactory, - loggerFactory.CreateLogger()) + loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs index 42c978688ef..5a09af12d66 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs @@ -23,7 +23,7 @@ public void AddLoggerProvider(IRazorLoggerProvider provider) throw new System.NotImplementedException(); } - public ILogger CreateLogger(string categoryName) + public ILogger GetOrCreateLogger(string categoryName) { return new Logger(categoryName); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs index 4cfc05db10a..5ec183be254 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs @@ -23,6 +23,6 @@ internal class RazorSemanticTokensInfoService( semanticTokensLegendService, csharpSemanticTokensProvider, languageServerFeatureOptions, - loggerFactory.CreateLogger()) + loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs index ade04e412d4..b34da46ac14 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs +++ b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs @@ -22,7 +22,7 @@ public VSTelemetryReporter(Lazy loggerFactory) // appinsights keys etc : base(ImmutableArray.Create(TelemetryService.DefaultSession)) { - _logger = new Lazy(() => loggerFactory.Value.CreateLogger()); + _logger = new Lazy(() => loggerFactory.Value.GetOrCreateLogger()); } protected override bool HandleException(Exception exception, string? message, params object?[] @params) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs index 1d2569726f9..1aedab42767 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs @@ -20,7 +20,7 @@ internal class CSharpVirtualDocumentAddListener(IRazorLoggerFactory loggerFactor { private static readonly TimeSpan s_waitTimeout = TimeSpan.FromMilliseconds(500); - private readonly ILogger logger = loggerFactory.CreateLogger(); + private readonly ILogger logger = loggerFactory.GetOrCreateLogger(); private TaskCompletionSource? _tcs; private CancellationTokenSource? _cts; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs index 436d05d38f8..c141da3b62d 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs @@ -56,7 +56,7 @@ public CSharpVirtualDocumentFactory( _filePathService = filePathService; _projectManager = projectManager; _languageServerFeatureOptions = languageServerFeatureOptions; - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); _telemetryReporter = telemetryReporter; } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs index f888f30caa1..97d5927deb9 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs @@ -33,7 +33,7 @@ internal sealed class CohostSemanticTokensRangeEndpoint( private readonly IOutOfProcSemanticTokensService _semanticTokensInfoService = semanticTokensInfoService; private readonly ISemanticTokensLegendService _semanticTokensLegendService = semanticTokensLegendService; private readonly ITelemetryReporter _telemetryReporter = telemetryReporter; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); protected override bool MutatesSolutionState => false; protected override bool RequiresLSPSolution => true; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs index 26e60fd0de6..5dd33bc8bc1 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs @@ -28,7 +28,7 @@ internal class CohostTextDocumentSyncHandler( private readonly IRemoteClientProvider _remoteClientProvider = remoteClientProvider; private readonly JoinableTaskContext _joinableTaskContext = joinableTaskContext; private readonly TrackingLSPDocumentManager _documentManager = documentManager as TrackingLSPDocumentManager ?? throw new InvalidOperationException("Expected TrackingLSPDocumentManager"); - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async Task HandleAsync(int version, RazorCohostRequestContext context, CancellationToken cancellationToken) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs index a0c82e8d086..78b1a16b9b1 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs @@ -37,7 +37,7 @@ public DefaultLSPBreakpointSpanProvider( } _requestInvoker = requestInvoker; - _logger = new Lazy(() => loggerFactory.Value.CreateLogger()); + _logger = new Lazy(() => loggerFactory.Value.GetOrCreateLogger()); } public async override Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs index 4657ed1df12..be9061c6204 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs @@ -39,7 +39,7 @@ public DefaultLSPProximityExpressionsProvider( } _requestInvoker = requestInvoker; - _logger = new Lazy(() => loggerFactory.Value.CreateLogger()); + _logger = new Lazy(() => loggerFactory.Value.GetOrCreateLogger()); } public async override Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs index 169a6f089fe..6a3264eebd5 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs @@ -83,7 +83,7 @@ public RazorCustomMessageTarget( _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions)); _projectManager = projectManager ?? throw new ArgumentNullException(nameof(projectManager)); _snippetCache = snippetCache ?? throw new ArgumentNullException(nameof(snippetCache)); - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.GetOrCreateLogger(); } private async Task GetProjectedRequestDetailsAsync(IDelegatedParams request, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs index ca3d5ccc110..c7c20c40340 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs @@ -19,7 +19,7 @@ internal class OutOfProcSemanticTokensService(IRemoteClientProvider remoteClient { private readonly IRemoteClientProvider _remoteClientProvider = remoteClientProvider; private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager; - private readonly ILogger _logger = loggerFactory.CreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async ValueTask GetSemanticTokensDataAsync(TextDocument razorDocument, LinePositionSpan span, Guid correlationId, CancellationToken cancellationToken) { diff --git a/src/Razor/src/rzls/Program.cs b/src/Razor/src/rzls/Program.cs index 2b7cf1ba999..478b32cd24b 100644 --- a/src/Razor/src/rzls/Program.cs +++ b/src/Razor/src/rzls/Program.cs @@ -92,7 +92,7 @@ public static async Task Main(string[] args) var loggerProvider = new LoggerProvider(logLevel, clientConnection); loggerFactory.AddLoggerProvider(loggerProvider); - loggerFactory.CreateLogger("RZLS").LogInformation("Razor Language Server started successfully."); + loggerFactory.GetOrCreateLogger("RZLS").LogInformation("Razor Language Server started successfully."); await server.WaitForExitAsync().ConfigureAwait(true); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs index fcd4b1e2acb..400b8cc671c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs @@ -365,7 +365,7 @@ private async Task VerifyOriginTagHelperBindingAsync(string content, string tagH var documentContext = CreateDocumentContext(new Uri(@"C:\file.razor"), documentSnapshot); var (descriptor, attributeDescriptor) = await DefinitionEndpoint.GetOriginTagHelperBindingAsync( - documentContext, position, ignoreAttributes, LoggerFactory.CreateLogger("RazorDefinitionEndpoint"), DisposalToken); + documentContext, position, ignoreAttributes, LoggerFactory.GetOrCreateLogger("RazorDefinitionEndpoint"), DisposalToken); if (tagHelperDescriptorName is null) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs index 7d2db2295c4..cc2d9815a0a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs @@ -78,7 +78,7 @@ static ToolingTestBase() /// /// An for the currently running test. /// - private protected ILogger Logger => _logger ??= LoggerFactory.CreateLogger(GetType().Name); + private protected ILogger Logger => _logger ??= LoggerFactory.GetOrCreateLogger(GetType().Name); private protected IErrorReporter ErrorReporter => _errorReporter ??= new TestErrorReporter(Logger); From 83a572537efcbac11f4bd0aba0b7d310cb15fb61 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 3 Apr 2024 08:14:54 +1100 Subject: [PATCH 10/10] Rename logging types to remove "Razor" from the name --- .../LanguageServer/RazorCodeActionsBenchmark.cs | 2 +- .../LanguageServer/RazorCompletionBenchmark.cs | 2 +- .../LanguageServer/RazorDiagnosticsBenchmark.cs | 2 +- .../RazorLanguageServerBenchmarkBase.cs | 4 ++-- .../LanguageServer/RazorSemanticTokensBenchmark.cs | 2 +- .../RazorSemanticTokensRangeEndpointBenchmark.cs | 4 ++-- .../ProjectSnapshotManagerBenchmarkBase.cs | 2 +- .../AutoClosingTagOnAutoInsertProvider.cs | 2 +- .../AutoInsert/CloseTextTagOnAutoInsertProvider.cs | 2 +- .../AutoInsert/OnAutoInsertEndpoint.cs | 2 +- .../CodeActions/CodeActionEndpoint.cs | 2 +- .../CodeActions/CodeActionResolveEndpoint.cs | 2 +- .../Razor/ExtractToCodeBehindCodeActionProvider.cs | 2 +- .../Completion/AggregateCompletionItemResolver.cs | 2 +- .../Completion/LegacyRazorCompletionEndpoint.cs | 2 +- .../LegacyRazorCompletionResolveEndpoint.cs | 2 +- .../Completion/RazorCompletionEndpoint.cs | 2 +- .../Completion/RazorCompletionListProvider.cs | 2 +- .../Debugging/RazorBreakpointSpanEndpoint.cs | 2 +- .../Debugging/RazorProximityExpressionsEndpoint.cs | 2 +- .../Debugging/ValidateBreakpointRangeEndpoint.cs | 2 +- .../DefaultRazorComponentSearchEngine.cs | 2 +- .../DefaultRazorConfigurationService.cs | 2 +- .../Definition/DefinitionEndpoint.cs | 2 +- .../Diagnostics/RazorDiagnosticsPublisher.cs | 2 +- .../RazorTranslateDiagnosticsEndpoint.cs | 2 +- .../Diagnostics/RazorTranslateDiagnosticsService.cs | 4 ++-- .../DocumentContextFactory.cs | 2 +- .../DocumentHighlightEndpoint.cs | 2 +- .../TextDocumentTextPresentationEndpoint.cs | 2 +- .../TextDocumentUriPresentationEndpoint.cs | 2 +- .../DocumentDidChangeEndpoint.cs | 2 +- .../DocumentDidSaveEndpoint.cs | 2 +- .../FindAllReferences/FindAllReferencesEndpoint.cs | 2 +- .../Folding/FoldingRangeEndpoint.cs | 2 +- .../Formatting/CSharpFormattingPass.cs | 2 +- .../Formatting/CSharpOnTypeFormattingPass.cs | 2 +- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 2 +- .../Formatting/FormattingContentValidationPass.cs | 2 +- .../FormattingDiagnosticValidationPass.cs | 2 +- .../Formatting/HtmlFormattingPass.cs | 2 +- .../Formatting/RazorFormattingPass.cs | 2 +- .../GeneratedDocumentPublisher.cs | 2 +- .../Hosting/ClaspLoggingBridge.cs | 4 ++-- .../Hosting/RazorLanguageServerWrapper.cs | 2 +- .../Hover/HoverEndpoint.cs | 2 +- .../Implementation/ImplementationEndpoint.cs | 2 +- .../InlineCompletion/InlineCompletionEndPoint.cs | 2 +- .../LanguageServerErrorReporter.cs | 2 +- .../LinkedEditingRangeEndpoint.cs | 2 +- .../Mapping/RazorLanguageQueryEndpoint.cs | 2 +- .../ProjectConfigurationFileChangeDetector.cs | 2 +- .../ProjectConfigurationStateSynchronizer.cs | 2 +- .../MonitorProjectConfigurationFilePathEndpoint.cs | 4 ++-- .../ProjectSystem/RazorProjectService.cs | 2 +- .../ProjectSystem/SnapshotResolver.cs | 2 +- .../RazorConfigurationEndpoint.cs | 2 +- .../RazorDocumentMappingService.cs | 2 +- .../RazorLanguageServer.LoggerFactoryWrapper.cs | 8 ++++---- .../RazorLanguageServer.cs | 8 ++++---- .../RazorRequestContextFactory.cs | 2 +- .../Refactoring/RenameEndpoint.cs | 2 +- .../Services/LSPCSharpSemanticTokensProvider.cs | 2 +- .../Services/RazorSemanticTokensInfoService.cs | 2 +- .../SignatureHelp/SignatureHelpEndpoint.cs | 2 +- .../WrapWithTag/WrapWithTagEndpoint.cs | 2 +- ....cs => AbstractLoggerFactory.AggregateLogger.cs} | 2 +- ...zorLoggerFactory.cs => AbstractLoggerFactory.cs} | 13 ++++++++----- .../{IRazorLoggerFactory.cs => ILoggerFactory.cs} | 4 ++-- ...oryExtensions.cs => ILoggerFactoryExtensions.cs} | 4 ++-- .../{IRazorLoggerProvider.cs => ILoggerProvider.cs} | 3 +-- .../DocumentMapping/RemoteDocumentMappingService.cs | 2 +- .../Logging/RemoteLoggerFactory.cs | 6 +++--- .../RazorSemanticTokensInfoService.cs | 2 +- .../Telemetry/VSTelemetryReporter.cs | 2 +- .../CSharpVirtualDocumentAddListener.cs | 2 +- .../CSharpVirtualDocumentFactory.cs | 2 +- .../Cohost/CohostSemanticTokensRangeEndpoint.cs | 2 +- .../Cohost/CohostTextDocumentSyncHandler.cs | 2 +- .../Debugging/DefaultLSPBreakpointSpanProvider.cs | 2 +- .../DefaultLSPProximityExpressionsProvider.cs | 2 +- .../Logging/RazorLogHubLoggerProvider.cs | 4 ++-- .../RazorCustomMessageTarget.cs | 2 +- .../RazorLanguageServerClient.cs | 6 +++--- .../Logging/MemoryLoggerProvider.cs | 4 ++-- .../Logging/OutputWindowLoggerProvider.cs | 4 ++-- ...oggerFactory.cs => VisualStudioLoggerFactory.cs} | 6 +++--- .../Remote/OutOfProcSemanticTokensService.cs | 2 +- src/Razor/src/rzls/LoggerFactory.cs | 4 ++-- src/Razor/src/rzls/LoggerProvider.cs | 2 +- .../Completion/CompletionListProviderTest.cs | 2 +- .../TestDelegatedCompletionListProvider.cs | 10 +++++----- .../Diagnostics/RazorDiagnosticsPublisherTest.cs | 2 +- .../RazorTranslateDiagnosticsEndpointTest.cs | 4 ++-- .../Formatting/TestRazorFormattingService.cs | 2 +- .../FormattingLanguageServerClient.cs | 4 ++-- .../Formatting_NetFx/TestRazorFormattingService.cs | 2 +- ...nitorProjectConfigurationFilePathEndpointTest.cs | 2 +- .../ProjectConfigurationFileChangeDetectorTest.cs | 2 +- .../Editor_NetFx/TestTelemetryReporter.cs | 2 +- .../Logging/TestOutputLoggerFactory.cs | 2 +- .../Logging/TestOutputLoggerProvider.cs | 2 +- .../ToolingTestBase.cs | 6 +++--- .../LogIntegrationTestAttribute.cs | 2 +- 104 files changed, 142 insertions(+), 140 deletions(-) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/{AbstractRazorLoggerFactory.AggregateLogger.cs => AbstractLoggerFactory.AggregateLogger.cs} (95%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/{AbstractRazorLoggerFactory.cs => AbstractLoggerFactory.cs} (82%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/{IRazorLoggerFactory.cs => ILoggerFactory.cs} (77%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/{IRazorLoggerFactoryExtensions.cs => ILoggerFactoryExtensions.cs} (87%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/{IRazorLoggerProvider.cs => ILoggerProvider.cs} (64%) rename src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/{VisualStudioRazorLoggerFactory.cs => VisualStudioLoggerFactory.cs} (66%) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs index 3f479f3e3bf..42c688c7211 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs @@ -55,7 +55,7 @@ public async Task SetupAsync() htmlCodeActionProviders: languageServer.GetRequiredService>(), clientConnection: languageServer.GetRequiredService(), languageServerFeatureOptions: languageServer.GetRequiredService(), - loggerFactory: languageServer.GetRequiredService(), + loggerFactory: languageServer.GetRequiredService(), telemetryReporter: null); var projectRoot = Path.Combine(RepoRoot, "src", "Razor", "test", "testapps", "ComponentApp"); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs index f8dd46a48b7..4766976f9c5 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs @@ -44,7 +44,7 @@ public async Task SetupAsync() var documentMappingService = lspServices.GetRequiredService(); var clientConnection = lspServices.GetRequiredService(); var completionListCache = lspServices.GetRequiredService(); - var loggerFactory = lspServices.GetRequiredService(); + var loggerFactory = lspServices.GetRequiredService(); var delegatedCompletionListProvider = new TestDelegatedCompletionListProvider(responseRewriters, documentMappingService, clientConnection, completionListCache); var completionListProvider = new CompletionListProvider(razorCompletionListProvider, delegatedCompletionListProvider); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index e0d8d5dc7b8..c3340ab5ade 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -148,7 +148,7 @@ private IRazorDocumentMappingService BuildRazorDocumentMappingService() return razorDocumentMappingService.Object; } - private IRazorLoggerFactory BuildLoggerFactory() => Mock.Of( + private ILoggerFactory BuildLoggerFactory() => Mock.Of( r => r.GetOrCreateLogger( It.IsAny()) == new NoopLogger(), MockBehavior.Strict); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs index da1f9c32dd4..fef65b2ff62 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorLanguageServerBenchmarkBase.cs @@ -108,9 +108,9 @@ public Task SendRequestAsync(string method, TPara } } - internal class NoopLoggerFactory() : AbstractRazorLoggerFactory([new NoopLoggerProvider()]); + internal class NoopLoggerFactory() : AbstractLoggerFactory([new NoopLoggerProvider()]); - internal class NoopLoggerProvider : IRazorLoggerProvider + internal class NoopLoggerProvider : ILoggerProvider { public ILogger CreateLogger(string categoryName) { diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs index ce3badc25a4..75a8be4e3c4 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs @@ -130,7 +130,7 @@ public TestRazorSemanticTokensInfoService( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, RazorSemanticTokensLegendService razorSemanticTokensLegendService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, razorSemanticTokensLegendService, csharpSemanticTokensProvider: null!, languageServerFeatureOptions, loggerFactory) { } diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs index c8fd8c8ac0d..908195d20bf 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs @@ -64,7 +64,7 @@ public async Task InitializeRazorSemanticAsync() { EnsureServicesInitialized(); - var loggerFactory = RazorLanguageServer.GetRequiredService(); + var loggerFactory = RazorLanguageServer.GetRequiredService(); var projectRoot = Path.Combine(RepoRoot, "src", "Razor", "test", "testapps", "ComponentApp"); ProjectFilePath = Path.Combine(projectRoot, "ComponentApp.csproj"); @@ -159,7 +159,7 @@ public TestCustomizableRazorSemanticTokensInfoService( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, RazorSemanticTokensLegendService razorSemanticTokensLegendService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, razorSemanticTokensLegendService, csharpSemanticTokensProvider: null!, languageServerFeatureOptions, loggerFactory) { } diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs index 4a61096d9fb..f0feb8acf1b 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs @@ -62,7 +62,7 @@ protected ProjectSnapshotManagerBenchmarkBase(int documentCount = 100) Documents = documents.ToImmutable(); - var loggerFactoryMock = new Mock(MockBehavior.Strict); + var loggerFactoryMock = new Mock(MockBehavior.Strict); loggerFactoryMock .Setup(x => x.GetOrCreateLogger(It.IsAny())) .Returns(Mock.Of(MockBehavior.Strict)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs index 35c4ff0e7d4..a69469ab185 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs @@ -41,7 +41,7 @@ internal sealed class AutoClosingTagOnAutoInsertProvider : IOnAutoInsertProvider private readonly RazorLSPOptionsMonitor _optionsMonitor; private readonly ILogger _logger; - public AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) + public AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) { if (optionsMonitor is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs index d99c9c78e96..81207b73be5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs @@ -19,7 +19,7 @@ internal sealed class CloseTextTagOnAutoInsertProvider : IOnAutoInsertProvider private readonly RazorLSPOptionsMonitor _optionsMonitor; private readonly ILogger _logger; - public CloseTextTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) + public CloseTextTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) { if (optionsMonitor is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index 86c44fe2c08..2712684d4aa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -25,7 +25,7 @@ internal class OnAutoInsertEndpoint( IClientConnection clientConnection, IEnumerable onAutoInsertProvider, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { private static readonly HashSet s_htmlAllowedTriggerCharacters = new(StringComparer.Ordinal) { "=", }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs index ad44420ff28..d46d0a645dc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs @@ -35,7 +35,7 @@ internal sealed class CodeActionEndpoint( IEnumerable htmlCodeActionProviders, IClientConnection clientConnection, LanguageServerFeatureOptions languageServerFeatureOptions, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, ITelemetryReporter? telemetryReporter) : IRazorRequestHandler[]?>, ICapabilitiesProvider { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs index 1f5b6a5e55d..c2c162b9bfe 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionResolveEndpoint.cs @@ -30,7 +30,7 @@ public CodeActionResolveEndpoint( IEnumerable razorCodeActionResolvers, IEnumerable csharpCodeActionResolvers, IEnumerable htmlCodeActionResolvers, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { if (razorCodeActionResolvers is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs index eb04171cd66..516cd4aa744 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToCodeBehindCodeActionProvider.cs @@ -24,7 +24,7 @@ internal sealed class ExtractToCodeBehindCodeActionProvider : IRazorCodeActionPr private static readonly Task?> s_emptyResult = Task.FromResult?>(null); private readonly ILogger _logger; - public ExtractToCodeBehindCodeActionProvider(IRazorLoggerFactory loggerFactory) + public ExtractToCodeBehindCodeActionProvider(ILoggerFactory loggerFactory) { if (loggerFactory is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs index 2207e3e9785..b468a35bad4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/AggregateCompletionItemResolver.cs @@ -16,7 +16,7 @@ internal class AggregateCompletionItemResolver private readonly IReadOnlyList _completionItemResolvers; private readonly ILogger _logger; - public AggregateCompletionItemResolver(IEnumerable completionItemResolvers, IRazorLoggerFactory loggerFactory) + public AggregateCompletionItemResolver(IEnumerable completionItemResolvers, ILoggerFactory loggerFactory) { _completionItemResolvers = completionItemResolvers.ToArray(); _logger = loggerFactory.GetOrCreateLogger(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs index 11a8667fe8b..43d3bc3f74f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionEndpoint.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; internal class LegacyRazorCompletionEndpoint( IRazorCompletionFactsService completionFactsService, CompletionListCache completionListCache, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IVSCompletionEndpoint { private readonly IRazorCompletionFactsService _completionFactsService = completionFactsService; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs index 8c33f235087..6f10d6054de 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/LegacyRazorCompletionResolveEndpoint.cs @@ -39,7 +39,7 @@ public LegacyRazorCompletionResolveEndpoint( LSPTagHelperTooltipFactory lspTagHelperTooltipFactory, VSLSPTagHelperTooltipFactory vsLspTagHelperTooltipFactory, CompletionListCache completionListCache, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { if (lspTagHelperTooltipFactory is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs index 16460a4157c..22b7370c350 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -18,7 +18,7 @@ internal class RazorCompletionEndpoint( CompletionListProvider completionListProvider, ITelemetryReporter? telemetryReporter, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IVSCompletionEndpoint { private readonly CompletionListProvider _completionListProvider = completionListProvider; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs index 6f4ff35aafc..53a1c7756b1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs @@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion; internal class RazorCompletionListProvider( IRazorCompletionFactsService completionFactsService, CompletionListCache completionListCache, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { private readonly IRazorCompletionFactsService _completionFactsService = completionFactsService; private readonly CompletionListCache _completionListCache = completionListCache; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs index 0ab035581af..4978c2150d7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs @@ -29,7 +29,7 @@ internal class RazorBreakpointSpanEndpoint : IRazorDocumentlessRequestHandler( languageServerFeatureOptions, documentMappingService, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs index 7de9b21d1dd..8f41a773af8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorComponentSearchEngine.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal class DefaultRazorComponentSearchEngine( IProjectSnapshotManager projectManager, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : RazorComponentSearchEngine { private readonly IProjectSnapshotManager _projectManager = projectManager; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs index 45f8306c0ed..fce5693288e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs @@ -18,7 +18,7 @@ internal class DefaultRazorConfigurationService : IConfigurationSyncService private readonly IClientConnection _clientConnection; private readonly ILogger _logger; - public DefaultRazorConfigurationService(IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) + public DefaultRazorConfigurationService(IClientConnection clientConnection, ILoggerFactory loggerFactory) { if (clientConnection is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs index 6915642e930..f7a2294e449 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs @@ -31,7 +31,7 @@ internal sealed class DefinitionEndpoint( IRazorDocumentMappingService documentMappingService, LanguageServerFeatureOptions languageServerFeatureOptions, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { private readonly RazorComponentSearchEngine _componentSearchEngine = componentSearchEngine ?? throw new ArgumentNullException(nameof(componentSearchEngine)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs index 415b8d7b2b3..b7163a7efd7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs @@ -44,7 +44,7 @@ public RazorDiagnosticsPublisher( LanguageServerFeatureOptions languageServerFeatureOptions, Lazy razorTranslateDiagnosticsService, Lazy documentContextFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { if (projectSnapshotManagerDispatcher is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs index 5bb4f2e87e0..172017e5ca0 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsEndpoint.cs @@ -21,7 +21,7 @@ internal class RazorTranslateDiagnosticsEndpoint : IRazorRequestHandler /// The . - /// The . + /// The . /// - public RazorTranslateDiagnosticsService(IRazorDocumentMappingService documentMappingService, IRazorLoggerFactory loggerFactory) + public RazorTranslateDiagnosticsService(IRazorDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) { if (documentMappingService is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs index d669cde63f4..9eaf45bef36 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs @@ -18,7 +18,7 @@ internal sealed class DocumentContextFactory( IProjectSnapshotManager projectManager, ISnapshotResolver snapshotResolver, IDocumentVersionCache documentVersionCache, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IDocumentContextFactory { private readonly IProjectSnapshotManager _projectManager = projectManager; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs index 3ac8038020f..948f967c31e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentHighlighting/DocumentHighlightEndpoint.cs @@ -23,7 +23,7 @@ public DocumentHighlightEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs index d43757bb044..0091662b682 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentTextPresentationEndpoint.cs @@ -17,7 +17,7 @@ internal class TextDocumentTextPresentationEndpoint( IRazorDocumentMappingService razorDocumentMappingService, IClientConnection clientConnection, IFilePathService filePathService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractTextDocumentPresentationEndpointBase(razorDocumentMappingService, clientConnection, filePathService, loggerFactory.GetOrCreateLogger()), ITextDocumentTextPresentationHandler { public override string EndpointName => CustomMessageNames.RazorTextPresentationEndpoint; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs index 6a2988b4458..5c56ea5197d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/TextDocumentUriPresentationEndpoint.cs @@ -26,7 +26,7 @@ internal class TextDocumentUriPresentationEndpoint( IClientConnection clientConnection, IFilePathService filePathService, IDocumentContextFactory documentContextFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractTextDocumentPresentationEndpointBase(razorDocumentMappingService, clientConnection, filePathService, loggerFactory.GetOrCreateLogger()), ITextDocumentUriPresentationHandler { private readonly RazorComponentSearchEngine _razorComponentSearchEngine = razorComponentSearchEngine ?? throw new ArgumentNullException(nameof(razorComponentSearchEngine)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs index cb27555c085..837a97d7dad 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization; internal class DocumentDidChangeEndpoint( ProjectSnapshotManagerDispatcher projectSnapshotManagerDispatcher, IRazorProjectService razorProjectService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IRazorNotificationHandler, ITextDocumentIdentifierHandler, ICapabilitiesProvider { public bool MutatesSolutionState => true; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs index 32c55b6507b..153093ce4e5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidSaveEndpoint.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization; [RazorLanguageServerEndpoint(Methods.TextDocumentDidSaveName)] -internal class DocumentDidSaveEndpoint(IRazorLoggerFactory loggerFactory) +internal class DocumentDidSaveEndpoint(ILoggerFactory loggerFactory) : IRazorNotificationHandler, ITextDocumentIdentifierHandler { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs index d5250aa7c67..2a6988c5d60 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/FindAllReferences/FindAllReferencesEndpoint.cs @@ -27,7 +27,7 @@ public FindAllReferencesEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, IFilePathService filePathService) : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs index 048191ec443..77597beb222 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs @@ -35,7 +35,7 @@ public FoldingRangeEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IEnumerable foldingRangeProviders, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs index 88a424f36ee..065d1e28add 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs @@ -24,7 +24,7 @@ internal class CSharpFormattingPass : CSharpFormattingPassBase public CSharpFormattingPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { if (loggerFactory is null) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs index 27132045c94..d3369dc5c36 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs @@ -36,7 +36,7 @@ public CSharpOnTypeFormattingPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { if (loggerFactory is null) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 5fc901a0c04..8c517e92784 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -22,7 +22,7 @@ internal class DocumentOnTypeFormattingEndpoint( IRazorFormattingService razorFormattingService, IRazorDocumentMappingService razorDocumentMappingService, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs index 7155a9f2c67..cf541ca0f58 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs @@ -22,7 +22,7 @@ internal class FormattingContentValidationPass : FormattingPassBase public FormattingContentValidationPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { if (loggerFactory is null) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs index eaf9c6ef033..82f7ba41fb9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs @@ -24,7 +24,7 @@ internal class FormattingDiagnosticValidationPass : FormattingPassBase public FormattingDiagnosticValidationPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { if (loggerFactory is null) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs index b32a24b9100..a7e62a6abf7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs @@ -29,7 +29,7 @@ public HtmlFormattingPass( IClientConnection clientConnection, IDocumentVersionCache documentVersionCache, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, clientConnection) { if (loggerFactory is null) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs index 9e63225770f..e415a51200d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs @@ -22,7 +22,7 @@ internal class RazorFormattingPass( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : FormattingPassBase(documentMappingService, clientConnection) { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index 693452ac46a..8d7f783364a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -32,7 +32,7 @@ public GeneratedDocumentPublisher( ProjectSnapshotManagerDispatcher dispatcher, IClientConnection clientConnection, LanguageServerFeatureOptions options, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { _projectManager = projectManager; _dispatcher = dispatcher; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs index 1b6610cd579..052e2345037 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/ClaspLoggingBridge.cs @@ -19,9 +19,9 @@ internal class ClaspLoggingBridge : ILspLogger private readonly ILogger _logger; private readonly ITelemetryReporter? _telemetryReporter; - public ClaspLoggingBridge(IRazorLoggerFactory loggerFactory, ITelemetryReporter? telemetryReporter = null) + public ClaspLoggingBridge(ILoggerFactory loggerFactory, ITelemetryReporter? telemetryReporter = null) { - // We're creating this on behalf of CLaSP, because it doesn't know how to use IRazorLoggerFactory, so using that as the category name. + // We're creating this on behalf of CLaSP, because it doesn't know how to use our ILoggerFactory, so using that as the category name. _logger = loggerFactory.GetOrCreateLogger("CLaSP"); _telemetryReporter = telemetryReporter; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerWrapper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerWrapper.cs index fc5bc72f6d0..14843ff1289 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerWrapper.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerWrapper.cs @@ -36,7 +36,7 @@ private RazorLanguageServerWrapper(RazorLanguageServer innerServer) public static RazorLanguageServerWrapper Create( Stream input, Stream output, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, ITelemetryReporter telemetryReporter, ProjectSnapshotManagerDispatcher? projectSnapshotManagerDispatcher = null, Action? configure = null, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs index dd7714ab9ce..f8f219ee63a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverEndpoint.cs @@ -24,7 +24,7 @@ public HoverEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _hoverService = hoverService ?? throw new ArgumentNullException(nameof(hoverService)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs index f83d01344b5..5c19314fd8a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Implementation/ImplementationEndpoint.cs @@ -26,7 +26,7 @@ public ImplementationEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()) { _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index 4f4d5d46e6f..31cc544bbdf 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -28,7 +28,7 @@ internal sealed class InlineCompletionEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, IAdhocWorkspaceFactory adhocWorkspaceFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { private static readonly ImmutableHashSet s_cSharpKeywords = ImmutableHashSet.Create( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs index 4195b4cd1f1..c03c704d2f6 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LanguageServerErrorReporter.cs @@ -13,7 +13,7 @@ internal class LanguageServerErrorReporter : IErrorReporter { private readonly ILogger _logger; - public LanguageServerErrorReporter(IRazorLoggerFactory loggerFactory) + public LanguageServerErrorReporter(ILoggerFactory loggerFactory) { if (loggerFactory is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs index 3edc4418421..bfd3b3eee8b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LinkedEditingRange/LinkedEditingRangeEndpoint.cs @@ -26,7 +26,7 @@ internal class LinkedEditingRangeEndpoint : IRazorRequestHandler { private readonly IRazorDocumentMappingService _documentMappingService = documentMappingService; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs index c79dc8f1398..3958289cb63 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs @@ -33,7 +33,7 @@ public ProjectConfigurationFileChangeDetector( ProjectSnapshotManagerDispatcher dispatcher, IEnumerable listeners, LanguageServerFeatureOptions options, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { if (loggerFactory is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs index 260ce449a33..646324e6345 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationStateSynchronizer.cs @@ -30,7 +30,7 @@ internal class ProjectConfigurationStateSynchronizer : IProjectConfigurationFile public ProjectConfigurationStateSynchronizer( ProjectSnapshotManagerDispatcher projectSnapshotManagerDispatcher, IRazorProjectService projectService, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, LanguageServerFeatureOptions languageServerFeatureOptions) { _projectSnapshotManagerDispatcher = projectSnapshotManagerDispatcher; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs index 660ab34f26c..dbb996fefe7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/MonitorProjectConfigurationFilePathEndpoint.cs @@ -25,7 +25,7 @@ internal class MonitorProjectConfigurationFilePathEndpoint : IRazorNotificationH private readonly WorkspaceDirectoryPathResolver _workspaceDirectoryPathResolver; private readonly IEnumerable _listeners; private readonly LanguageServerFeatureOptions _options; - private readonly IRazorLoggerFactory _loggerFactory; + private readonly ILoggerFactory _loggerFactory; private readonly ILogger _logger; private readonly ConcurrentDictionary _outputPathMonitors; private readonly object _disposeLock; @@ -39,7 +39,7 @@ public MonitorProjectConfigurationFilePathEndpoint( WorkspaceDirectoryPathResolver workspaceDirectoryPathResolver, IEnumerable listeners, LanguageServerFeatureOptions options, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { _projectManager = projectManager; _dispatcher = dispatcher; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs index 9eee0df92bb..e68b904ce9f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs @@ -28,7 +28,7 @@ internal class RazorProjectService( ISnapshotResolver snapshotResolver, IDocumentVersionCache documentVersionCache, IProjectSnapshotManager projectManager, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IRazorProjectService { private readonly IProjectSnapshotManager _projectManager = projectManager; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs index 4c5c48c6e5f..3bc1f08256e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/SnapshotResolver.cs @@ -21,7 +21,7 @@ internal sealed class SnapshotResolver : ISnapshotResolver // Internal for testing internal readonly HostProject MiscellaneousHostProject; - public SnapshotResolver(IProjectSnapshotManager projectManager, IRazorLoggerFactory loggerFactory) + public SnapshotResolver(IProjectSnapshotManager projectManager, ILoggerFactory loggerFactory) { _projectManager = projectManager; _logger = loggerFactory.GetOrCreateLogger(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs index 586987a1d5d..1928c4af116 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorConfigurationEndpoint.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -internal class RazorConfigurationEndpoint(RazorLSPOptionsMonitor optionsMonitor, IRazorLoggerFactory loggerFactory) +internal class RazorConfigurationEndpoint(RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) : IDidChangeConfigurationEndpoint, IOnInitialized { private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs index e039a65baf4..61d7886acef 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal sealed class RazorDocumentMappingService( IFilePathService filePathService, IDocumentContextFactory documentContextFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorDocumentMappingService(filePathService, documentContextFactory, loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs index fae664aac92..479e9d09797 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.LoggerFactoryWrapper.cs @@ -8,15 +8,15 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal partial class RazorLanguageServer { /// - /// Very small wrapper around the to add a prefix to the category name, so we can tell in the logs + /// Very small wrapper around the to add a prefix to the category name, so we can tell in the logs /// whether things are coming from the VS side, the LSP side, of our code. This is only temporary and will be removed when we move /// to cohosting as there will only be one side. /// - private sealed class LoggerFactoryWrapper(IRazorLoggerFactory loggerFactory) : IRazorLoggerFactory + private sealed class LoggerFactoryWrapper(ILoggerFactory loggerFactory) : ILoggerFactory { - private IRazorLoggerFactory _loggerFactory = loggerFactory; + private ILoggerFactory _loggerFactory = loggerFactory; - public void AddLoggerProvider(IRazorLoggerProvider provider) + public void AddLoggerProvider(ILoggerProvider provider) { _loggerFactory.AddLoggerProvider(provider); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs index e4130ec5323..3f123b2749d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal partial class RazorLanguageServer : AbstractLanguageServer { private readonly JsonRpc _jsonRpc; - private readonly IRazorLoggerFactory _loggerFactory; + private readonly ILoggerFactory _loggerFactory; private readonly LanguageServerFeatureOptions? _featureOptions; private readonly ProjectSnapshotManagerDispatcher? _projectSnapshotManagerDispatcher; private readonly Action? _configureServer; @@ -51,7 +51,7 @@ internal partial class RazorLanguageServer : AbstractLanguageServer? configureServer, @@ -74,7 +74,7 @@ public RazorLanguageServer( Initialize(); } - private static ILspLogger CreateILspLogger(IRazorLoggerFactory loggerFactory, ITelemetryReporter telemetryReporter) + private static ILspLogger CreateILspLogger(ILoggerFactory loggerFactory, ITelemetryReporter telemetryReporter) { return new ClaspLoggingBridge(loggerFactory, telemetryReporter); } @@ -94,7 +94,7 @@ protected override ILspServices ConstructLspServices() var loggerFactoryWrapper = new LoggerFactoryWrapper(_loggerFactory); // Wrap the logger factory so that we can add [LSP] to the start of all the categories - services.AddSingleton(loggerFactoryWrapper); + services.AddSingleton(loggerFactoryWrapper); if (_configureServer is not null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs index a9713ef9a22..956408de01f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs @@ -19,7 +19,7 @@ internal class RazorRequestContextFactory(ILspServices lspServices) : AbstractRe public override Task CreateRequestContextAsync(IQueueItem queueItem, IMethodHandler methodHandler, TRequestParams @params, CancellationToken cancellationToken) { - var logger = _lspServices.GetRequiredService().GetOrCreateLogger(); + var logger = _lspServices.GetRequiredService().GetOrCreateLogger(); VersionedDocumentContext? documentContext = null; var textDocumentHandler = methodHandler as ITextDocumentIdentifierHandler; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs index 02972f161ee..9a86b6593b3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RenameEndpoint.cs @@ -32,7 +32,7 @@ internal sealed class RenameEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorDelegatingEndpoint( languageServerFeatureOptions, documentMappingService, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs index c6535a673aa..2f749685e56 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Semantic; -internal class LSPCSharpSemanticTokensProvider(LanguageServerFeatureOptions languageServerFeatureOptions, IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) : ICSharpSemanticTokensProvider +internal class LSPCSharpSemanticTokensProvider(LanguageServerFeatureOptions languageServerFeatureOptions, IClientConnection clientConnection, ILoggerFactory loggerFactory) : ICSharpSemanticTokensProvider { private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; private readonly IClientConnection _clientConnection = clientConnection; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs index c26568aae92..4a2bd4da4e4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs @@ -13,7 +13,7 @@ internal class RazorSemanticTokensInfoService( ISemanticTokensLegendService semanticTokensLegendService, ICSharpSemanticTokensProvider csharpSemanticTokensProvider, LanguageServerFeatureOptions languageServerFeatureOptions, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorSemanticTokensInfoService(documentMappingService, semanticTokensLegendService, csharpSemanticTokensProvider, languageServerFeatureOptions, loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs index 1268fcb7616..69439038b1c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs @@ -20,7 +20,7 @@ internal sealed class SignatureHelpEndpoint( IRazorDocumentMappingService documentMappingService, IClientConnection clientConnection, RazorLSPOptionsMonitor optionsMonitor, - IRazorLoggerFactory loggerProvider) + ILoggerFactory loggerProvider) : AbstractRazorDelegatingEndpoint( languageServerFeatureOptions, documentMappingService, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs index 50a7b40fa31..5f2c2d465f1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs @@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.WrapWithTag; internal class WrapWithTagEndpoint( IClientConnection clientConnection, IRazorDocumentMappingService razorDocumentMappingService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IRazorRequestHandler { private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractLoggerFactory.AggregateLogger.cs similarity index 95% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractLoggerFactory.AggregateLogger.cs index e02f3da8d85..57c9d638552 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.AggregateLogger.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractLoggerFactory.AggregateLogger.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.Razor.Logging; -internal abstract partial class AbstractRazorLoggerFactory +internal abstract partial class AbstractLoggerFactory { private class AggregateLogger(ImmutableArray loggers) : ILogger { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractLoggerFactory.cs similarity index 82% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractLoggerFactory.cs index 5f1328a5591..70ae45dbf27 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/AbstractLoggerFactory.cs @@ -2,18 +2,21 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.PooledObjects; +#if !NET7_0_OR_GREATER +using System.Collections.Generic; +#endif + namespace Microsoft.CodeAnalysis.Razor.Logging; -internal abstract partial class AbstractRazorLoggerFactory : IRazorLoggerFactory +internal abstract partial class AbstractLoggerFactory : ILoggerFactory { private ImmutableDictionary _loggers; - private ImmutableArray _providers; + private ImmutableArray _providers; - protected AbstractRazorLoggerFactory(ImmutableArray providers) + protected AbstractLoggerFactory(ImmutableArray providers) { _providers = providers; _loggers = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase); @@ -37,7 +40,7 @@ public ILogger GetOrCreateLogger(string categoryName) return ImmutableInterlocked.AddOrUpdate(ref _loggers, categoryName, result, (k, v) => v); } - public void AddLoggerProvider(IRazorLoggerProvider provider) + public void AddLoggerProvider(ILoggerProvider provider) { if (ImmutableInterlocked.Update(ref _providers, (set, p) => set.Add(p), provider)) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerFactory.cs similarity index 77% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerFactory.cs index 5180c740864..fdf319368db 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerFactory.cs @@ -4,8 +4,8 @@ namespace Microsoft.CodeAnalysis.Razor.Logging; // Our version of ILoggerFactory, so that we're not MEF importing general use types -internal interface IRazorLoggerFactory +internal interface ILoggerFactory { - void AddLoggerProvider(IRazorLoggerProvider provider); + void AddLoggerProvider(ILoggerProvider provider); ILogger GetOrCreateLogger(string categoryName); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerFactoryExtensions.cs similarity index 87% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerFactoryExtensions.cs index e4841644254..db7ef6f6742 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerFactoryExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerFactoryExtensions.cs @@ -5,9 +5,9 @@ namespace Microsoft.CodeAnalysis.Razor.Logging; -internal static class IRazorLoggerFactoryExtensions +internal static class ILoggerFactoryExtensions { - public static ILogger GetOrCreateLogger(this IRazorLoggerFactory factory) + public static ILogger GetOrCreateLogger(this ILoggerFactory factory) { return factory.GetOrCreateLogger(TrimTypeName(typeof(T).FullName)); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerProvider.cs similarity index 64% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerProvider.cs index c0d5ac5812b..4b948c00935 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/IRazorLoggerProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerProvider.cs @@ -3,8 +3,7 @@ namespace Microsoft.CodeAnalysis.Razor.Logging; -// Very very light wrapper for ILoggerProvider, so that we're not MEF importing general use types -internal interface IRazorLoggerProvider +internal interface ILoggerProvider { ILogger CreateLogger(string categoryName); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs index 98ec6a750a8..746868a1236 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs @@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor.DocumentMapping; internal sealed class RemoteDocumentMappingService( IFilePathService filePathService, IDocumentContextFactory documentContextFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorDocumentMappingService( filePathService, documentContextFactory, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs index 5a09af12d66..b674aa56442 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Logging/RemoteLoggerFactory.cs @@ -7,9 +7,9 @@ namespace Microsoft.CodeAnalysis.Remote.Razor.Logging; -[Export(typeof(IRazorLoggerFactory)), Shared] +[Export(typeof(ILoggerFactory)), Shared] [method: ImportingConstructor] -internal partial class RemoteLoggerFactory() : IRazorLoggerFactory +internal partial class RemoteLoggerFactory() : ILoggerFactory { private static TraceSource? s_traceSource; @@ -18,7 +18,7 @@ internal static void Initialize(TraceSource traceSource) s_traceSource ??= traceSource; } - public void AddLoggerProvider(IRazorLoggerProvider provider) + public void AddLoggerProvider(ILoggerProvider provider) { throw new System.NotImplementedException(); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs index 5ec183be254..9414fa0ec1f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RazorSemanticTokensInfoService.cs @@ -17,7 +17,7 @@ internal class RazorSemanticTokensInfoService( ISemanticTokensLegendService semanticTokensLegendService, ICSharpSemanticTokensProvider csharpSemanticTokensProvider, LanguageServerFeatureOptions languageServerFeatureOptions, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorSemanticTokensInfoService( documentMappingService, semanticTokensLegendService, diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs index b34da46ac14..9069ebeb32a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs +++ b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/VSTelemetryReporter.cs @@ -16,7 +16,7 @@ internal class VSTelemetryReporter : TelemetryReporter private readonly Lazy _logger; [ImportingConstructor] - public VSTelemetryReporter(Lazy loggerFactory) + public VSTelemetryReporter(Lazy loggerFactory) // Get the DefaultSession for telemetry. This is set by VS with // TelemetryService.SetDefaultSession and provides the correct // appinsights keys etc diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs index 1aedab42767..dabad8707de 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentAddListener.cs @@ -16,7 +16,7 @@ namespace Microsoft.VisualStudio.LanguageServerClient.Razor; [Export(typeof(LSPDocumentChangeListener))] [ContentType(RazorConstants.RazorLSPContentTypeName)] [method: ImportingConstructor] -internal class CSharpVirtualDocumentAddListener(IRazorLoggerFactory loggerFactory) : LSPDocumentChangeListener +internal class CSharpVirtualDocumentAddListener(ILoggerFactory loggerFactory) : LSPDocumentChangeListener { private static readonly TimeSpan s_waitTimeout = TimeSpan.FromMilliseconds(500); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs index c141da3b62d..79c2690a9d1 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/CSharpVirtualDocumentFactory.cs @@ -48,7 +48,7 @@ public CSharpVirtualDocumentFactory( IFilePathService filePathService, IProjectSnapshotManager projectManager, LanguageServerFeatureOptions languageServerFeatureOptions, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, ITelemetryReporter telemetryReporter) : base(contentTypeRegistry, textBufferFactory, textDocumentFactory, fileUriProvider) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs index 97d5927deb9..e0d45041dd4 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostSemanticTokensRangeEndpoint.cs @@ -27,7 +27,7 @@ internal sealed class CohostSemanticTokensRangeEndpoint( IOutOfProcSemanticTokensService semanticTokensInfoService, ISemanticTokensLegendService semanticTokensLegendService, ITelemetryReporter telemetryReporter, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : AbstractRazorCohostDocumentRequestHandler, ICapabilitiesProvider { private readonly IOutOfProcSemanticTokensService _semanticTokensInfoService = semanticTokensInfoService; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs index 5dd33bc8bc1..00cb875fd51 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/CohostTextDocumentSyncHandler.cs @@ -23,7 +23,7 @@ internal class CohostTextDocumentSyncHandler( IRemoteClientProvider remoteClientProvider, LSPDocumentManager documentManager, JoinableTaskContext joinableTaskContext, - IRazorLoggerFactory loggerFactory) : IRazorCohostTextDocumentSyncHandler + ILoggerFactory loggerFactory) : IRazorCohostTextDocumentSyncHandler { private readonly IRemoteClientProvider _remoteClientProvider = remoteClientProvider; private readonly JoinableTaskContext _joinableTaskContext = joinableTaskContext; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs index 78b1a16b9b1..703288d44ab 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPBreakpointSpanProvider.cs @@ -24,7 +24,7 @@ internal class DefaultLSPBreakpointSpanProvider : LSPBreakpointSpanProvider [ImportingConstructor] public DefaultLSPBreakpointSpanProvider( LSPRequestInvoker requestInvoker, - Lazy loggerFactory) + Lazy loggerFactory) { if (requestInvoker is null) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs index be9061c6204..a4c78791aae 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Debugging/DefaultLSPProximityExpressionsProvider.cs @@ -26,7 +26,7 @@ internal class DefaultLSPProximityExpressionsProvider : LSPProximityExpressionsP [ImportingConstructor] public DefaultLSPProximityExpressionsProvider( LSPRequestInvoker requestInvoker, - Lazy loggerFactory) + Lazy loggerFactory) { if (requestInvoker is null) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs index ddbd898f35a..073ea1b19ee 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Logging/RazorLogHubLoggerProvider.cs @@ -7,8 +7,8 @@ namespace Microsoft.VisualStudio.LanguageServerClient.Razor.Logging; -[Export(typeof(IRazorLoggerProvider))] -internal sealed class RazorLogHubLoggerProvider : IRazorLoggerProvider +[Export(typeof(ILoggerProvider))] +internal sealed class RazorLogHubLoggerProvider : ILoggerProvider { private readonly RazorLogHubTraceProvider _traceProvider; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs index 6a3264eebd5..9f14812bf03 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorCustomMessageTarget.cs @@ -54,7 +54,7 @@ public RazorCustomMessageTarget( LanguageServerFeatureOptions languageServerFeatureOptions, IProjectSnapshotManager projectManager, SnippetCache snippetCache, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) { if (documentManager is null) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorLanguageServerClient.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorLanguageServerClient.cs index 3949cf3aef6..3391ed3c9e4 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorLanguageServerClient.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/RazorLanguageServerClient.cs @@ -37,7 +37,7 @@ internal class RazorLanguageServerClient( RazorLanguageClientMiddleLayer middleLayer, LSPRequestInvoker requestInvoker, ProjectConfigurationFilePathStore projectConfigurationFilePathStore, - IRazorLoggerFactory razorLoggerFactory, + ILoggerFactory loggerFactory, RazorLogHubTraceProvider traceProvider, LanguageServerFeatureOptions languageServerFeatureOptions, ProjectSnapshotManagerDispatcher projectSnapshotManagerDispatcher, @@ -61,7 +61,7 @@ internal class RazorLanguageServerClient( private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions)); private readonly VisualStudioHostServicesProvider _vsHostWorkspaceServicesProvider = vsHostWorkspaceServicesProvider ?? throw new ArgumentNullException(nameof(vsHostWorkspaceServicesProvider)); private readonly ProjectSnapshotManagerDispatcher _projectSnapshotManagerDispatcher = projectSnapshotManagerDispatcher ?? throw new ArgumentNullException(nameof(projectSnapshotManagerDispatcher)); - private readonly IRazorLoggerFactory _razorLoggerFactory = razorLoggerFactory ?? throw new ArgumentNullException(nameof(razorLoggerFactory)); + private readonly ILoggerFactory _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); private readonly RazorLogHubTraceProvider _traceProvider = traceProvider ?? throw new ArgumentNullException(nameof(traceProvider)); private RazorLanguageServerWrapper? _server; @@ -108,7 +108,7 @@ public event AsyncEventHandler? StopAsync _server = RazorLanguageServerWrapper.Create( serverStream, serverStream, - _razorLoggerFactory, + _loggerFactory, _telemetryReporter, _projectSnapshotManagerDispatcher, ConfigureLanguageServer, diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs index 439c6b1a126..c5473efa336 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/MemoryLoggerProvider.cs @@ -6,9 +6,9 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Logging; -[Export(typeof(IRazorLoggerProvider))] +[Export(typeof(ILoggerProvider))] [method: ImportingConstructor] -internal partial class MemoryLoggerProvider() : IRazorLoggerProvider +internal partial class MemoryLoggerProvider() : ILoggerProvider { // How many messages will the buffer contain private const int BufferSize = 5000; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs index 59f21c97123..0b35db20a6c 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/OutputWindowLoggerProvider.cs @@ -14,14 +14,14 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Logging; -[Export(typeof(IRazorLoggerProvider))] +[Export(typeof(ILoggerProvider))] [method: ImportingConstructor] internal class OutputWindowLoggerProvider( // Anything this class imports would have a circular dependency if they tried to log anything, // or used anything that does logging, so make sure everything of ours is imported lazily Lazy clientSettingsManager, JoinableTaskContext joinableTaskContext) - : IRazorLoggerProvider + : ILoggerProvider { private readonly Lazy _clientSettingsManager = clientSettingsManager; private readonly OutputPane _outputPane = new OutputPane(joinableTaskContext); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/VisualStudioRazorLoggerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/VisualStudioLoggerFactory.cs similarity index 66% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/VisualStudioRazorLoggerFactory.cs rename to src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/VisualStudioLoggerFactory.cs index e54bdd35892..1ab3ed7c87a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/VisualStudioRazorLoggerFactory.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Logging/VisualStudioLoggerFactory.cs @@ -8,9 +8,9 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.Logging; -[Export(typeof(IRazorLoggerFactory))] +[Export(typeof(ILoggerFactory))] [method: ImportingConstructor] -internal sealed class VisualStudioRazorLoggerFactory([ImportMany] IEnumerable providers) - : AbstractRazorLoggerFactory(providers.ToImmutableArray()) +internal sealed class VisualStudioLoggerFactory([ImportMany] IEnumerable providers) + : AbstractLoggerFactory(providers.ToImmutableArray()) { } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs index c7c20c40340..c8107a64037 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Remote/OutOfProcSemanticTokensService.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor; [Export(typeof(IOutOfProcSemanticTokensService))] [method: ImportingConstructor] -internal class OutOfProcSemanticTokensService(IRemoteClientProvider remoteClientProvider, IClientSettingsManager clientSettingsManager, IRazorLoggerFactory loggerFactory) : IOutOfProcSemanticTokensService +internal class OutOfProcSemanticTokensService(IRemoteClientProvider remoteClientProvider, IClientSettingsManager clientSettingsManager, ILoggerFactory loggerFactory) : IOutOfProcSemanticTokensService { private readonly IRemoteClientProvider _remoteClientProvider = remoteClientProvider; private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager; diff --git a/src/Razor/src/rzls/LoggerFactory.cs b/src/Razor/src/rzls/LoggerFactory.cs index 0f2b028d731..d4c5d8425ff 100644 --- a/src/Razor/src/rzls/LoggerFactory.cs +++ b/src/Razor/src/rzls/LoggerFactory.cs @@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -internal sealed class LoggerFactory(ImmutableArray providers) - : AbstractRazorLoggerFactory(providers) +internal sealed class LoggerFactory(ImmutableArray providers) + : AbstractLoggerFactory(providers) { } diff --git a/src/Razor/src/rzls/LoggerProvider.cs b/src/Razor/src/rzls/LoggerProvider.cs index 2a2527f0321..768c713a454 100644 --- a/src/Razor/src/rzls/LoggerProvider.cs +++ b/src/Razor/src/rzls/LoggerProvider.cs @@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -internal class LoggerProvider(LogLevel logLevel, IClientConnection clientConnection) : IRazorLoggerProvider +internal class LoggerProvider(LogLevel logLevel, IClientConnection clientConnection) : ILoggerProvider { private readonly LogLevel _logLevel = logLevel; private readonly IClientConnection _clientConnection = clientConnection; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs index 18e169b3dfe..e3f63cfb270 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs @@ -105,7 +105,7 @@ private class TestRazorCompletionListProvider : RazorCompletionListProvider public TestRazorCompletionListProvider( VSInternalCompletionList completionList, IEnumerable triggerCharacters, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(completionFactsService: null, completionListCache: null, loggerFactory) { _completionList = completionList; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs index 3d4f3141a7e..bb8dee4338e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/TestDelegatedCompletionListProvider.cs @@ -23,7 +23,7 @@ internal class TestDelegatedCompletionListProvider : DelegatedCompletionListProv private TestDelegatedCompletionListProvider( DelegatedCompletionResponseRewriter[] responseRewriters, CompletionRequestResponseFactory completionFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base( responseRewriters, new RazorDocumentMappingService(new LSPFilePathService(TestLanguageServerFeatureOptions.Instance), new TestDocumentContextFactory(), loggerFactory), @@ -37,13 +37,13 @@ private TestDelegatedCompletionListProvider( } public static TestDelegatedCompletionListProvider Create( - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, params DelegatedCompletionResponseRewriter[] responseRewriters) => Create(delegatedCompletionList: null, loggerFactory, responseRewriters: responseRewriters); public static TestDelegatedCompletionListProvider Create( CSharpTestLspServer csharpServer, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, CancellationToken cancellationToken, params DelegatedCompletionResponseRewriter[] responseRewriters) { @@ -54,7 +54,7 @@ public static TestDelegatedCompletionListProvider Create( public static TestDelegatedCompletionListProvider Create( VSInternalCompletionList delegatedCompletionList, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, params DelegatedCompletionResponseRewriter[] responseRewriters) { delegatedCompletionList ??= new VSInternalCompletionList() @@ -67,7 +67,7 @@ public static TestDelegatedCompletionListProvider Create( } public static TestDelegatedCompletionListProvider CreateWithNullResponse( - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, params DelegatedCompletionResponseRewriter[] responseRewriters) { var requestResponseFactory = new StaticCompletionRequestResponseFactory(null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs index bb11c704bd2..bc42e3d2239 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs @@ -546,7 +546,7 @@ public TestRazorDiagnosticsPublisher( LanguageServerFeatureOptions options, RazorTranslateDiagnosticsService razorTranslateDiagnosticsService, IDocumentContextFactory documentContextFactory, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(dispatcher, clientConnection, options, new Lazy(() => razorTranslateDiagnosticsService), new Lazy(() => documentContextFactory), diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs index ba7443c3507..abafd310f66 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs @@ -1226,7 +1226,7 @@ class TestRazorDiagnosticsServiceWithRazorDiagnostic : RazorTranslateDiagnostics { public TestRazorDiagnosticsServiceWithRazorDiagnostic( IRazorDocumentMappingService documentMappingService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, loggerFactory) { } @@ -1241,7 +1241,7 @@ class TestRazorDiagnosticsServiceWithoutRazorDiagnostic : RazorTranslateDiagnost { public TestRazorDiagnosticsServiceWithoutRazorDiagnostic( IRazorDocumentMappingService documentMappingService, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(documentMappingService, loggerFactory) { } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs index 7f26ad497f5..648e368f8a8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs @@ -17,7 +17,7 @@ internal static class TestRazorFormattingService #pragma warning disable IDE0060 // Remove unused parameter public static Task CreateWithFullSupportAsync( - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, RazorCodeDocument? codeDocument = null, IDocumentSnapshot? documentSnapshot = null, RazorLSPOptions? razorLSPOptions = null) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs index 0a011fed00f..feec41038d3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs @@ -27,10 +27,10 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -internal class FormattingLanguageServerClient(IRazorLoggerFactory loggerFactory) : IClientConnection +internal class FormattingLanguageServerClient(ILoggerFactory loggerFactory) : IClientConnection { private readonly Dictionary _documents = []; - private readonly IRazorLoggerFactory _loggerFactory = loggerFactory; + private readonly ILoggerFactory _loggerFactory = loggerFactory; public InitializeResult ServerSettings => throw new NotImplementedException(); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 970dcfd5289..87a6a39e3e1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal static class TestRazorFormattingService { public static async Task CreateWithFullSupportAsync( - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, ProjectSnapshotManagerDispatcher dispatcher, RazorCodeDocument? codeDocument = null, IDocumentSnapshot? documentSnapshot = null, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/MonitorProjectConfigurationFilePathEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/MonitorProjectConfigurationFilePathEndpointTest.cs index 5875ed79cb7..cef7985d118 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/MonitorProjectConfigurationFilePathEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/MonitorProjectConfigurationFilePathEndpointTest.cs @@ -486,7 +486,7 @@ private class TestMonitorProjectConfigurationFilePathEndpoint( ProjectSnapshotManagerDispatcher dispatcher, WorkspaceDirectoryPathResolver workspaceDirectoryPathResolver, IEnumerable listeners, - IRazorLoggerFactory loggerFactory, + ILoggerFactory loggerFactory, IProjectSnapshotManager projectManager, LanguageServerFeatureOptions? options = null) : MonitorProjectConfigurationFilePathEndpoint( projectManager, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectConfigurationFileChangeDetectorTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectConfigurationFileChangeDetectorTest.cs index 694026852e7..f5a51853e70 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectConfigurationFileChangeDetectorTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectConfigurationFileChangeDetectorTest.cs @@ -83,7 +83,7 @@ public TestProjectConfigurationFileChangeDetector( ProjectSnapshotManagerDispatcher dispatcher, IEnumerable listeners, IReadOnlyList existingConfigurationFiles, - IRazorLoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : base(dispatcher, listeners, TestLanguageServerFeatureOptions.Instance, loggerFactory) { _cancellationTokenSource = cancellationTokenSource; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Editor_NetFx/TestTelemetryReporter.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Editor_NetFx/TestTelemetryReporter.cs index de1971698b7..9abccfc5549 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Editor_NetFx/TestTelemetryReporter.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Editor_NetFx/TestTelemetryReporter.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.Editor.Razor.Test.Shared; -internal class TestTelemetryReporter(IRazorLoggerFactory loggerFactory) : VSTelemetryReporter(new Lazy(() => loggerFactory)) +internal class TestTelemetryReporter(ILoggerFactory loggerFactory) : VSTelemetryReporter(new Lazy(() => loggerFactory)) { public List Events { get; } = []; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerFactory.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerFactory.cs index 3a6128ee160..b9af1ce005d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerFactory.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerFactory.cs @@ -7,6 +7,6 @@ namespace Microsoft.AspNetCore.Razor.Test.Common.Logging; internal sealed class TestOutputLoggerFactory(ITestOutputHelper output) - : AbstractRazorLoggerFactory([new TestOutputLoggerProvider(output)]) + : AbstractLoggerFactory([new TestOutputLoggerProvider(output)]) { } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs index b0ddbf1ca0a..dbaf065d7fb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Logging/TestOutputLoggerProvider.cs @@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Common.Logging; -internal class TestOutputLoggerProvider(ITestOutputHelper output) : IRazorLoggerProvider +internal class TestOutputLoggerProvider(ITestOutputHelper output) : ILoggerProvider { private ITestOutputHelper? _output = output; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs index cc2d9815a0a..62aad490481 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ToolingTestBase.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Common; /// test thread as the main thread. /// A that signals when the test has finished running /// and xUnit disposes the test class. -/// An implementation that writes to an xUnit +/// An implementation that writes to an xUnit /// . /// An easy way to register objects that should be disposed /// when the test completes. @@ -68,10 +68,10 @@ static ToolingTestBase() protected CancellationToken DisposalToken { get; } /// - /// An that creates instances that + /// An that creates instances that /// write to xUnit's for the currently running test. /// - internal IRazorLoggerFactory LoggerFactory { get; } + internal ILoggerFactory LoggerFactory { get; } private ILogger? _logger; diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/LogIntegrationTestAttribute.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/LogIntegrationTestAttribute.cs index b5beddf9fe8..80df1dc4c4a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/LogIntegrationTestAttribute.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/LogIntegrationTestAttribute.cs @@ -23,7 +23,7 @@ public override void After(MethodInfo methodUnderTest) // private static ILogger GetLogger(string testName) // { // var componentModel = ServiceProvider.GlobalProvider.GetService(); - // var loggerFactory = componentModel.GetService(); + // var loggerFactory = componentModel.GetService(); // return loggerFactory.CreateLogger(testName); // } }