Bump Roslyn and respond to System.Text.Json changes

This commit is contained in:
David Wengier 2024-05-21 12:27:59 +10:00
Родитель 22b448c24d
Коммит 91c28ff39c
5 изменённых файлов: 91 добавлений и 80 удалений

Просмотреть файл

@ -6,9 +6,9 @@
-->
<PropertyGroup>
<_MicrosoftWebToolsPackageVersion>17.9.67-preview-0001</_MicrosoftWebToolsPackageVersion>
<_MicrosoftVisualStudioShellPackagesVersion>17.9.36524</_MicrosoftVisualStudioShellPackagesVersion>
<_MicrosoftVisualStudioPackagesVersion>17.10.72-preview</_MicrosoftVisualStudioPackagesVersion>
<_VisualStudioLanguageServerProtocolVersion>17.10.13-preview</_VisualStudioLanguageServerProtocolVersion>
<_MicrosoftVisualStudioShellPackagesVersion>17.10.39563</_MicrosoftVisualStudioShellPackagesVersion>
<_MicrosoftVisualStudioPackagesVersion>17.10.151</_MicrosoftVisualStudioPackagesVersion>
<_VisualStudioLanguageServerProtocolVersion>17.11.1-preview</_VisualStudioLanguageServerProtocolVersion>
<_MicrosoftExtensionsPackageVersion>8.0.0</_MicrosoftExtensionsPackageVersion>
<_BenchmarkDotNetPackageVersion>0.13.5.2136</_BenchmarkDotNetPackageVersion>
<_MicrosoftVisualStudioExtensibilityTestingVersion>0.1.169-beta</_MicrosoftVisualStudioExtensibilityTestingVersion>
@ -67,7 +67,7 @@
<PackageVersion Include="Microsoft.Internal.VisualStudio.Interop" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />
<PackageVersion Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Copilot" Version="0.2.28-beta" />
<PackageVersion Include="Microsoft.VisualStudio.ComponentModelHost" Version="17.10.9-preview" />
<PackageVersion Include="Microsoft.VisualStudio.ComponentModelHost" Version="17.10.151" />
<PackageVersion Include="Microsoft.VisualStudio.Editor" Version="$(_MicrosoftVisualStudioPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Extensibility.Testing.Xunit" Version="$(_MicrosoftVisualStudioExtensibilityTestingVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Extensibility.Testing.SourceGenerator" Version="$(_MicrosoftVisualStudioExtensibilityTestingVersion)" />
@ -79,7 +79,7 @@
a mismatch in published versions (17.10.13-preview was not published). Next time this is updated please switch back to
_VisualStudioLanguageServerProtocolVersion if possible
-->
<PackageVersion Include="Microsoft.VisualStudio.LanguageServer.Client.Implementation" Version="17.10.16-preview" />
<PackageVersion Include="Microsoft.VisualStudio.LanguageServer.Client.Implementation" Version="17.11.1-preview" />
<PackageVersion Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(_VisualStudioLanguageServerProtocolVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" Version="$(_VisualStudioLanguageServerProtocolVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" Version="$(_VisualStudioLanguageServerProtocolVersion)" />
@ -88,14 +88,14 @@
<PackageVersion Include="Microsoft.VisualStudio.LanguageServices.Implementation.Symbols" Version="$(_MicrosoftVisualStudioLanguageServicesPackageVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.LiveShare" Version="0.3.1074" />
<PackageVersion Include="Microsoft.VisualStudio.ProjectSystem.SDK" Version="17.7.294-pre" />
<PackageVersion Include="Microsoft.VisualStudio.RpcContracts" Version="17.10.3-preview" />
<PackageVersion Include="Microsoft.VisualStudio.RpcContracts" Version="17.10.21" />
<PackageVersion Include="Microsoft.VisualStudio.Shell.Framework" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Shell.15.0" Version="$(_MicrosoftVisualStudioShellPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Telemetry" Version="17.9.102" />
<PackageVersion Include="Microsoft.VisualStudio.Text.Data" Version="$(_MicrosoftVisualStudioPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Text.Implementation" Version="$(_MicrosoftVisualStudioPackagesVersion)" NoWarn="NU1701" />
<PackageVersion Include="Microsoft.VisualStudio.Text.Logic" Version="$(_MicrosoftVisualStudioPackagesVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.10.12-preview" />
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.10.41" />
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
<PackageVersion Include="Microsoft.VisualStudio.Web" Version="16.10.0-preview-1-31008-014" />
<PackageVersion Include="Microsoft.WebTools.Languages.Html" Version="$(_MicrosoftWebToolsPackageVersion)" />

Просмотреть файл

@ -11,82 +11,82 @@
<Sha>a4c02499bef24d0e16255657ccdb160d26c82c32</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CommonLanguageServerProtocol.Framework" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CommonLanguageServerProtocol.Framework" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.EditorFeatures" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.EditorFeatures" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Common" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Common" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Remote.ServiceHub" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.Remote.ServiceHub" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Test.Utilities" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.CodeAnalysis.Test.Utilities" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.11.0-2.24260.2">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.11.0-2.24269.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>324e078a9b47b62cd6dec6c78c6308c4540aa1e5</Sha>
<Sha>dd1d6535773f71c1f921589cf59d1d62f6e8c27f</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
</ProductDependencies>

Просмотреть файл

@ -53,25 +53,25 @@
<MicrosoftSourceBuildIntermediatearcadePackageVersion>8.0.0-beta.24225.1</MicrosoftSourceBuildIntermediatearcadePackageVersion>
<MicrosoftDotNetXliffTasksPackageVersion>1.0.0-beta.23475.1</MicrosoftDotNetXliffTasksPackageVersion>
<MicrosoftSourceBuildIntermediatexlifftasksPackageVersion>1.0.0-beta.23475.1</MicrosoftSourceBuildIntermediatexlifftasksPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>4.11.0-2.24260.2</MicrosoftNetCompilersToolsetPackageVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.11.0-2.24260.2</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>
<MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>
<MicrosoftCodeAnalysisTestUtilitiesPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisTestUtilitiesPackageVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.11.0-2.24260.2</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftSourceBuildIntermediateroslynPackageVersion>4.11.0-2.24260.2</MicrosoftSourceBuildIntermediateroslynPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>4.11.0-2.24260.2</MicrosoftVisualStudioLanguageServicesPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>4.11.0-2.24269.3</MicrosoftNetCompilersToolsetPackageVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.11.0-2.24269.3</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>
<MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>
<MicrosoftCodeAnalysisTestUtilitiesPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisTestUtilitiesPackageVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.11.0-2.24269.3</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftSourceBuildIntermediateroslynPackageVersion>4.11.0-2.24269.3</MicrosoftSourceBuildIntermediateroslynPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>4.11.0-2.24269.3</MicrosoftVisualStudioLanguageServicesPackageVersion>
<!--
Exception - Microsoft.Extensions.ObjectPool and System.Collections.Immutable packages are not updated by automation,
but are present in Version.Details.xml for source-build PVP flow. See the comment in Version.Details.xml for more information.

Просмотреть файл

@ -35,7 +35,7 @@ using StreamJsonRpc;
namespace Microsoft.AspNetCore.Razor.LanguageServer;
internal partial class RazorLanguageServer : AbstractLanguageServer<RazorRequestContext>
internal partial class RazorLanguageServer : NewtonsoftLanguageServer<RazorRequestContext>
{
private readonly JsonRpc _jsonRpc;
private readonly ILoggerFactory _loggerFactory;

Просмотреть файл

@ -2,8 +2,10 @@
// 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 System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.PooledObjects;
@ -12,7 +14,6 @@ using Microsoft.CodeAnalysis.ExternalAccess.Razor;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Nerdbank.Streams;
using Newtonsoft.Json;
using StreamJsonRpc;
using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range;
@ -27,8 +28,7 @@ public sealed class CSharpTestLspServer : IAsyncDisposable
private readonly JsonRpc _serverRpc;
private readonly JsonMessageFormatter _clientMessageFormatter;
private readonly JsonMessageFormatter _serverMessageFormatter;
private readonly SystemTextJsonFormatter _serverMessageFormatter;
private readonly HeaderDelimitedMessageHandler _clientMessageHandler;
private readonly HeaderDelimitedMessageHandler _serverMessageHandler;
@ -47,14 +47,14 @@ public sealed class CSharpTestLspServer : IAsyncDisposable
var languageServerFactory = exportProvider.GetExportedValue<AbstractRazorLanguageServerFactoryWrapper>();
_serverMessageFormatter = CreateJsonMessageFormatter(languageServerFactory);
_serverMessageFormatter = CreateSystemTextJsonMessageFormatter(languageServerFactory);
_serverMessageHandler = new HeaderDelimitedMessageHandler(serverStream, serverStream, _serverMessageFormatter);
_serverRpc = new JsonRpc(_serverMessageHandler)
{
ExceptionStrategy = ExceptionProcessing.ISerializable,
};
_clientMessageFormatter = CreateJsonMessageFormatter(languageServerFactory);
_clientMessageFormatter = CreateNewtonsoftMessageFormatter();
_clientMessageHandler = new HeaderDelimitedMessageHandler(clientStream, clientStream, _clientMessageFormatter);
_clientRpc = new JsonRpc(_clientMessageHandler)
{
@ -67,34 +67,44 @@ public sealed class CSharpTestLspServer : IAsyncDisposable
_clientRpc.StartListening();
_languageServer = CreateLanguageServer(_serverRpc, _serverMessageFormatter.JsonSerializer, testWorkspace, languageServerFactory, exportProvider, serverCapabilities);
_languageServer = CreateLanguageServer(_serverRpc, _serverMessageFormatter.JsonSerializerOptions, testWorkspace, languageServerFactory, exportProvider, serverCapabilities);
static JsonMessageFormatter CreateJsonMessageFormatter(AbstractRazorLanguageServerFactoryWrapper languageServerFactory)
static SystemTextJsonFormatter CreateSystemTextJsonMessageFormatter(AbstractRazorLanguageServerFactoryWrapper languageServerFactory)
{
var messageFormatter = new SystemTextJsonFormatter();
// Roslyn has its own converters since it doesn't use MS.VS.LS.Protocol
languageServerFactory.AddJsonConverters(messageFormatter.JsonSerializerOptions);
// In its infinite wisdom, the LSP client has a public method that takes Newtonsoft.Json types, but an internal method that takes System.Text.Json types.
typeof(VSInternalExtensionUtilities).GetMethod("AddVSInternalExtensionConverters", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)!.Invoke(null, [messageFormatter.JsonSerializerOptions]);
return messageFormatter;
}
static JsonMessageFormatter CreateNewtonsoftMessageFormatter()
{
var messageFormatter = new JsonMessageFormatter();
VSInternalExtensionUtilities.AddVSInternalExtensionConverters(messageFormatter.JsonSerializer);
// Roslyn has its own converters since it doesn't use MS.VS.LS.Protocol
languageServerFactory.AddJsonConverters(messageFormatter.JsonSerializer);
return messageFormatter;
}
static IRazorLanguageServerTarget CreateLanguageServer(
JsonRpc serverRpc,
JsonSerializer jsonSerializer,
JsonSerializerOptions options,
Workspace workspace,
AbstractRazorLanguageServerFactoryWrapper languageServerFactory,
ExportProvider exportProvider,
VSInternalServerCapabilities serverCapabilities)
{
var capabilitiesProvider = new RazorTestCapabilitiesProvider(serverCapabilities);
var capabilitiesProvider = new RazorTestCapabilitiesProvider(serverCapabilities, options);
var registrationService = exportProvider.GetExportedValue<RazorTestWorkspaceRegistrationService>();
registrationService.Register(workspace);
var hostServices = workspace.Services.HostServices;
var languageServer = languageServerFactory.CreateLanguageServer(serverRpc, jsonSerializer, capabilitiesProvider, hostServices);
var languageServer = languageServerFactory.CreateLanguageServer(serverRpc, options, capabilitiesProvider, hostServices);
serverRpc.StartListening();
return languageServer;
@ -201,15 +211,16 @@ public sealed class CSharpTestLspServer : IAsyncDisposable
#endregion
private class RazorTestCapabilitiesProvider(VSInternalServerCapabilities serverCapabilities) : IRazorTestCapabilitiesProvider
private class RazorTestCapabilitiesProvider(VSInternalServerCapabilities serverCapabilities, JsonSerializerOptions options) : IRazorTestCapabilitiesProvider
{
private readonly VSInternalServerCapabilities _serverCapabilities = serverCapabilities;
private readonly JsonSerializerOptions _options = options;
public string GetServerCapabilitiesJson(string clientCapabilitiesJson)
{
// To avoid exposing types from VS.LSP.Protocol across the Razor <-> Roslyn API boundary, and therefore
// requiring us to agree on dependency versions, we use JSON as a transport mechanism.
return JsonConvert.SerializeObject(_serverCapabilities);
return JsonSerializer.Serialize(_serverCapabilities, _options);
}
}