зеркало из https://github.com/dotnet/razor.git
Add OnAutoInsert delegation target
This commit is contained in:
Родитель
3dbb7adf40
Коммит
31b2fe5815
|
@ -42,5 +42,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Common
|
|||
public const string RazorSignatureHelpEndpointName = "razor/signatureHelp";
|
||||
|
||||
public const string RazorImplementationEndpointName = "razor/implementation";
|
||||
|
||||
public const string RazorOnAutoInsertnEndpointName = "razor/onAutoInsert";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,13 @@ internal record DelegatedPositionParams(
|
|||
Position ProjectedPosition,
|
||||
RazorLanguageKind ProjectedKind) : IDelegatedParams;
|
||||
|
||||
internal record DelegatedOnAutoInsertParams(
|
||||
VersionedTextDocumentIdentifier HostDocument,
|
||||
Position ProjectedPosition,
|
||||
RazorLanguageKind ProjectedKind,
|
||||
string Character,
|
||||
FormattingOptions Options) : IDelegatedParams;
|
||||
|
||||
internal record DelegatedRenameParams(
|
||||
VersionedTextDocumentIdentifier HostDocument,
|
||||
Position ProjectedPosition,
|
||||
|
|
|
@ -1083,6 +1083,34 @@ namespace Microsoft.VisualStudio.LanguageServerClient.Razor
|
|||
return response?.Response;
|
||||
}
|
||||
|
||||
public override async Task<VSInternalDocumentOnAutoInsertResponseItem?> OnAutoInsertAsync(DelegatedOnAutoInsertParams request, CancellationToken cancellationToken)
|
||||
{
|
||||
var delegationDetails = await GetProjectedRequestDetailsAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
if (delegationDetails is null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
var onAutoInsertParams = new VSInternalDocumentOnAutoInsertParams
|
||||
{
|
||||
TextDocument = new TextDocumentIdentifier()
|
||||
{
|
||||
Uri = delegationDetails.Value.ProjectedUri,
|
||||
},
|
||||
Position = request.ProjectedPosition,
|
||||
Character = request.Character,
|
||||
Options = request.Options
|
||||
};
|
||||
|
||||
var response = await _requestInvoker.ReinvokeRequestOnServerAsync<VSInternalDocumentOnAutoInsertParams, VSInternalDocumentOnAutoInsertResponseItem?>(
|
||||
delegationDetails.Value.TextBuffer,
|
||||
VSInternalMethods.OnAutoInsertName,
|
||||
delegationDetails.Value.LanguageServerName,
|
||||
onAutoInsertParams,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
return response?.Response;
|
||||
}
|
||||
|
||||
public override Task<VSInternalHover?> HoverAsync(DelegatedPositionParams request, CancellationToken cancellationToken)
|
||||
=> DelegateTextDocumentPositionRequestAsync<VSInternalHover>(request, Methods.TextDocumentHoverName, cancellationToken);
|
||||
|
||||
|
|
|
@ -114,5 +114,8 @@ namespace Microsoft.VisualStudio.LanguageServerClient.Razor
|
|||
|
||||
[JsonRpcMethod(RazorLanguageServerCustomMessageTargets.RazorImplementationEndpointName, UseSingleObjectParameterDeserialization = true)]
|
||||
public abstract Task<ImplementationResult> ImplementationAsync(DelegatedPositionParams request, CancellationToken cancellationToken);
|
||||
|
||||
[JsonRpcMethod(RazorLanguageServerCustomMessageTargets.RazorOnAutoInsertnEndpointName, UseSingleObjectParameterDeserialization = true)]
|
||||
public abstract Task<VSInternalDocumentOnAutoInsertResponseItem?> OnAutoInsertAsync(DelegatedOnAutoInsertParams request, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче