Skip to content

Commit 6ca368c

Browse files
Rename LSP messages for VisualStudio.Extensibility integration (#78598)
Co-authored-by: Matteo Prosperi <maprospe@microsoft.com>
1 parent ae499de commit 6ca368c

10 files changed

+35
-35
lines changed

src/LanguageServer/Protocol/Handler/Extensions/ExtensionRegisterHandler.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/ActivateExtensionHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
1313

14-
[ExportCSharpVisualBasicStatelessLspService(typeof(ExtensionRegisterHandler)), Shared]
14+
[ExportCSharpVisualBasicStatelessLspService(typeof(ActivateExtensionHandler)), Shared]
1515
[Method(MethodName)]
1616
[method: ImportingConstructor]
1717
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
18-
internal sealed class ExtensionRegisterHandler()
19-
: AbstractExtensionHandler, ILspServiceRequestHandler<ExtensionRegisterParams, ExtensionRegisterResponse>
18+
internal sealed class ActivateExtensionHandler()
19+
: AbstractExtensionHandler, ILspServiceRequestHandler<ActivateExtensionParams, ActivateExtensionResponse>
2020
{
21-
private const string MethodName = "roslyn/extensionRegister";
21+
private const string MethodName = "server/_vs_activateExtension";
2222

23-
public async Task<ExtensionRegisterResponse> HandleRequestAsync(ExtensionRegisterParams request, RequestContext context, CancellationToken cancellationToken)
23+
public async Task<ActivateExtensionResponse> HandleRequestAsync(ActivateExtensionParams request, RequestContext context, CancellationToken cancellationToken)
2424
{
2525
Contract.ThrowIfNull(context.Solution);
2626

src/LanguageServer/Protocol/Handler/Extensions/ExtensionRegisterParams.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/ActivateExtensionParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
88

99
/// <summary>
10-
/// Parameters for the roslyn/extensionRegister request.
10+
/// Parameters for the server/_vs_activateExtension request.
1111
/// </summary>
1212
/// <param name="AssemblyFilePath">Full path to the assembly that contains the message handlers to register.</param>
13-
internal readonly record struct ExtensionRegisterParams(
13+
internal readonly record struct ActivateExtensionParams(
1414
[property: JsonPropertyName("assemblyFilePath")] string AssemblyFilePath);

src/LanguageServer/Protocol/Handler/Extensions/ExtensionRegisterResponse.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/ActivateExtensionResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
1010

1111
/// <summary>
12-
/// Response for the roslyn/extensionRegister request.
12+
/// Response for the server/_vs_activateExtension request.
1313
/// </summary>
1414
/// <param name="WorkspaceMessageHandlers">Names of the registered non-document-specific extension message handlers.</param>
1515
/// <param name="DocumentMessageHandlers">Names of the registered document-specific extension message handlers.</param>
1616
/// <param name="ExtensionException">Details of any exceptions that occurred during extension registration.</param>
17-
internal sealed record class ExtensionRegisterResponse(
17+
internal sealed record class ActivateExtensionResponse(
1818
[property: JsonPropertyName("workspaceMessageHandlers")] ImmutableArray<string> WorkspaceMessageHandlers,
1919
[property: JsonPropertyName("documentMessageHandlers")] ImmutableArray<string> DocumentMessageHandlers,
2020
[property: JsonPropertyName("extensionException"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] Exception? ExtensionException);

src/LanguageServer/Protocol/Handler/Extensions/ExtensionUnregisterHandler.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DeactivateExtensionHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
1313

14-
[ExportCSharpVisualBasicStatelessLspService(typeof(ExtensionUnregisterHandler)), Shared]
14+
[ExportCSharpVisualBasicStatelessLspService(typeof(DeactivateExtensionHandler)), Shared]
1515
[Method(MethodName)]
1616
[method: ImportingConstructor]
1717
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
18-
internal sealed class ExtensionUnregisterHandler()
19-
: AbstractExtensionHandler, ILspServiceNotificationHandler<ExtensionUnregisterParams>
18+
internal sealed class DeactivateExtensionHandler()
19+
: AbstractExtensionHandler, ILspServiceNotificationHandler<DeactivateExtensionParams>
2020
{
21-
private const string MethodName = "roslyn/extensionUnregister";
21+
private const string MethodName = "server/_vs_deactivateExtension";
2222

23-
public async Task HandleNotificationAsync(ExtensionUnregisterParams request, RequestContext context, CancellationToken cancellationToken)
23+
public async Task HandleNotificationAsync(DeactivateExtensionParams request, RequestContext context, CancellationToken cancellationToken)
2424
{
2525
Contract.ThrowIfNull(context.Solution);
2626

src/LanguageServer/Protocol/Handler/Extensions/ExtensionUnregisterParams.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DeactivateExtensionParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
88

99
/// <summary>
10-
/// Parameters for the roslyn/extensionUnregister request.
10+
/// Parameters for the server/_vs_deactivateExtension request.
1111
/// </summary>
1212
/// <param name="AssemblyFilePath">Full path to the assembly that contains the message handlers to unregister.</param>
13-
internal readonly record struct ExtensionUnregisterParams(
13+
internal readonly record struct DeactivateExtensionParams(
1414
[property: JsonPropertyName("assemblyFilePath")] string AssemblyFilePath);

src/LanguageServer/Protocol/Handler/Extensions/ExtensionDocumentMessageHandler.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DispatchDocumentExtensionMessageHandler.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212

1313
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
1414

15-
[ExportCSharpVisualBasicStatelessLspService(typeof(ExtensionDocumentMessageHandler)), Shared]
15+
[ExportCSharpVisualBasicStatelessLspService(typeof(DispatchDocumentExtensionMessageHandler)), Shared]
1616
[Method(MethodName)]
1717
[method: ImportingConstructor]
1818
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
19-
internal sealed class ExtensionDocumentMessageHandler()
20-
: AbstractExtensionHandler, ILspServiceDocumentRequestHandler<ExtensionDocumentMessageParams, ExtensionMessageResponse>
19+
internal sealed class DispatchDocumentExtensionMessageHandler()
20+
: AbstractExtensionHandler, ILspServiceDocumentRequestHandler<DispatchDocumentExtensionMessageParams, DispatchExtensionMessageResponse>
2121
{
22-
private const string MethodName = "roslyn/extensionDocumentMessage";
22+
private const string MethodName = "textDocument/_vs_dipatchExtensionMessage";
2323

24-
public TextDocumentIdentifier GetTextDocumentIdentifier(ExtensionDocumentMessageParams request)
24+
public TextDocumentIdentifier GetTextDocumentIdentifier(DispatchDocumentExtensionMessageParams request)
2525
=> request.TextDocument;
2626

27-
public async Task<ExtensionMessageResponse> HandleRequestAsync(ExtensionDocumentMessageParams request, RequestContext context, CancellationToken cancellationToken)
27+
public async Task<DispatchExtensionMessageResponse> HandleRequestAsync(DispatchDocumentExtensionMessageParams request, RequestContext context, CancellationToken cancellationToken)
2828
{
2929
Contract.ThrowIfNull(context.Document);
3030

@@ -38,6 +38,6 @@ public async Task<ExtensionMessageResponse> HandleRequestAsync(ExtensionDocument
3838
if (exception is not null)
3939
context.Logger.LogException(exception);
4040

41-
return new ExtensionMessageResponse(response, extensionWasUnloaded, exception);
41+
return new DispatchExtensionMessageResponse(response, extensionWasUnloaded, exception);
4242
}
4343
}

src/LanguageServer/Protocol/Handler/Extensions/ExtensionDocumentMessageParams.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DispatchDocumentExtensionMessageParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
99

1010
/// <summary>
11-
/// Parameters for the roslyn/extensionDocumentMessage request.
11+
/// Parameters for the textDocument/_vs_dipatchExtensionMessage request.
1212
/// </summary>
1313
/// <param name="MessageName">Name of the extension message to be invoked.</param>
1414
/// <param name="Message">Json message to be passed to an extension message handler.</param>
1515
/// <param name="TextDocument">Text document the <paramref name="Message"/> refers to.</param>
16-
internal readonly record struct ExtensionDocumentMessageParams(
16+
internal readonly record struct DispatchDocumentExtensionMessageParams(
1717
[property: JsonPropertyName("messageName")] string MessageName,
1818
[property: JsonPropertyName("message")] string Message,
1919
[property: JsonPropertyName("textDocument")] TextDocumentIdentifier TextDocument);

src/LanguageServer/Protocol/Handler/Extensions/ExtensionMessageResponse.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DispatchExtensionMessageResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
99

1010
/// <summary>
11-
/// Return type for the roslyn/extensionWorkspaceMessage and roslyn/extensionDocumentMessage request.
11+
/// Return type for the workspace/_vs_dispatchExtensionMessage and textDocument/_vs_dipatchExtensionMessage request.
1212
/// </summary>
1313
/// <param name="Response">Json response returned by the extension message handler. Can be <see langword="null"/> if the
1414
/// extension was unloaded concurrently with the response being issued, or if the extension threw an exception while
1515
/// processing.</param>
16-
internal readonly record struct ExtensionMessageResponse(
16+
internal readonly record struct DispatchExtensionMessageResponse(
1717
[property: JsonPropertyName("response"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] string? Response,
1818
[property: JsonPropertyName("extensionWasUnloaded"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] bool ExtensionWasUnloaded,
1919
[property: JsonPropertyName("extensionException"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] Exception? ExtensionException);

src/LanguageServer/Protocol/Handler/Extensions/ExtensionWorkspaceMessageHandler.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DispatchWorkspaceExtensionMessageHandler.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
1313

14-
[ExportCSharpVisualBasicStatelessLspService(typeof(ExtensionWorkspaceMessageHandler)), Shared]
14+
[ExportCSharpVisualBasicStatelessLspService(typeof(DispatchWorkspaceExtensionMessageHandler)), Shared]
1515
[Method(MethodName)]
1616
[method: ImportingConstructor]
1717
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
18-
internal sealed class ExtensionWorkspaceMessageHandler()
19-
: AbstractExtensionHandler, ILspServiceRequestHandler<ExtensionWorkspaceMessageParams, ExtensionMessageResponse>
18+
internal sealed class DispatchWorkspaceExtensionMessageHandler()
19+
: AbstractExtensionHandler, ILspServiceRequestHandler<DispatchWorkspaceExtensionMessageParams, DispatchExtensionMessageResponse>
2020
{
21-
private const string MethodName = "roslyn/extensionWorkspaceMessage";
21+
private const string MethodName = "workspace/_vs_dispatchExtensionMessage";
2222

23-
public async Task<ExtensionMessageResponse> HandleRequestAsync(ExtensionWorkspaceMessageParams request, RequestContext context, CancellationToken cancellationToken)
23+
public async Task<DispatchExtensionMessageResponse> HandleRequestAsync(DispatchWorkspaceExtensionMessageParams request, RequestContext context, CancellationToken cancellationToken)
2424
{
2525
Contract.ThrowIfNull(context.Solution);
2626

@@ -34,6 +34,6 @@ public async Task<ExtensionMessageResponse> HandleRequestAsync(ExtensionWorkspac
3434
if (exception is not null)
3535
context.Logger.LogException(exception);
3636

37-
return new ExtensionMessageResponse(response, extensionWasUnloaded, exception);
37+
return new DispatchExtensionMessageResponse(response, extensionWasUnloaded, exception);
3838
}
3939
}

src/LanguageServer/Protocol/Handler/Extensions/ExtensionWorkspaceMessageParams.cs renamed to src/LanguageServer/Protocol/Handler/Extensions/DispatchWorkspaceExtensionMessageParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;
99

1010
/// <summary>
11-
/// Parameters for the roslyn/extensionWorkspaceMessage request.
11+
/// Parameters for the workspace/_vs_dispatchExtensionMessage request.
1212
/// </summary>
1313
/// <param name="MessageName">Name of the extension message to be invoked.</param>
1414
/// <param name="Message">Json message to be passed to an extension message handler.</param>
15-
internal readonly record struct ExtensionWorkspaceMessageParams(
15+
internal readonly record struct DispatchWorkspaceExtensionMessageParams(
1616
[property: JsonPropertyName("messageName")] string MessageName,
1717
[property: JsonPropertyName("message")] string Message);

0 commit comments

Comments
 (0)