Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

/// <summary>
/// Parameters for the roslyn/extensionRegister request.
/// Parameters for the server/_vs_activateExtension request.
/// </summary>
/// <param name="AssemblyFilePath">Full path to the assembly that contains the message handlers to register.</param>
internal readonly record struct ExtensionRegisterParams(
internal readonly record struct ActivateExtensionParams(
[property: JsonPropertyName("assemblyFilePath")] string AssemblyFilePath);
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

/// <summary>
/// Response for the roslyn/extensionRegister request.
/// Response for the server/_vs_activateExtension request.
/// </summary>
/// <param name="WorkspaceMessageHandlers">Names of the registered non-document-specific extension message handlers.</param>
/// <param name="DocumentMessageHandlers">Names of the registered document-specific extension message handlers.</param>
/// <param name="ExtensionException">Details of any exceptions that occurred during extension registration.</param>
internal sealed record class ExtensionRegisterResponse(
internal sealed record class ActivateExtensionResponse(
[property: JsonPropertyName("workspaceMessageHandlers")] ImmutableArray<string> WorkspaceMessageHandlers,
[property: JsonPropertyName("documentMessageHandlers")] ImmutableArray<string> DocumentMessageHandlers,
[property: JsonPropertyName("extensionException"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] Exception? ExtensionException);
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

[ExportCSharpVisualBasicStatelessLspService(typeof(ExtensionUnregisterHandler)), Shared]
[ExportCSharpVisualBasicStatelessLspService(typeof(DeactivateExtensionHandler)), Shared]
[Method(MethodName)]
[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
internal sealed class ExtensionUnregisterHandler()
: AbstractExtensionHandler, ILspServiceNotificationHandler<ExtensionUnregisterParams>
internal sealed class DeactivateExtensionHandler()
: AbstractExtensionHandler, ILspServiceNotificationHandler<DeactivateExtensionParams>
{
private const string MethodName = "roslyn/extensionUnregister";
private const string MethodName = "server/_vs_deactivateExtension";

public async Task HandleNotificationAsync(ExtensionUnregisterParams request, RequestContext context, CancellationToken cancellationToken)
public async Task HandleNotificationAsync(DeactivateExtensionParams request, RequestContext context, CancellationToken cancellationToken)
{
Contract.ThrowIfNull(context.Solution);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

/// <summary>
/// Parameters for the roslyn/extensionUnregister request.
/// Parameters for the server/_vs_deactivateExtension request.
/// </summary>
/// <param name="AssemblyFilePath">Full path to the assembly that contains the message handlers to unregister.</param>
internal readonly record struct ExtensionUnregisterParams(
internal readonly record struct DeactivateExtensionParams(
[property: JsonPropertyName("assemblyFilePath")] string AssemblyFilePath);
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

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

public TextDocumentIdentifier GetTextDocumentIdentifier(ExtensionDocumentMessageParams request)
public TextDocumentIdentifier GetTextDocumentIdentifier(DispatchDocumentExtensionMessageParams request)
=> request.TextDocument;

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

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

return new ExtensionMessageResponse(response, extensionWasUnloaded, exception);
return new DispatchExtensionMessageResponse(response, extensionWasUnloaded, exception);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

/// <summary>
/// Parameters for the roslyn/extensionDocumentMessage request.
/// Parameters for the textDocument/_vs_dipatchExtensionMessage request.
/// </summary>
/// <param name="MessageName">Name of the extension message to be invoked.</param>
/// <param name="Message">Json message to be passed to an extension message handler.</param>
/// <param name="TextDocument">Text document the <paramref name="Message"/> refers to.</param>
internal readonly record struct ExtensionDocumentMessageParams(
internal readonly record struct DispatchDocumentExtensionMessageParams(
[property: JsonPropertyName("messageName")] string MessageName,
[property: JsonPropertyName("message")] string Message,
[property: JsonPropertyName("textDocument")] TextDocumentIdentifier TextDocument);
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

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

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

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

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

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

return new ExtensionMessageResponse(response, extensionWasUnloaded, exception);
return new DispatchExtensionMessageResponse(response, extensionWasUnloaded, exception);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Extensions;

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