Revision control
Copy as Markdown
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant
// this file was generated by the generate.ts script
#include <QtLanguageServer/private/qlanguageservergen_p_p.h>
#include <QtCore/QScopeGuard>
QT_BEGIN_NAMESPACE
namespace QLspSpecification {
QByteArray ProtocolBase::requestMethodToBaseCppName(const QByteArray &method)
{
static QHash<QByteArray, QByteArray> map(
{ { QByteArray("callHierarchy/incomingCalls"),
QByteArray("CallHierarchyIncomingCalls") },
{ QByteArray("callHierarchy/outgoingCalls"),
QByteArray("CallHierarchyOutgoingCalls") },
{ QByteArray("client/registerCapability"), QByteArray("Registration") },
{ QByteArray("client/unregisterCapability"), QByteArray("Unregistration") },
{ QByteArray("codeAction/resolve"), QByteArray("CodeActionResolve") },
{ QByteArray("codeLens/resolve"), QByteArray("CodeLensResolve") },
{ QByteArray("completionItem/resolve"), QByteArray("CompletionItemResolve") },
{ QByteArray("documentLink/resolve"), QByteArray("DocumentLinkResolve") },
{ QByteArray("initialize"), QByteArray("Initialize") },
{ QByteArray("inlayHint/resolve"), QByteArray("InlayHintResolve") },
{ QByteArray("shutdown"), QByteArray("Shutdown") },
{ QByteArray("textDocument/codeAction"), QByteArray("CodeAction") },
{ QByteArray("textDocument/codeLens"), QByteArray("CodeLens") },
{ QByteArray("textDocument/colorPresentation"), QByteArray("ColorPresentation") },
{ QByteArray("textDocument/completion"), QByteArray("Completion") },
{ QByteArray("textDocument/declaration"), QByteArray("Declaration") },
{ QByteArray("textDocument/definition"), QByteArray("Definition") },
{ QByteArray("textDocument/diagnostic"), QByteArray("DocumentDiagnostic") },
{ QByteArray("textDocument/documentColor"), QByteArray("DocumentColor") },
{ QByteArray("textDocument/documentHighlight"), QByteArray("DocumentHighlight") },
{ QByteArray("textDocument/documentLink"), QByteArray("DocumentLink") },
{ QByteArray("textDocument/documentSymbol"), QByteArray("DocumentSymbol") },
{ QByteArray("textDocument/foldingRange"), QByteArray("FoldingRange") },
{ QByteArray("textDocument/formatting"), QByteArray("DocumentFormatting") },
{ QByteArray("textDocument/hover"), QByteArray("Hover") },
{ QByteArray("textDocument/implementation"), QByteArray("Implementation") },
{ QByteArray("textDocument/inlayHint"), QByteArray("InlayHint") },
{ QByteArray("textDocument/inlineCompletion"), QByteArray("InlineCompletion") },
{ QByteArray("textDocument/inlineValue"), QByteArray("InlineValue") },
{ QByteArray("textDocument/linkedEditingRange"), QByteArray("LinkedEditingRange") },
{ QByteArray("textDocument/moniker"), QByteArray("Moniker") },
{ QByteArray("textDocument/onTypeFormatting"),
QByteArray("DocumentOnTypeFormatting") },
{ QByteArray("textDocument/prepareCallHierarchy"),
QByteArray("CallHierarchyPrepare") },
{ QByteArray("textDocument/prepareRename"), QByteArray("PrepareRename") },
{ QByteArray("textDocument/prepareTypeHierarchy"),
QByteArray("TypeHierarchyPrepare") },
{ QByteArray("textDocument/rangeFormatting"), QByteArray("DocumentRangeFormatting") },
{ QByteArray("textDocument/rangesFormatting"),
QByteArray("DocumentRangesFormatting") },
{ QByteArray("textDocument/references"), QByteArray("Reference") },
{ QByteArray("textDocument/rename"), QByteArray("Rename") },
{ QByteArray("textDocument/selectionRange"), QByteArray("SelectionRange") },
{ QByteArray("textDocument/semanticTokens/full"), QByteArray("SemanticTokens") },
{ QByteArray("textDocument/semanticTokens/full/delta"),
QByteArray("SemanticTokensDelta") },
{ QByteArray("textDocument/semanticTokens/range"),
QByteArray("SemanticTokensRange") },
{ QByteArray("textDocument/signatureHelp"), QByteArray("SignatureHelp") },
{ QByteArray("textDocument/typeDefinition"), QByteArray("TypeDefinition") },
{ QByteArray("textDocument/willSaveWaitUntil"), QByteArray("WillSaveTextDocument") },
{ QByteArray("typeHierarchy/subtypes"), QByteArray("TypeHierarchySubtypes") },
{ QByteArray("typeHierarchy/supertypes"), QByteArray("TypeHierarchySupertypes") },
{ QByteArray("window/showDocument"), QByteArray("ShowDocument") },
{ QByteArray("window/showMessageRequest"), QByteArray("ShowMessageRequest") },
{ QByteArray("window/workDoneProgress/create"),
QByteArray("WorkDoneProgressCreate") },
{ QByteArray("workspace/applyEdit"), QByteArray("ApplyWorkspaceEdit") },
{ QByteArray("workspace/codeLens/refresh"), QByteArray("WorkspaceCodeLensRefresh") },
{ QByteArray("workspace/configuration"), QByteArray("Configuration") },
{ QByteArray("workspace/diagnostic"), QByteArray("WorkspaceDiagnostic") },
{ QByteArray("workspace/diagnostic/refresh"),
QByteArray("WorkspaceDiagnosticRefresh") },
{ QByteArray("workspace/executeCommand"), QByteArray("ExecuteCommand") },
{ QByteArray("workspace/foldingRange/refresh"),
QByteArray("WorkspaceFoldingRangeRefresh") },
{ QByteArray("workspace/inlayHint/refresh"),
QByteArray("WorkspaceInlayHintRefresh") },
{ QByteArray("workspace/inlineValue/refresh"),
QByteArray("WorkspaceInlineValueRefresh") },
{ QByteArray("workspace/semanticTokens/refresh"),
QByteArray("WorkspaceSemanticTokensRefresh") },
{ QByteArray("workspace/symbol"), QByteArray("WorkspaceSymbol") },
{ QByteArray("workspace/textDocumentContent"), QByteArray("TextDocumentContent") },
{ QByteArray("workspace/textDocumentContent/refresh"),
QByteArray("TextDocumentContentRefresh") },
{ QByteArray("workspace/willCreateFiles"), QByteArray("CreateFiles") },
{ QByteArray("workspace/willDeleteFiles"), QByteArray("DeleteFiles") },
{ QByteArray("workspace/willRenameFiles"), QByteArray("RenameFiles") },
{ QByteArray("workspace/workspaceFolders"), QByteArray("WorkspaceWorkspaceFolders") },
{ QByteArray("workspaceSymbol/resolve"), QByteArray("WorkspaceSymbolResolve") } });
return map.value(method);
}
QByteArray ProtocolBase::notificationMethodToBaseCppName(const QByteArray &method)
{
static QHash<QByteArray, QByteArray> map(
{ { QByteArray("$/cancelRequest"), QByteArray("Cancel") },
{ QByteArray("$/logTrace"), QByteArray("LogTrace") },
{ QByteArray("$/progress"), QByteArray("Progress") },
{ QByteArray("$/setTrace"), QByteArray("SetTrace") },
{ QByteArray("exit"), QByteArray("Exit") },
{ QByteArray("initialized"), QByteArray("Initialized") },
{ QByteArray("notebookDocument/didChange"), QByteArray("DidChangeNotebookDocument") },
{ QByteArray("notebookDocument/didClose"), QByteArray("DidCloseNotebookDocument") },
{ QByteArray("notebookDocument/didOpen"), QByteArray("DidOpenNotebookDocument") },
{ QByteArray("notebookDocument/didSave"), QByteArray("DidSaveNotebookDocument") },
{ QByteArray("telemetry/event"), QByteArray("TelemetryEvent") },
{ QByteArray("textDocument/didChange"), QByteArray("DidChangeTextDocument") },
{ QByteArray("textDocument/didClose"), QByteArray("DidCloseTextDocument") },
{ QByteArray("textDocument/didOpen"), QByteArray("DidOpenTextDocument") },
{ QByteArray("textDocument/didSave"), QByteArray("DidSaveTextDocument") },
{ QByteArray("textDocument/publishDiagnostics"), QByteArray("PublishDiagnostics") },
{ QByteArray("textDocument/willSave"), QByteArray("WillSaveTextDocument") },
{ QByteArray("window/logMessage"), QByteArray("LogMessage") },
{ QByteArray("window/showMessage"), QByteArray("ShowMessage") },
{ QByteArray("window/workDoneProgress/cancel"),
QByteArray("WorkDoneProgressCancel") },
{ QByteArray("workspace/didChangeConfiguration"),
QByteArray("DidChangeConfiguration") },
{ QByteArray("workspace/didChangeWatchedFiles"),
QByteArray("DidChangeWatchedFiles") },
{ QByteArray("workspace/didChangeWorkspaceFolders"),
QByteArray("DidChangeWorkspaceFolders") },
{ QByteArray("workspace/didCreateFiles"), QByteArray("CreateFiles") },
{ QByteArray("workspace/didDeleteFiles"), QByteArray("DeleteFiles") },
{ QByteArray("workspace/didRenameFiles"), QByteArray("RenameFiles") } });
return map.value(method);
}
ProtocolGen::ProtocolGen(std::unique_ptr<ProtocolGenPrivate> &&p) : ProtocolBase(std::move(p)) { }
ProtocolGen::~ProtocolGen() { }
// Requests
void ProtocolGen::requestCallHierarchyIncomingCalls(
const CallHierarchyIncomingCallsParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<CallHierarchyIncomingCall>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CallHierarchyIncomingCallsMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<CallHierarchyIncomingCall>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCallHierarchyIncomingCallsRequestHandler(
const std::function<void(
const QByteArray &, const CallHierarchyIncomingCallsParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<CallHierarchyIncomingCall>>,
QList<CallHierarchyIncomingCall>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::CallHierarchyIncomingCallsParamsType,
QLspSpecification::Responses::CallHierarchyIncomingCallsResponseType>(
QByteArray(QLspSpecification::Requests::CallHierarchyIncomingCallsMethod),
handler);
}
void ProtocolGen::requestCallHierarchyOutgoingCalls(
const CallHierarchyOutgoingCallsParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<CallHierarchyOutgoingCall>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CallHierarchyOutgoingCallsMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<CallHierarchyOutgoingCall>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCallHierarchyOutgoingCallsRequestHandler(
const std::function<void(
const QByteArray &, const CallHierarchyOutgoingCallsParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<CallHierarchyOutgoingCall>>,
QList<CallHierarchyOutgoingCall>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::CallHierarchyOutgoingCallsParamsType,
QLspSpecification::Responses::CallHierarchyOutgoingCallsResponseType>(
QByteArray(QLspSpecification::Requests::CallHierarchyOutgoingCallsMethod),
handler);
}
void ProtocolGen::requestRegistration(const RegistrationParams ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::RegistrationMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerRegistrationRequestHandler(
const std::function<void(const QByteArray &, const RegistrationParams &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::RegistrationParamsType,
QLspSpecification::Responses::RegistrationResponseType>(
QByteArray(QLspSpecification::Requests::RegistrationMethod), handler);
}
void ProtocolGen::requestUnregistration(const UnregistrationParams ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::UnregistrationMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerUnregistrationRequestHandler(
const std::function<void(const QByteArray &, const UnregistrationParams &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::UnregistrationParamsType,
QLspSpecification::Responses::UnregistrationResponseType>(
QByteArray(QLspSpecification::Requests::UnregistrationMethod), handler);
}
void ProtocolGen::requestCodeActionResolve(const CodeAction ¶ms,
std::function<void(const CodeAction &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CodeActionResolveMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<CodeAction>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCodeActionResolveRequestHandler(
const std::function<void(const QByteArray &, const CodeAction &,
LSPResponse<CodeAction> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::CodeActionResolveParamsType,
QLspSpecification::Responses::CodeActionResolveResponseType>(
QByteArray(QLspSpecification::Requests::CodeActionResolveMethod), handler);
}
void ProtocolGen::requestCodeLensResolve(const CodeLens ¶ms,
std::function<void(const CodeLens &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CodeLensResolveMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<CodeLens>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCodeLensResolveRequestHandler(
const std::function<void(const QByteArray &, const CodeLens &, LSPResponse<CodeLens> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::CodeLensResolveParamsType,
QLspSpecification::Responses::CodeLensResolveResponseType>(
QByteArray(QLspSpecification::Requests::CodeLensResolveMethod), handler);
}
void ProtocolGen::requestCompletionItemResolve(
const CompletionItem ¶ms, std::function<void(const CompletionItem &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CompletionItemResolveMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<CompletionItem>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCompletionItemResolveRequestHandler(
const std::function<void(const QByteArray &, const CompletionItem &,
LSPResponse<CompletionItem> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::CompletionItemResolveParamsType,
QLspSpecification::Responses::CompletionItemResolveResponseType>(
QByteArray(QLspSpecification::Requests::CompletionItemResolveMethod), handler);
}
void ProtocolGen::requestDocumentLinkResolve(
const DocumentLink ¶ms, std::function<void(const DocumentLink &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentLinkResolveMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<DocumentLink>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentLinkResolveRequestHandler(
const std::function<void(const QByteArray &, const DocumentLink &,
LSPResponse<DocumentLink> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentLinkResolveParamsType,
QLspSpecification::Responses::DocumentLinkResolveResponseType>(
QByteArray(QLspSpecification::Requests::DocumentLinkResolveMethod), handler);
}
void ProtocolGen::requestInitialize(const InitializeParams ¶ms,
std::function<void(const InitializeResult &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::InitializeMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<InitializeResult>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerInitializeRequestHandler(
const std::function<void(const QByteArray &, const InitializeParams &,
LSPResponse<InitializeResult> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::InitializeParamsType,
QLspSpecification::Responses::InitializeResponseType>(
QByteArray(QLspSpecification::Requests::InitializeMethod), handler);
}
void ProtocolGen::requestInlayHintResolve(const InlayHint ¶ms,
std::function<void(const InlayHint &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::InlayHintResolveMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<InlayHint>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerInlayHintResolveRequestHandler(
const std::function<void(const QByteArray &, const InlayHint &, LSPResponse<InlayHint> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::InlayHintResolveParamsType,
QLspSpecification::Responses::InlayHintResolveResponseType>(
QByteArray(QLspSpecification::Requests::InlayHintResolveMethod), handler);
}
void ProtocolGen::requestShutdown(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ShutdownMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerShutdownRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ShutdownParamsType,
QLspSpecification::Responses::ShutdownResponseType>(
QByteArray(QLspSpecification::Requests::ShutdownMethod), handler);
}
void ProtocolGen::requestCodeAction(
const CodeActionParams ¶ms,
std::function<void(
const std::variant<std::nullptr_t, QList<std::variant<Command, CodeAction>>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CodeActionMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<
std::variant<std::nullptr_t, QList<std::variant<Command, CodeAction>>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCodeActionRequestHandler(
const std::function<
void(const QByteArray &, const CodeActionParams &,
LSPPartialResponse<
std::variant<std::nullptr_t, QList<std::variant<Command, CodeAction>>>,
QList<std::variant<Command, CodeAction>>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::CodeActionParamsType,
QLspSpecification::Responses::CodeActionResponseType>(
QByteArray(QLspSpecification::Requests::CodeActionMethod), handler);
}
void ProtocolGen::requestCodeLens(
const CodeLensParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<CodeLens>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CodeLensMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<CodeLens>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCodeLensRequestHandler(
const std::function<void(const QByteArray &, const CodeLensParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<CodeLens>>,
QList<CodeLens>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::CodeLensParamsType,
QLspSpecification::Responses::CodeLensResponseType>(
QByteArray(QLspSpecification::Requests::CodeLensMethod), handler);
}
void ProtocolGen::requestColorPresentation(
const ColorPresentationParams ¶ms,
std::function<void(const QList<ColorPresentation> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ColorPresentationMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<QList<ColorPresentation>>(response.data, responseHandler,
errorHandler);
},
params);
}
void ProtocolGen::registerColorPresentationRequestHandler(
const std::function<void(const QByteArray &, const ColorPresentationParams &,
LSPPartialResponse<QList<ColorPresentation>,
QList<ColorPresentation>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ColorPresentationParamsType,
QLspSpecification::Responses::ColorPresentationResponseType>(
QByteArray(QLspSpecification::Requests::ColorPresentationMethod), handler);
}
void ProtocolGen::requestCompletion(
const CompletionParams ¶ms,
std::function<
void(const std::variant<std::nullptr_t, QList<CompletionItem>, CompletionList> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CompletionMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<
std::variant<std::nullptr_t, QList<CompletionItem>, CompletionList>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCompletionRequestHandler(
const std::function<
void(const QByteArray &, const CompletionParams &,
LSPPartialResponse<
std::variant<std::nullptr_t, QList<CompletionItem>, CompletionList>,
QList<CompletionItem>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::CompletionParamsType,
QLspSpecification::Responses::CompletionResponseType>(
QByteArray(QLspSpecification::Requests::CompletionMethod), handler);
}
void ProtocolGen::requestDeclaration(
const DeclarationParams ¶ms,
std::function<
void(const std::variant<std::nullptr_t, Declaration, QList<DeclarationLink>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DeclarationMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<
std::variant<std::nullptr_t, Declaration, QList<DeclarationLink>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDeclarationRequestHandler(
const std::function<
void(const QByteArray &, const DeclarationParams &,
LSPPartialResponse<
std::variant<std::nullptr_t, Declaration, QList<DeclarationLink>>,
std::variant<QList<Location>, QList<DeclarationLink>>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DeclarationParamsType,
QLspSpecification::Responses::DeclarationResponseType>(
QByteArray(QLspSpecification::Requests::DeclarationMethod), handler);
}
void ProtocolGen::requestDefinition(
const DefinitionParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, Definition, QList<DefinitionLink>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DefinitionMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, Definition, QList<DefinitionLink>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDefinitionRequestHandler(
const std::function<void(
const QByteArray &, const DefinitionParams &,
LSPPartialResponse<std::variant<std::nullptr_t, Definition, QList<DefinitionLink>>,
std::variant<QList<Location>, QList<DefinitionLink>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DefinitionParamsType,
QLspSpecification::Responses::DefinitionResponseType>(
QByteArray(QLspSpecification::Requests::DefinitionMethod), handler);
}
void ProtocolGen::requestDocumentDiagnostic(
const DocumentDiagnosticParams ¶ms,
std::function<void(const DocumentDiagnosticReport &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentDiagnosticMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<DocumentDiagnosticReport>(response.data, responseHandler,
errorHandler);
},
params);
}
void ProtocolGen::registerDocumentDiagnosticRequestHandler(
const std::function<void(const QByteArray &, const DocumentDiagnosticParams &,
LSPPartialResponse<DocumentDiagnosticReport,
DocumentDiagnosticReportProgress> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentDiagnosticParamsType,
QLspSpecification::Responses::DocumentDiagnosticResponseType>(
QByteArray(QLspSpecification::Requests::DocumentDiagnosticMethod), handler);
}
void ProtocolGen::requestDocumentColor(
const DocumentColorParams ¶ms,
std::function<void(const QList<ColorInformation> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentColorMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<QList<ColorInformation>>(response.data, responseHandler,
errorHandler);
},
params);
}
void ProtocolGen::registerDocumentColorRequestHandler(
const std::function<void(
const QByteArray &, const DocumentColorParams &,
LSPPartialResponse<QList<ColorInformation>, QList<ColorInformation>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentColorParamsType,
QLspSpecification::Responses::DocumentColorResponseType>(
QByteArray(QLspSpecification::Requests::DocumentColorMethod), handler);
}
void ProtocolGen::requestDocumentHighlight(
const DocumentHighlightParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<DocumentHighlight>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentHighlightMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<DocumentHighlight>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentHighlightRequestHandler(
const std::function<
void(const QByteArray &, const DocumentHighlightParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<DocumentHighlight>>,
QList<DocumentHighlight>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentHighlightParamsType,
QLspSpecification::Responses::DocumentHighlightResponseType>(
QByteArray(QLspSpecification::Requests::DocumentHighlightMethod), handler);
}
void ProtocolGen::requestDocumentLink(
const DocumentLinkParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<DocumentLink>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentLinkMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<DocumentLink>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentLinkRequestHandler(
const std::function<
void(const QByteArray &, const DocumentLinkParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<DocumentLink>>,
QList<DocumentLink>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentLinkParamsType,
QLspSpecification::Responses::DocumentLinkResponseType>(
QByteArray(QLspSpecification::Requests::DocumentLinkMethod), handler);
}
void ProtocolGen::requestDocumentSymbol(
const DocumentSymbolParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<SymbolInformation>,
QList<DocumentSymbol>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentSymbolMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<SymbolInformation>,
QList<DocumentSymbol>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentSymbolRequestHandler(
const std::function<void(
const QByteArray &, const DocumentSymbolParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<SymbolInformation>,
QList<DocumentSymbol>>,
std::variant<QList<SymbolInformation>, QList<DocumentSymbol>>>
&&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentSymbolParamsType,
QLspSpecification::Responses::DocumentSymbolResponseType>(
QByteArray(QLspSpecification::Requests::DocumentSymbolMethod), handler);
}
void ProtocolGen::requestFoldingRange(
const FoldingRangeParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<FoldingRange>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::FoldingRangeMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<FoldingRange>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerFoldingRangeRequestHandler(
const std::function<
void(const QByteArray &, const FoldingRangeParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<FoldingRange>>,
QList<FoldingRange>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::FoldingRangeParamsType,
QLspSpecification::Responses::FoldingRangeResponseType>(
QByteArray(QLspSpecification::Requests::FoldingRangeMethod), handler);
}
void ProtocolGen::requestDocumentFormatting(
const DocumentFormattingParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TextEdit>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentFormattingMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TextEdit>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentFormattingRequestHandler(
const std::function<void(const QByteArray &, const DocumentFormattingParams &,
LSPResponse<std::variant<std::nullptr_t, QList<TextEdit>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DocumentFormattingParamsType,
QLspSpecification::Responses::DocumentFormattingResponseType>(
QByteArray(QLspSpecification::Requests::DocumentFormattingMethod), handler);
}
void ProtocolGen::requestHover(
const HoverParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, Hover> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::HoverMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, Hover>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerHoverRequestHandler(
const std::function<void(const QByteArray &, const HoverParams &,
LSPResponse<std::variant<std::nullptr_t, Hover>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::HoverParamsType,
QLspSpecification::Responses::HoverResponseType>(
QByteArray(QLspSpecification::Requests::HoverMethod), handler);
}
void ProtocolGen::requestImplementation(
const ImplementationParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, Definition, QList<DefinitionLink>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ImplementationMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, Definition, QList<DefinitionLink>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerImplementationRequestHandler(
const std::function<void(
const QByteArray &, const ImplementationParams &,
LSPPartialResponse<std::variant<std::nullptr_t, Definition, QList<DefinitionLink>>,
std::variant<QList<Location>, QList<DefinitionLink>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ImplementationParamsType,
QLspSpecification::Responses::ImplementationResponseType>(
QByteArray(QLspSpecification::Requests::ImplementationMethod), handler);
}
void ProtocolGen::requestInlayHint(
const InlayHintParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<InlayHint>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::InlayHintMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<InlayHint>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerInlayHintRequestHandler(
const std::function<void(const QByteArray &, const InlayHintParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<InlayHint>>,
QList<InlayHint>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::InlayHintParamsType,
QLspSpecification::Responses::InlayHintResponseType>(
QByteArray(QLspSpecification::Requests::InlayHintMethod), handler);
}
void ProtocolGen::requestInlineCompletion(
const InlineCompletionParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, InlineCompletionList,
QList<InlineCompletionItem>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::InlineCompletionMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, InlineCompletionList,
QList<InlineCompletionItem>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerInlineCompletionRequestHandler(
const std::function<
void(const QByteArray &, const InlineCompletionParams &,
LSPPartialResponse<std::variant<std::nullptr_t, InlineCompletionList,
QList<InlineCompletionItem>>,
QList<InlineCompletionItem>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::InlineCompletionParamsType,
QLspSpecification::Responses::InlineCompletionResponseType>(
QByteArray(QLspSpecification::Requests::InlineCompletionMethod), handler);
}
void ProtocolGen::requestInlineValue(
const InlineValueParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<InlineValue>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::InlineValueMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<InlineValue>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerInlineValueRequestHandler(
const std::function<
void(const QByteArray &, const InlineValueParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<InlineValue>>,
QList<InlineValue>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::InlineValueParamsType,
QLspSpecification::Responses::InlineValueResponseType>(
QByteArray(QLspSpecification::Requests::InlineValueMethod), handler);
}
void ProtocolGen::requestLinkedEditingRange(
const LinkedEditingRangeParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, LinkedEditingRanges> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::LinkedEditingRangeMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, LinkedEditingRanges>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerLinkedEditingRangeRequestHandler(
const std::function<void(const QByteArray &, const LinkedEditingRangeParams &,
LSPResponse<std::variant<std::nullptr_t, LinkedEditingRanges>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::LinkedEditingRangeParamsType,
QLspSpecification::Responses::LinkedEditingRangeResponseType>(
QByteArray(QLspSpecification::Requests::LinkedEditingRangeMethod), handler);
}
void ProtocolGen::requestMoniker(
const MonikerParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<Moniker>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::MonikerMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<Moniker>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerMonikerRequestHandler(
const std::function<void(const QByteArray &, const MonikerParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<Moniker>>,
QList<Moniker>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::MonikerParamsType,
QLspSpecification::Responses::MonikerResponseType>(
QByteArray(QLspSpecification::Requests::MonikerMethod), handler);
}
void ProtocolGen::requestDocumentOnTypeFormatting(
const DocumentOnTypeFormattingParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TextEdit>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentOnTypeFormattingMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TextEdit>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentOnTypeFormattingRequestHandler(
const std::function<void(const QByteArray &, const DocumentOnTypeFormattingParams &,
LSPResponse<std::variant<std::nullptr_t, QList<TextEdit>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::DocumentOnTypeFormattingParamsType,
QLspSpecification::Responses::DocumentOnTypeFormattingResponseType>(
QByteArray(QLspSpecification::Requests::DocumentOnTypeFormattingMethod),
handler);
}
void ProtocolGen::requestCallHierarchyPrepare(
const CallHierarchyPrepareParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<CallHierarchyItem>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CallHierarchyPrepareMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<CallHierarchyItem>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCallHierarchyPrepareRequestHandler(
const std::function<void(
const QByteArray &, const CallHierarchyPrepareParams &,
LSPResponse<std::variant<std::nullptr_t, QList<CallHierarchyItem>>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::CallHierarchyPrepareParamsType,
QLspSpecification::Responses::CallHierarchyPrepareResponseType>(
QByteArray(QLspSpecification::Requests::CallHierarchyPrepareMethod), handler);
}
void ProtocolGen::requestPrepareRename(
const PrepareRenameParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, PrepareRenameResult> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::PrepareRenameMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, PrepareRenameResult>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerPrepareRenameRequestHandler(
const std::function<void(const QByteArray &, const PrepareRenameParams &,
LSPResponse<std::variant<std::nullptr_t, PrepareRenameResult>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::PrepareRenameParamsType,
QLspSpecification::Responses::PrepareRenameResponseType>(
QByteArray(QLspSpecification::Requests::PrepareRenameMethod), handler);
}
void ProtocolGen::requestTypeHierarchyPrepare(
const TypeHierarchyPrepareParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TypeHierarchyItem>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::TypeHierarchyPrepareMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TypeHierarchyItem>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerTypeHierarchyPrepareRequestHandler(
const std::function<void(
const QByteArray &, const TypeHierarchyPrepareParams &,
LSPResponse<std::variant<std::nullptr_t, QList<TypeHierarchyItem>>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::TypeHierarchyPrepareParamsType,
QLspSpecification::Responses::TypeHierarchyPrepareResponseType>(
QByteArray(QLspSpecification::Requests::TypeHierarchyPrepareMethod), handler);
}
void ProtocolGen::requestDocumentRangeFormatting(
const DocumentRangeFormattingParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TextEdit>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentRangeFormattingMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TextEdit>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentRangeFormattingRequestHandler(
const std::function<void(const QByteArray &, const DocumentRangeFormattingParams &,
LSPResponse<std::variant<std::nullptr_t, QList<TextEdit>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::DocumentRangeFormattingParamsType,
QLspSpecification::Responses::DocumentRangeFormattingResponseType>(
QByteArray(QLspSpecification::Requests::DocumentRangeFormattingMethod),
handler);
}
void ProtocolGen::requestDocumentRangesFormatting(
const DocumentRangesFormattingParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TextEdit>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DocumentRangesFormattingMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TextEdit>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDocumentRangesFormattingRequestHandler(
const std::function<void(const QByteArray &, const DocumentRangesFormattingParams &,
LSPResponse<std::variant<std::nullptr_t, QList<TextEdit>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::DocumentRangesFormattingParamsType,
QLspSpecification::Responses::DocumentRangesFormattingResponseType>(
QByteArray(QLspSpecification::Requests::DocumentRangesFormattingMethod),
handler);
}
void ProtocolGen::requestReference(
const ReferenceParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<Location>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ReferenceMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<Location>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerReferenceRequestHandler(
const std::function<void(const QByteArray &, const ReferenceParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<Location>>,
QList<Location>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ReferenceParamsType,
QLspSpecification::Responses::ReferenceResponseType>(
QByteArray(QLspSpecification::Requests::ReferenceMethod), handler);
}
void ProtocolGen::requestRename(
const RenameParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, WorkspaceEdit> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::RenameMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, WorkspaceEdit>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerRenameRequestHandler(
const std::function<void(const QByteArray &, const RenameParams &,
LSPResponse<std::variant<std::nullptr_t, WorkspaceEdit>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::RenameParamsType,
QLspSpecification::Responses::RenameResponseType>(
QByteArray(QLspSpecification::Requests::RenameMethod), handler);
}
void ProtocolGen::requestSelectionRange(
const SelectionRangeParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<SelectionRange>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::SelectionRangeMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<SelectionRange>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerSelectionRangeRequestHandler(
const std::function<
void(const QByteArray &, const SelectionRangeParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<SelectionRange>>,
QList<SelectionRange>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::SelectionRangeParamsType,
QLspSpecification::Responses::SelectionRangeResponseType>(
QByteArray(QLspSpecification::Requests::SelectionRangeMethod), handler);
}
void ProtocolGen::requestSemanticTokens(
const SemanticTokensParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, SemanticTokens> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::SemanticTokensMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, SemanticTokens>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerSemanticTokensRequestHandler(
const std::function<void(const QByteArray &, const SemanticTokensParams &,
LSPPartialResponse<std::variant<std::nullptr_t, SemanticTokens>,
SemanticTokensPartialResult> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::SemanticTokensParamsType,
QLspSpecification::Responses::SemanticTokensResponseType>(
QByteArray(QLspSpecification::Requests::SemanticTokensMethod), handler);
}
void ProtocolGen::requestSemanticTokensDelta(
const SemanticTokensDeltaParams ¶ms,
std::function<
void(const std::variant<std::nullptr_t, SemanticTokens, SemanticTokensDelta> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::SemanticTokensDeltaMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<
std::variant<std::nullptr_t, SemanticTokens, SemanticTokensDelta>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerSemanticTokensDeltaRequestHandler(
const std::function<void(
const QByteArray &, const SemanticTokensDeltaParams &,
LSPPartialResponse<
std::variant<std::nullptr_t, SemanticTokens, SemanticTokensDelta>,
std::variant<SemanticTokensPartialResult, SemanticTokensDeltaPartialResult>>
&&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::SemanticTokensDeltaParamsType,
QLspSpecification::Responses::SemanticTokensDeltaResponseType>(
QByteArray(QLspSpecification::Requests::SemanticTokensDeltaMethod), handler);
}
void ProtocolGen::requestSemanticTokensRange(
const SemanticTokensRangeParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, SemanticTokens> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::SemanticTokensRangeMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, SemanticTokens>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerSemanticTokensRangeRequestHandler(
const std::function<void(const QByteArray &, const SemanticTokensRangeParams &,
LSPPartialResponse<std::variant<std::nullptr_t, SemanticTokens>,
SemanticTokensPartialResult> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::SemanticTokensRangeParamsType,
QLspSpecification::Responses::SemanticTokensRangeResponseType>(
QByteArray(QLspSpecification::Requests::SemanticTokensRangeMethod), handler);
}
void ProtocolGen::requestSignatureHelp(
const SignatureHelpParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, SignatureHelp> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::SignatureHelpMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, SignatureHelp>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerSignatureHelpRequestHandler(
const std::function<void(const QByteArray &, const SignatureHelpParams &,
LSPResponse<std::variant<std::nullptr_t, SignatureHelp>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::SignatureHelpParamsType,
QLspSpecification::Responses::SignatureHelpResponseType>(
QByteArray(QLspSpecification::Requests::SignatureHelpMethod), handler);
}
void ProtocolGen::requestTypeDefinition(
const TypeDefinitionParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, Definition, QList<DefinitionLink>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::TypeDefinitionMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, Definition, QList<DefinitionLink>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerTypeDefinitionRequestHandler(
const std::function<void(
const QByteArray &, const TypeDefinitionParams &,
LSPPartialResponse<std::variant<std::nullptr_t, Definition, QList<DefinitionLink>>,
std::variant<QList<Location>, QList<DefinitionLink>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::TypeDefinitionParamsType,
QLspSpecification::Responses::TypeDefinitionResponseType>(
QByteArray(QLspSpecification::Requests::TypeDefinitionMethod), handler);
}
void ProtocolGen::requestWillSaveTextDocument(
const WillSaveTextDocumentParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TextEdit>> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WillSaveTextDocumentMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TextEdit>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWillSaveTextDocumentRequestHandler(
const std::function<void(const QByteArray &, const WillSaveTextDocumentParams &,
LSPResponse<std::variant<std::nullptr_t, QList<TextEdit>>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WillSaveTextDocumentParamsType,
QLspSpecification::Responses::WillSaveTextDocumentResponseType>(
QByteArray(QLspSpecification::Requests::WillSaveTextDocumentMethod), handler);
}
void ProtocolGen::requestTypeHierarchySubtypes(
const TypeHierarchySubtypesParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TypeHierarchyItem>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::TypeHierarchySubtypesMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TypeHierarchyItem>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerTypeHierarchySubtypesRequestHandler(
const std::function<
void(const QByteArray &, const TypeHierarchySubtypesParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<TypeHierarchyItem>>,
QList<TypeHierarchyItem>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::TypeHierarchySubtypesParamsType,
QLspSpecification::Responses::TypeHierarchySubtypesResponseType>(
QByteArray(QLspSpecification::Requests::TypeHierarchySubtypesMethod), handler);
}
void ProtocolGen::requestTypeHierarchySupertypes(
const TypeHierarchySupertypesParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<TypeHierarchyItem>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::TypeHierarchySupertypesMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<TypeHierarchyItem>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerTypeHierarchySupertypesRequestHandler(
const std::function<
void(const QByteArray &, const TypeHierarchySupertypesParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<TypeHierarchyItem>>,
QList<TypeHierarchyItem>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::TypeHierarchySupertypesParamsType,
QLspSpecification::Responses::TypeHierarchySupertypesResponseType>(
QByteArray(QLspSpecification::Requests::TypeHierarchySupertypesMethod),
handler);
}
void ProtocolGen::requestShowDocument(
const ShowDocumentParams ¶ms,
std::function<void(const ShowDocumentResult &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ShowDocumentMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<ShowDocumentResult>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerShowDocumentRequestHandler(
const std::function<void(const QByteArray &, const ShowDocumentParams &,
LSPResponse<ShowDocumentResult> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ShowDocumentParamsType,
QLspSpecification::Responses::ShowDocumentResponseType>(
QByteArray(QLspSpecification::Requests::ShowDocumentMethod), handler);
}
void ProtocolGen::requestShowMessageRequest(
const ShowMessageRequestParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, MessageActionItem> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ShowMessageRequestMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, MessageActionItem>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerShowMessageRequestRequestHandler(
const std::function<void(const QByteArray &, const ShowMessageRequestParams &,
LSPResponse<std::variant<std::nullptr_t, MessageActionItem>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ShowMessageRequestParamsType,
QLspSpecification::Responses::ShowMessageRequestResponseType>(
QByteArray(QLspSpecification::Requests::ShowMessageRequestMethod), handler);
}
void ProtocolGen::requestWorkDoneProgressCreate(const WorkDoneProgressCreateParams ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkDoneProgressCreateMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkDoneProgressCreateRequestHandler(
const std::function<void(const QByteArray &, const WorkDoneProgressCreateParams &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkDoneProgressCreateParamsType,
QLspSpecification::Responses::WorkDoneProgressCreateResponseType>(
QByteArray(QLspSpecification::Requests::WorkDoneProgressCreateMethod), handler);
}
void ProtocolGen::requestApplyWorkspaceEdit(
const ApplyWorkspaceEditParams ¶ms,
std::function<void(const ApplyWorkspaceEditResult &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ApplyWorkspaceEditMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<ApplyWorkspaceEditResult>(response.data, responseHandler,
errorHandler);
},
params);
}
void ProtocolGen::registerApplyWorkspaceEditRequestHandler(
const std::function<void(const QByteArray &, const ApplyWorkspaceEditParams &,
LSPResponse<ApplyWorkspaceEditResult> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ApplyWorkspaceEditParamsType,
QLspSpecification::Responses::ApplyWorkspaceEditResponseType>(
QByteArray(QLspSpecification::Requests::ApplyWorkspaceEditMethod), handler);
}
void ProtocolGen::requestWorkspaceCodeLensRefresh(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceCodeLensRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceCodeLensRefreshRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceCodeLensRefreshParamsType,
QLspSpecification::Responses::WorkspaceCodeLensRefreshResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceCodeLensRefreshMethod),
handler);
}
void ProtocolGen::requestConfiguration(
const ConfigurationParams ¶ms,
std::function<void(const QList<QJsonValue> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ConfigurationMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<QList<QJsonValue>>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerConfigurationRequestHandler(
const std::function<void(const QByteArray &, const ConfigurationParams &,
LSPResponse<QList<QJsonValue>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ConfigurationParamsType,
QLspSpecification::Responses::ConfigurationResponseType>(
QByteArray(QLspSpecification::Requests::ConfigurationMethod), handler);
}
void ProtocolGen::requestWorkspaceDiagnostic(
const WorkspaceDiagnosticParams ¶ms,
std::function<void(const WorkspaceDiagnosticReport &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceDiagnosticMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<WorkspaceDiagnosticReport>(response.data, responseHandler,
errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceDiagnosticRequestHandler(
const std::function<void(const QByteArray &, const WorkspaceDiagnosticParams &,
LSPPartialResponse<WorkspaceDiagnosticReport,
WorkspaceDiagnosticReportPartialResult> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::WorkspaceDiagnosticParamsType,
QLspSpecification::Responses::WorkspaceDiagnosticResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceDiagnosticMethod), handler);
}
void ProtocolGen::requestWorkspaceDiagnosticRefresh(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceDiagnosticRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceDiagnosticRefreshRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceDiagnosticRefreshParamsType,
QLspSpecification::Responses::WorkspaceDiagnosticRefreshResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceDiagnosticRefreshMethod),
handler);
}
void ProtocolGen::requestExecuteCommand(
const ExecuteCommandParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QJsonValue> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::ExecuteCommandMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QJsonValue>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerExecuteCommandRequestHandler(
const std::function<void(const QByteArray &, const ExecuteCommandParams &,
LSPResponse<std::variant<std::nullptr_t, QJsonValue>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::ExecuteCommandParamsType,
QLspSpecification::Responses::ExecuteCommandResponseType>(
QByteArray(QLspSpecification::Requests::ExecuteCommandMethod), handler);
}
void ProtocolGen::requestWorkspaceFoldingRangeRefresh(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceFoldingRangeRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceFoldingRangeRefreshRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceFoldingRangeRefreshParamsType,
QLspSpecification::Responses::WorkspaceFoldingRangeRefreshResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceFoldingRangeRefreshMethod),
handler);
}
void ProtocolGen::requestWorkspaceInlayHintRefresh(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceInlayHintRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceInlayHintRefreshRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceInlayHintRefreshParamsType,
QLspSpecification::Responses::WorkspaceInlayHintRefreshResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceInlayHintRefreshMethod),
handler);
}
void ProtocolGen::requestWorkspaceInlineValueRefresh(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceInlineValueRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceInlineValueRefreshRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceInlineValueRefreshParamsType,
QLspSpecification::Responses::WorkspaceInlineValueRefreshResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceInlineValueRefreshMethod),
handler);
}
void ProtocolGen::requestWorkspaceSemanticTokensRefresh(const std::nullptr_t ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceSemanticTokensRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceSemanticTokensRefreshRequestHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceSemanticTokensRefreshParamsType,
QLspSpecification::Responses::WorkspaceSemanticTokensRefreshResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceSemanticTokensRefreshMethod),
handler);
}
void ProtocolGen::requestWorkspaceSymbol(
const WorkspaceSymbolParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<SymbolInformation>,
QList<WorkspaceSymbol>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceSymbolMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<SymbolInformation>,
QList<WorkspaceSymbol>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceSymbolRequestHandler(
const std::function<void(
const QByteArray &, const WorkspaceSymbolParams &,
LSPPartialResponse<std::variant<std::nullptr_t, QList<SymbolInformation>,
QList<WorkspaceSymbol>>,
std::variant<QList<SymbolInformation>, QList<WorkspaceSymbol>>>
&&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::WorkspaceSymbolParamsType,
QLspSpecification::Responses::WorkspaceSymbolResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceSymbolMethod), handler);
}
void ProtocolGen::requestTextDocumentContent(
const TextDocumentContentParams ¶ms,
std::function<void(const TextDocumentContentResult &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::TextDocumentContentMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<TextDocumentContentResult>(response.data, responseHandler,
errorHandler);
},
params);
}
void ProtocolGen::registerTextDocumentContentRequestHandler(
const std::function<void(const QByteArray &, const TextDocumentContentParams &,
LSPResponse<TextDocumentContentResult> &&)> &handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::TextDocumentContentParamsType,
QLspSpecification::Responses::TextDocumentContentResponseType>(
QByteArray(QLspSpecification::Requests::TextDocumentContentMethod), handler);
}
void ProtocolGen::requestTextDocumentContentRefresh(const TextDocumentContentRefreshParams ¶ms,
std::function<void()> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::TextDocumentContentRefreshMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::nullptr_t>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerTextDocumentContentRefreshRequestHandler(
const std::function<void(const QByteArray &, const TextDocumentContentRefreshParams &,
LSPResponse<std::nullptr_t> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::TextDocumentContentRefreshParamsType,
QLspSpecification::Responses::TextDocumentContentRefreshResponseType>(
QByteArray(QLspSpecification::Requests::TextDocumentContentRefreshMethod),
handler);
}
void ProtocolGen::requestCreateFiles(
const CreateFilesParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, WorkspaceEdit> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::CreateFilesMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, WorkspaceEdit>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerCreateFilesRequestHandler(
const std::function<void(const QByteArray &, const CreateFilesParams &,
LSPResponse<std::variant<std::nullptr_t, WorkspaceEdit>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::CreateFilesParamsType,
QLspSpecification::Responses::CreateFilesResponseType>(
QByteArray(QLspSpecification::Requests::CreateFilesMethod), handler);
}
void ProtocolGen::requestDeleteFiles(
const DeleteFilesParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, WorkspaceEdit> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::DeleteFilesMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, WorkspaceEdit>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerDeleteFilesRequestHandler(
const std::function<void(const QByteArray &, const DeleteFilesParams &,
LSPResponse<std::variant<std::nullptr_t, WorkspaceEdit>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::DeleteFilesParamsType,
QLspSpecification::Responses::DeleteFilesResponseType>(
QByteArray(QLspSpecification::Requests::DeleteFilesMethod), handler);
}
void ProtocolGen::requestRenameFiles(
const RenameFilesParams ¶ms,
std::function<void(const std::variant<std::nullptr_t, WorkspaceEdit> &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::RenameFilesMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, WorkspaceEdit>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerRenameFilesRequestHandler(
const std::function<void(const QByteArray &, const RenameFilesParams &,
LSPResponse<std::variant<std::nullptr_t, WorkspaceEdit>> &&)>
&handler)
{
typedRpc()
->registerRequestHandler<QLspSpecification::Requests::RenameFilesParamsType,
QLspSpecification::Responses::RenameFilesResponseType>(
QByteArray(QLspSpecification::Requests::RenameFilesMethod), handler);
}
void ProtocolGen::requestWorkspaceWorkspaceFolders(
const std::nullptr_t ¶ms,
std::function<void(const std::variant<std::nullptr_t, QList<WorkspaceFolder>> &)>
responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceWorkspaceFoldersMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<std::variant<std::nullptr_t, QList<WorkspaceFolder>>>(
response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceWorkspaceFoldersRequestHandler(
const std::function<void(
const QByteArray &, const std::nullptr_t &,
LSPResponse<std::variant<std::nullptr_t, QList<WorkspaceFolder>>> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceWorkspaceFoldersParamsType,
QLspSpecification::Responses::WorkspaceWorkspaceFoldersResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceWorkspaceFoldersMethod),
handler);
}
void ProtocolGen::requestWorkspaceSymbolResolve(
const WorkspaceSymbol ¶ms, std::function<void(const WorkspaceSymbol &)> responseHandler,
ResponseErrorHandler errorHandler)
{
typedRpc()->sendRequest(
QByteArray(Requests::WorkspaceSymbolResolveMethod),
[responseHandler = std::move(responseHandler),
errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
if (response.errorCode.isDouble())
errorHandler(ResponseError{ response.errorCode.toInt(),
response.errorMessage.toUtf8(), response.data });
else
decodeAndCall<WorkspaceSymbol>(response.data, responseHandler, errorHandler);
},
params);
}
void ProtocolGen::registerWorkspaceSymbolResolveRequestHandler(
const std::function<void(const QByteArray &, const WorkspaceSymbol &,
LSPResponse<WorkspaceSymbol> &&)> &handler)
{
typedRpc()
->registerRequestHandler<
QLspSpecification::Requests::WorkspaceSymbolResolveParamsType,
QLspSpecification::Responses::WorkspaceSymbolResolveResponseType>(
QByteArray(QLspSpecification::Requests::WorkspaceSymbolResolveMethod), handler);
}
// Notifications
void ProtocolGen::registerCancelNotificationHandler(
const std::function<void(const QByteArray &, const CancelParams &)> &handler)
{
typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::CancelParamsType>(
QByteArray(QLspSpecification::Notifications::CancelMethod), handler);
}
void ProtocolGen::notifyCancel(const CancelParams ¶ms)
{
typedRpc()->sendNotification(Notifications::CancelMethod, params);
}
void ProtocolGen::registerLogTraceNotificationHandler(
const std::function<void(const QByteArray &, const LogTraceParams &)> &handler)
{
typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::LogTraceParamsType>(
QByteArray(QLspSpecification::Notifications::LogTraceMethod), handler);
}
void ProtocolGen::notifyLogTrace(const LogTraceParams ¶ms)
{
typedRpc()->sendNotification(Notifications::LogTraceMethod, params);
}
void ProtocolGen::registerProgressNotificationHandler(
const std::function<void(const QByteArray &, const ProgressParams &)> &handler)
{
typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::ProgressParamsType>(
QByteArray(QLspSpecification::Notifications::ProgressMethod), handler);
}
void ProtocolGen::notifyProgress(const ProgressParams ¶ms)
{
typedRpc()->sendNotification(Notifications::ProgressMethod, params);
}
void ProtocolGen::registerSetTraceNotificationHandler(
const std::function<void(const QByteArray &, const SetTraceParams &)> &handler)
{
typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::SetTraceParamsType>(
QByteArray(QLspSpecification::Notifications::SetTraceMethod), handler);
}
void ProtocolGen::notifySetTrace(const SetTraceParams ¶ms)
{
typedRpc()->sendNotification(Notifications::SetTraceMethod, params);
}
void ProtocolGen::registerExitNotificationHandler(
const std::function<void(const QByteArray &, const std::nullptr_t &)> &handler)
{
typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::ExitParamsType>(
QByteArray(QLspSpecification::Notifications::ExitMethod), handler);
}
void ProtocolGen::notifyExit(const std::nullptr_t ¶ms)
{
typedRpc()->sendNotification(Notifications::ExitMethod, params);
}
void ProtocolGen::registerInitializedNotificationHandler(
const std::function<void(const QByteArray &, const InitializedParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<QLspSpecification::Notifications::InitializedParamsType>(
QByteArray(QLspSpecification::Notifications::InitializedMethod), handler);
}
void ProtocolGen::notifyInitialized(const InitializedParams ¶ms)
{
typedRpc()->sendNotification(Notifications::InitializedMethod, params);
}
void ProtocolGen::registerDidChangeNotebookDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidChangeNotebookDocumentParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidChangeNotebookDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidChangeNotebookDocumentMethod),
handler);
}
void ProtocolGen::notifyDidChangeNotebookDocument(const DidChangeNotebookDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidChangeNotebookDocumentMethod, params);
}
void ProtocolGen::registerDidCloseNotebookDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidCloseNotebookDocumentParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidCloseNotebookDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidCloseNotebookDocumentMethod),
handler);
}
void ProtocolGen::notifyDidCloseNotebookDocument(const DidCloseNotebookDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidCloseNotebookDocumentMethod, params);
}
void ProtocolGen::registerDidOpenNotebookDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidOpenNotebookDocumentParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidOpenNotebookDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidOpenNotebookDocumentMethod),
handler);
}
void ProtocolGen::notifyDidOpenNotebookDocument(const DidOpenNotebookDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidOpenNotebookDocumentMethod, params);
}
void ProtocolGen::registerDidSaveNotebookDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidSaveNotebookDocumentParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidSaveNotebookDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidSaveNotebookDocumentMethod),
handler);
}
void ProtocolGen::notifyDidSaveNotebookDocument(const DidSaveNotebookDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidSaveNotebookDocumentMethod, params);
}
void ProtocolGen::registerTelemetryEventNotificationHandler(
const std::function<void(const QByteArray &, const QJsonValue &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::TelemetryEventParamsType>(
QByteArray(QLspSpecification::Notifications::TelemetryEventMethod), handler);
}
void ProtocolGen::notifyTelemetryEvent(const QJsonValue ¶ms)
{
typedRpc()->sendNotification(Notifications::TelemetryEventMethod, params);
}
void ProtocolGen::registerDidChangeTextDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidChangeTextDocumentParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidChangeTextDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidChangeTextDocumentMethod),
handler);
}
void ProtocolGen::notifyDidChangeTextDocument(const DidChangeTextDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidChangeTextDocumentMethod, params);
}
void ProtocolGen::registerDidCloseTextDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidCloseTextDocumentParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidCloseTextDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidCloseTextDocumentMethod),
handler);
}
void ProtocolGen::notifyDidCloseTextDocument(const DidCloseTextDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidCloseTextDocumentMethod, params);
}
void ProtocolGen::registerDidOpenTextDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidOpenTextDocumentParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidOpenTextDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidOpenTextDocumentMethod),
handler);
}
void ProtocolGen::notifyDidOpenTextDocument(const DidOpenTextDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidOpenTextDocumentMethod, params);
}
void ProtocolGen::registerDidSaveTextDocumentNotificationHandler(
const std::function<void(const QByteArray &, const DidSaveTextDocumentParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidSaveTextDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::DidSaveTextDocumentMethod),
handler);
}
void ProtocolGen::notifyDidSaveTextDocument(const DidSaveTextDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidSaveTextDocumentMethod, params);
}
void ProtocolGen::registerPublishDiagnosticsNotificationHandler(
const std::function<void(const QByteArray &, const PublishDiagnosticsParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::PublishDiagnosticsParamsType>(
QByteArray(QLspSpecification::Notifications::PublishDiagnosticsMethod),
handler);
}
void ProtocolGen::notifyPublishDiagnostics(const PublishDiagnosticsParams ¶ms)
{
typedRpc()->sendNotification(Notifications::PublishDiagnosticsMethod, params);
}
void ProtocolGen::registerWillSaveTextDocumentNotificationHandler(
const std::function<void(const QByteArray &, const WillSaveTextDocumentParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::WillSaveTextDocumentParamsType>(
QByteArray(QLspSpecification::Notifications::WillSaveTextDocumentMethod),
handler);
}
void ProtocolGen::notifyWillSaveTextDocument(const WillSaveTextDocumentParams ¶ms)
{
typedRpc()->sendNotification(Notifications::WillSaveTextDocumentMethod, params);
}
void ProtocolGen::registerLogMessageNotificationHandler(
const std::function<void(const QByteArray &, const LogMessageParams &)> &handler)
{
typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::LogMessageParamsType>(
QByteArray(QLspSpecification::Notifications::LogMessageMethod), handler);
}
void ProtocolGen::notifyLogMessage(const LogMessageParams ¶ms)
{
typedRpc()->sendNotification(Notifications::LogMessageMethod, params);
}
void ProtocolGen::registerShowMessageNotificationHandler(
const std::function<void(const QByteArray &, const ShowMessageParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<QLspSpecification::Notifications::ShowMessageParamsType>(
QByteArray(QLspSpecification::Notifications::ShowMessageMethod), handler);
}
void ProtocolGen::notifyShowMessage(const ShowMessageParams ¶ms)
{
typedRpc()->sendNotification(Notifications::ShowMessageMethod, params);
}
void ProtocolGen::registerWorkDoneProgressCancelNotificationHandler(
const std::function<void(const QByteArray &, const WorkDoneProgressCancelParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::WorkDoneProgressCancelParamsType>(
QByteArray(QLspSpecification::Notifications::WorkDoneProgressCancelMethod),
handler);
}
void ProtocolGen::notifyWorkDoneProgressCancel(const WorkDoneProgressCancelParams ¶ms)
{
typedRpc()->sendNotification(Notifications::WorkDoneProgressCancelMethod, params);
}
void ProtocolGen::registerDidChangeConfigurationNotificationHandler(
const std::function<void(const QByteArray &, const DidChangeConfigurationParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidChangeConfigurationParamsType>(
QByteArray(QLspSpecification::Notifications::DidChangeConfigurationMethod),
handler);
}
void ProtocolGen::notifyDidChangeConfiguration(const DidChangeConfigurationParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidChangeConfigurationMethod, params);
}
void ProtocolGen::registerDidChangeWatchedFilesNotificationHandler(
const std::function<void(const QByteArray &, const DidChangeWatchedFilesParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidChangeWatchedFilesParamsType>(
QByteArray(QLspSpecification::Notifications::DidChangeWatchedFilesMethod),
handler);
}
void ProtocolGen::notifyDidChangeWatchedFiles(const DidChangeWatchedFilesParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidChangeWatchedFilesMethod, params);
}
void ProtocolGen::registerDidChangeWorkspaceFoldersNotificationHandler(
const std::function<void(const QByteArray &, const DidChangeWorkspaceFoldersParams &)>
&handler)
{
typedRpc()
->registerNotificationHandler<
QLspSpecification::Notifications::DidChangeWorkspaceFoldersParamsType>(
QByteArray(QLspSpecification::Notifications::DidChangeWorkspaceFoldersMethod),
handler);
}
void ProtocolGen::notifyDidChangeWorkspaceFolders(const DidChangeWorkspaceFoldersParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DidChangeWorkspaceFoldersMethod, params);
}
void ProtocolGen::registerCreateFilesNotificationHandler(
const std::function<void(const QByteArray &, const CreateFilesParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<QLspSpecification::Notifications::CreateFilesParamsType>(
QByteArray(QLspSpecification::Notifications::CreateFilesMethod), handler);
}
void ProtocolGen::notifyCreateFiles(const CreateFilesParams ¶ms)
{
typedRpc()->sendNotification(Notifications::CreateFilesMethod, params);
}
void ProtocolGen::registerDeleteFilesNotificationHandler(
const std::function<void(const QByteArray &, const DeleteFilesParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<QLspSpecification::Notifications::DeleteFilesParamsType>(
QByteArray(QLspSpecification::Notifications::DeleteFilesMethod), handler);
}
void ProtocolGen::notifyDeleteFiles(const DeleteFilesParams ¶ms)
{
typedRpc()->sendNotification(Notifications::DeleteFilesMethod, params);
}
void ProtocolGen::registerRenameFilesNotificationHandler(
const std::function<void(const QByteArray &, const RenameFilesParams &)> &handler)
{
typedRpc()
->registerNotificationHandler<QLspSpecification::Notifications::RenameFilesParamsType>(
QByteArray(QLspSpecification::Notifications::RenameFilesMethod), handler);
}
void ProtocolGen::notifyRenameFiles(const RenameFilesParams ¶ms)
{
typedRpc()->sendNotification(Notifications::RenameFilesMethod, params);
}
} // namespace QLspSpecification
QT_END_NAMESPACE