diff --git a/eng/targets/Services.props b/eng/targets/Services.props
index 9990daed115..068c5f2e0ab 100644
--- a/eng/targets/Services.props
+++ b/eng/targets/Services.props
@@ -22,5 +22,6 @@
+
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs
index 62785fb5267..83b32a3dd23 100644
--- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs
@@ -40,6 +40,19 @@ public static SemanticTokensOptions EnableSemanticTokens(this SemanticTokensOpti
return options;
}
+ public static void EnableSignatureHelp(this VSInternalServerCapabilities serverCapabilities)
+ {
+ serverCapabilities.SignatureHelpProvider = new SignatureHelpOptions().EnableSignatureHelp();
+ }
+
+ public static SignatureHelpOptions EnableSignatureHelp(this SignatureHelpOptions options)
+ {
+ options.TriggerCharacters = ["(", ",", "<"];
+ options.RetriggerCharacters = [">", ")"];
+
+ return options;
+ }
+
public static void EnableHoverProvider(this VSInternalServerCapabilities serverCapabilities)
{
serverCapabilities.HoverProvider = new HoverOptions()
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs
index 17c412bd72b..d28cb50e47c 100644
--- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs
@@ -178,7 +178,6 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption
services.AddTransient(sp => sp.GetRequiredService());
services.AddHandlerWithCapabilities();
- services.AddHandlerWithCapabilities();
services.AddHandlerWithCapabilities();
services.AddHandlerWithCapabilities();
@@ -187,6 +186,7 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption
if (!featureOptions.UseRazorCohostServer)
{
+ services.AddHandlerWithCapabilities();
services.AddHandlerWithCapabilities();
services.AddHandlerWithCapabilities();
}
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 baa5d4b0000..790cd537f07 100644
--- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SignatureHelp/SignatureHelpEndpoint.cs
@@ -11,10 +11,11 @@
using Microsoft.CodeAnalysis.Razor.Protocol;
using Microsoft.CodeAnalysis.Razor.Workspaces;
using Microsoft.VisualStudio.LanguageServer.Protocol;
-using LS = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.AspNetCore.Razor.LanguageServer.SignatureHelp;
+using SignatureHelp = VisualStudio.LanguageServer.Protocol.SignatureHelp;
+
[RazorLanguageServerEndpoint(Methods.TextDocumentSignatureHelpName)]
internal sealed class SignatureHelpEndpoint(
LanguageServerFeatureOptions languageServerFeatureOptions,
@@ -22,7 +23,7 @@ internal sealed class SignatureHelpEndpoint(
IClientConnection clientConnection,
RazorLSPOptionsMonitor optionsMonitor,
ILoggerFactory loggerProvider)
- : AbstractRazorDelegatingEndpoint(
+ : AbstractRazorDelegatingEndpoint(
languageServerFeatureOptions,
documentMappingService,
clientConnection,
@@ -33,11 +34,7 @@ internal sealed class SignatureHelpEndpoint(
public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities)
{
- serverCapabilities.SignatureHelpProvider = new SignatureHelpOptions()
- {
- TriggerCharacters = new[] { "(", ",", "<" },
- RetriggerCharacters = new[] { ">", ")" }
- };
+ serverCapabilities.EnableSignatureHelp();
}
protected override Task CreateDelegatedParamsAsync(SignatureHelpParams request, RazorRequestContext requestContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken)
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteJsonService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteJsonService.cs
new file mode 100644
index 00000000000..4e193d31649
--- /dev/null
+++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteJsonService.cs
@@ -0,0 +1,11 @@
+// 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.Remote;
+
+///
+/// Marker interface to indicate that an OOP service should use Json for communication
+///
+internal interface IRemoteJsonService
+{
+}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSignatureHelpService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSignatureHelpService.cs
new file mode 100644
index 00000000000..82163933eef
--- /dev/null
+++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSignatureHelpService.cs
@@ -0,0 +1,16 @@
+// 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.CodeAnalysis.ExternalAccess.Razor;
+using Roslyn.LanguageServer.Protocol;
+
+namespace Microsoft.CodeAnalysis.Razor.Remote;
+
+using SignatureHelp = Roslyn.LanguageServer.Protocol.SignatureHelp;
+
+internal interface IRemoteSignatureHelpService : IRemoteJsonService
+{
+ ValueTask GetSignatureHelpAsync(JsonSerializableRazorPinnedSolutionInfoWrapper solutionInfo, JsonSerializableDocumentId documentId, Position linePosition, CancellationToken cancellationToken);
+}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs
index a33f9dd3fa9..5b79b2b5005 100644
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs
+++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs
@@ -25,4 +25,13 @@ internal static class RazorServices
(typeof(IRemoteUriPresentationService), null),
(typeof(IRemoteFoldingRangeService), null)
]);
+
+ public static readonly RazorServiceDescriptorsWrapper JsonDescriptors = new(
+ ComponentName, // Needs to match the above because so much of our ServiceHub infrastructure is convention based
+ featureDisplayNameProvider: feature => $"Razor {feature} Feature",
+ jsonConverters: RazorServiceDescriptorsWrapper.GetLspConverters(),
+ interfaces:
+ [
+ (typeof(IRemoteSignatureHelpService), null),
+ ]);
}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorBrokeredServiceBase.FactoryBase`1.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorBrokeredServiceBase.FactoryBase`1.cs
index f3c1b31d6db..f9cd31f160e 100644
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorBrokeredServiceBase.FactoryBase`1.cs
+++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorBrokeredServiceBase.FactoryBase`1.cs
@@ -62,7 +62,9 @@ public async Task