Skip to content

Commit

Permalink
Fix razor/namedPipe params to use STJ. Also rename the endpoint (#10604)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzngard authored Jul 10, 2024
1 parent 6af89f3 commit fda387e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
namespace Microsoft.AspNetCore.Razor.LanguageServer.Hosting;

[RazorLanguageServerEndpoint(CustomMessageNames.RazorNamedPipeConnectEndpointName)]
internal sealed class RazorNamedPipeConnectHandler(IRazorProjectInfoDriver infoDriver, ILoggerFactory loggerFactory) : IRazorNotificationHandler<RazorNamedPipeConnectParams>
internal sealed class RazorNamedPipeConnectEndpoint(IRazorProjectInfoDriver infoDriver, ILoggerFactory loggerFactory) : IRazorNotificationHandler<RazorNamedPipeConnectParams>
{
private readonly IRazorProjectInfoDriver _infoDriver = infoDriver;
private readonly ILogger _logger = loggerFactory.GetOrCreateLogger<RazorNamedPipeConnectHandler>();
private readonly ILogger _logger = loggerFactory.GetOrCreateLogger<RazorNamedPipeConnectEndpoint>();

public bool MutatesSolutionState => false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

using System.Runtime.Serialization;
using System.Text.Json.Serialization;

namespace Microsoft.CodeAnalysis.Razor.Protocol;

[DataContract]
internal class RazorNamedPipeConnectParams
{
[DataMember(Name = "pipeName")]
[JsonPropertyName("pipeName")]
public required string PipeName { get; set; }
}
2 changes: 1 addition & 1 deletion src/Razor/src/rzls/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static async Task Main(string[] args)
configureServices: static services =>
{
services.AddSingleton<IRazorProjectInfoDriver, NamedPipeBasedRazorProjectInfoDriver>();
services.AddHandler<RazorNamedPipeConnectHandler>();
services.AddHandler<RazorNamedPipeConnectEndpoint>();
});

// Now we have a server, and hence a connection, we have somewhere to log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private RazorLanguageServerHost CreateLanguageServerHost(Stream input, Stream ou
s.AddSingleton<IRazorProjectInfoDriver, TestProjectInfoDriver>();

// VS Code only handler is added by rzls, but add here for testing purposes
s.AddHandler<RazorNamedPipeConnectHandler>();
s.AddHandler<RazorNamedPipeConnectEndpoint>();
});
}

Expand Down

0 comments on commit fda387e

Please sign in to comment.