1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4// this file was generated by the generate.ts script
5
6#include <QtLanguageServer/private/qlanguageservergen_p_p.h>
7
8#include <QtCore/QScopeGuard>
9
10QT_BEGIN_NAMESPACE
11
12namespace QLspSpecification {
13
14QByteArray ProtocolBase::requestMethodToBaseCppName(const QByteArray &method)
15{
16 static QHash<QByteArray, QByteArray> map(
17 { { QByteArray("initialize"), QByteArray("Initialize") },
18 { QByteArray("shutdown"), QByteArray("Shutdown") },
19 { QByteArray("window/showMessageRequest"), QByteArray("ShowMessageRequest") },
20 { QByteArray("window/showDocument"), QByteArray("ShowDocument") },
21 { QByteArray("window/workDoneProgress/create"),
22 QByteArray("WorkDoneProgressCreate") },
23 { QByteArray("client/registerCapability"), QByteArray("Registration") },
24 { QByteArray("client/unregisterCapability"), QByteArray("Unregistration") },
25 { QByteArray("workspace/workspaceFolders"), QByteArray("WorkspaceWorkspaceFolders") },
26 { QByteArray("workspace/configuration"), QByteArray("Configuration") },
27 { QByteArray("workspace/symbol"), QByteArray("WorkspaceSymbol") },
28 { QByteArray("workspace/executeCommand"), QByteArray("ExecuteCommand") },
29 { QByteArray("workspace/applyEdit"), QByteArray("ApplyWorkspaceEdit") },
30 { QByteArray("workspace/willCreateFiles"), QByteArray("CreateFiles") },
31 { QByteArray("workspace/willRenameFiles"), QByteArray("RenameFiles") },
32 { QByteArray("workspace/willDeleteFiles"), QByteArray("DeleteFiles") },
33 { QByteArray("textDocument/willSaveWaitUntil"), QByteArray("WillSaveTextDocument") },
34 { QByteArray("textDocument/completion"), QByteArray("Completion") },
35 { QByteArray("completionItem/resolve"), QByteArray("CompletionItemResolve") },
36 { QByteArray("textDocument/hover"), QByteArray("Hover") },
37 { QByteArray("textDocument/signatureHelp"), QByteArray("SignatureHelp") },
38 { QByteArray("textDocument/declaration"), QByteArray("Declaration") },
39 { QByteArray("textDocument/definition"), QByteArray("Definition") },
40 { QByteArray("textDocument/typeDefinition"), QByteArray("TypeDefinition") },
41 { QByteArray("textDocument/implementation"), QByteArray("Implementation") },
42 { QByteArray("textDocument/references"), QByteArray("Reference") },
43 { QByteArray("textDocument/documentHighlight"), QByteArray("DocumentHighlight") },
44 { QByteArray("textDocument/documentSymbol"), QByteArray("DocumentSymbol") },
45 { QByteArray("textDocument/codeAction"), QByteArray("CodeAction") },
46 { QByteArray("codeAction/resolve"), QByteArray("CodeActionResolve") },
47 { QByteArray("textDocument/codeLens"), QByteArray("CodeLens") },
48 { QByteArray("codeLens/resolve"), QByteArray("CodeLensResolve") },
49 { QByteArray("workspace/codeLens/refresh"), QByteArray("CodeLensRefresh") },
50 { QByteArray("textDocument/documentLink"), QByteArray("DocumentLink") },
51 { QByteArray("documentLink/resolve"), QByteArray("DocumentLinkResolve") },
52 { QByteArray("textDocument/documentColor"), QByteArray("DocumentColor") },
53 { QByteArray("textDocument/colorPresentation"), QByteArray("ColorPresentation") },
54 { QByteArray("textDocument/formatting"), QByteArray("DocumentFormatting") },
55 { QByteArray("textDocument/rangeFormatting"), QByteArray("DocumentRangeFormatting") },
56 { QByteArray("textDocument/onTypeFormatting"),
57 QByteArray("DocumentOnTypeFormatting") },
58 { QByteArray("textDocument/rename"), QByteArray("Rename") },
59 { QByteArray("textDocument/prepareRename"), QByteArray("PrepareRename") },
60 { QByteArray("textDocument/foldingRange"), QByteArray("FoldingRange") },
61 { QByteArray("textDocument/selectionRange"), QByteArray("SelectionRange") },
62 { QByteArray("textDocument/prepareCallHierarchy"),
63 QByteArray("CallHierarchyPrepare") },
64 { QByteArray("callHierarchy/incomingCalls"),
65 QByteArray("CallHierarchyIncomingCalls") },
66 { QByteArray("callHierarchy/outgoingCalls"),
67 QByteArray("CallHierarchyOutgoingCalls") },
68 { QByteArray("textDocument/semanticTokens/full"), QByteArray("SemanticTokens") },
69 { QByteArray("textDocument/semanticTokens/full/delta"),
70 QByteArray("SemanticTokensDelta") },
71 { QByteArray("textDocument/semanticTokens/range"),
72 QByteArray("SemanticTokensRange") },
73 { QByteArray("workspace/semanticTokens/refresh"),
74 QByteArray("RequestingARefreshOfAllSemanticTokens") },
75 { QByteArray("textDocument/linkedEditingRange"), QByteArray("LinkedEditingRange") },
76 { QByteArray("textDocument/moniker"), QByteArray("Moniker") } });
77 return map.value(key: method);
78}
79
80QByteArray ProtocolBase::notificationMethodToBaseCppName(const QByteArray &method)
81{
82 static QHash<QByteArray, QByteArray> map(
83 { { QByteArray("$/cancelRequest"), QByteArray("Cancel") },
84 { QByteArray("$/progress"), QByteArray("Progress") },
85 { QByteArray("initialized"), QByteArray("Initialized") },
86 { QByteArray("exit"), QByteArray("Exit") },
87 { QByteArray("$/logTrace"), QByteArray("LogTrace") },
88 { QByteArray("$/setTrace"), QByteArray("SetTrace") },
89 { QByteArray("window/showMessage"), QByteArray("ShowMessage") },
90 { QByteArray("window/logMessage"), QByteArray("LogMessage") },
91 { QByteArray("window/workDoneProgress/cancel"),
92 QByteArray("WorkDoneProgressCancel") },
93 { QByteArray("telemetry/event"), QByteArray("TelemetryEvent") },
94 { QByteArray("workspace/didChangeWorkspaceFolders"),
95 QByteArray("DidChangeWorkspaceFolders") },
96 { QByteArray("workspace/didChangeConfiguration"),
97 QByteArray("DidChangeConfiguration") },
98 { QByteArray("workspace/didChangeWatchedFiles"),
99 QByteArray("DidChangeWatchedFiles") },
100 { QByteArray("workspace/didCreateFiles"), QByteArray("CreateFiles") },
101 { QByteArray("workspace/didRenameFiles"), QByteArray("RenameFiles") },
102 { QByteArray("workspace/didDeleteFiles"), QByteArray("DeleteFiles") },
103 { QByteArray("textDocument/didOpen"), QByteArray("DidOpenTextDocument") },
104 { QByteArray("textDocument/didChange"), QByteArray("DidChangeTextDocument") },
105 { QByteArray("textDocument/willSave"), QByteArray("WillSaveTextDocument") },
106 { QByteArray("textDocument/didSave"), QByteArray("DidSaveTextDocument") },
107 { QByteArray("textDocument/didClose"), QByteArray("DidCloseTextDocument") },
108 { QByteArray("textDocument/publishDiagnostics"),
109 QByteArray("PublishDiagnostics") } });
110 return map.value(key: method);
111}
112
113ProtocolGen::ProtocolGen(std::unique_ptr<ProtocolGenPrivate> &&p) : ProtocolBase(std::move(p)) { }
114
115ProtocolGen::~ProtocolGen() { }
116
117void ProtocolGen::notifyCancel(const CancelParams &params)
118{
119 typedRpc()->sendNotification(method: Notifications::CancelMethod, params);
120}
121
122void ProtocolGen::requestInitialize(const InitializeParams &params,
123 std::function<void(const InitializeResult &)> responseHandler,
124 ResponseErrorHandler errorHandler)
125{
126 typedRpc()->sendRequest(
127 method: QByteArray(Requests::InitializeMethod),
128 handler: [responseHandler = std::move(responseHandler),
129 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
130 if (response.errorCode.isDouble())
131 errorHandler(ResponseError { .code: response.errorCode.toInt(),
132 .message: response.errorMessage.toUtf8(), .data: response.data });
133 else
134 decodeAndCall<InitializeResult>(value: response.data, funct: responseHandler, errorHandler);
135 },
136 params);
137}
138
139void ProtocolGen::notifyInitialized(const InitializedParams &params)
140{
141 typedRpc()->sendNotification(method: Notifications::InitializedMethod, params);
142}
143
144void ProtocolGen::requestShutdown(const std::nullptr_t &params,
145 std::function<void()> responseHandler,
146 ResponseErrorHandler errorHandler)
147{
148 typedRpc()->sendRequest(
149 method: QByteArray(Requests::ShutdownMethod),
150 handler: [responseHandler = std::move(responseHandler),
151 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
152 if (response.errorCode.isDouble())
153 errorHandler(ResponseError { .code: response.errorCode.toInt(),
154 .message: response.errorMessage.toUtf8(), .data: response.data });
155 else
156 decodeAndCall<std::nullptr_t>(value: response.data, funct: responseHandler, errorHandler);
157 },
158 params);
159}
160
161void ProtocolGen::notifyExit(const std::nullptr_t &params)
162{
163 typedRpc()->sendNotification(method: Notifications::ExitMethod, params);
164}
165
166void ProtocolGen::notifyLogTrace(const LogTraceParams &params)
167{
168 typedRpc()->sendNotification(method: Notifications::LogTraceMethod, params);
169}
170
171void ProtocolGen::notifySetTrace(const SetTraceParams &params)
172{
173 typedRpc()->sendNotification(method: Notifications::SetTraceMethod, params);
174}
175
176void ProtocolGen::notifyShowMessage(const ShowMessageParams &params)
177{
178 typedRpc()->sendNotification(method: Notifications::ShowMessageMethod, params);
179}
180
181void ProtocolGen::requestShowMessageRequest(
182 const ShowMessageRequestParams &params,
183 std::function<void(const std::variant<MessageActionItem, std::nullptr_t> &)>
184 responseHandler,
185 ResponseErrorHandler errorHandler)
186{
187 typedRpc()->sendRequest(
188 method: QByteArray(Requests::ShowMessageRequestMethod),
189 handler: [responseHandler = std::move(responseHandler),
190 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
191 if (response.errorCode.isDouble())
192 errorHandler(ResponseError { .code: response.errorCode.toInt(),
193 .message: response.errorMessage.toUtf8(), .data: response.data });
194 else
195 decodeAndCall<std::variant<MessageActionItem, std::nullptr_t>>(
196 value: response.data, funct: responseHandler, errorHandler);
197 },
198 params);
199}
200
201void ProtocolGen::requestShowDocument(
202 const ShowDocumentParams &params,
203 std::function<void(const ShowDocumentResult &)> responseHandler,
204 ResponseErrorHandler errorHandler)
205{
206 typedRpc()->sendRequest(
207 method: QByteArray(Requests::ShowDocumentMethod),
208 handler: [responseHandler = std::move(responseHandler),
209 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
210 if (response.errorCode.isDouble())
211 errorHandler(ResponseError { .code: response.errorCode.toInt(),
212 .message: response.errorMessage.toUtf8(), .data: response.data });
213 else
214 decodeAndCall<ShowDocumentResult>(value: response.data, funct: responseHandler, errorHandler);
215 },
216 params);
217}
218
219void ProtocolGen::notifyLogMessage(const LogMessageParams &params)
220{
221 typedRpc()->sendNotification(method: Notifications::LogMessageMethod, params);
222}
223
224void ProtocolGen::requestWorkDoneProgressCreate(const WorkDoneProgressCreateParams &params,
225 std::function<void()> responseHandler,
226 ResponseErrorHandler errorHandler)
227{
228 typedRpc()->sendRequest(
229 method: QByteArray(Requests::WorkDoneProgressCreateMethod),
230 handler: [responseHandler = std::move(responseHandler),
231 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
232 if (response.errorCode.isDouble())
233 errorHandler(ResponseError { .code: response.errorCode.toInt(),
234 .message: response.errorMessage.toUtf8(), .data: response.data });
235 else
236 decodeAndCall<std::nullptr_t>(value: response.data, funct: responseHandler, errorHandler);
237 },
238 params);
239}
240
241void ProtocolGen::notifyWorkDoneProgressCancel(const WorkDoneProgressCancelParams &params)
242{
243 typedRpc()->sendNotification(method: Notifications::WorkDoneProgressCancelMethod, params);
244}
245
246void ProtocolGen::notifyTelemetryEvent(const QJsonObject &params)
247{
248 typedRpc()->sendNotification(method: Notifications::TelemetryEventMethod, params);
249}
250
251void ProtocolGen::requestRegistration(const RegistrationParams &params,
252 std::function<void()> responseHandler,
253 ResponseErrorHandler errorHandler)
254{
255 typedRpc()->sendRequest(
256 method: QByteArray(Requests::RegistrationMethod),
257 handler: [responseHandler = std::move(responseHandler),
258 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
259 if (response.errorCode.isDouble())
260 errorHandler(ResponseError { .code: response.errorCode.toInt(),
261 .message: response.errorMessage.toUtf8(), .data: response.data });
262 else
263 decodeAndCall<std::nullptr_t>(value: response.data, funct: responseHandler, errorHandler);
264 },
265 params);
266}
267
268void ProtocolGen::requestUnregistration(const UnregistrationParams &params,
269 std::function<void()> responseHandler,
270 ResponseErrorHandler errorHandler)
271{
272 typedRpc()->sendRequest(
273 method: QByteArray(Requests::UnregistrationMethod),
274 handler: [responseHandler = std::move(responseHandler),
275 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
276 if (response.errorCode.isDouble())
277 errorHandler(ResponseError { .code: response.errorCode.toInt(),
278 .message: response.errorMessage.toUtf8(), .data: response.data });
279 else
280 decodeAndCall<std::nullptr_t>(value: response.data, funct: responseHandler, errorHandler);
281 },
282 params);
283}
284
285void ProtocolGen::requestWorkspaceWorkspaceFolders(
286 const std::nullptr_t &params,
287 std::function<void(const std::variant<QList<WorkspaceFolder>, std::nullptr_t> &)>
288 responseHandler,
289 ResponseErrorHandler errorHandler)
290{
291 typedRpc()->sendRequest(
292 method: QByteArray(Requests::WorkspaceWorkspaceFoldersMethod),
293 handler: [responseHandler = std::move(responseHandler),
294 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
295 if (response.errorCode.isDouble())
296 errorHandler(ResponseError { .code: response.errorCode.toInt(),
297 .message: response.errorMessage.toUtf8(), .data: response.data });
298 else
299 decodeAndCall<std::variant<QList<WorkspaceFolder>, std::nullptr_t>>(
300 value: response.data, funct: responseHandler, errorHandler);
301 },
302 params);
303}
304
305void ProtocolGen::notifyDidChangeWorkspaceFolders(const DidChangeWorkspaceFoldersParams &params)
306{
307 typedRpc()->sendNotification(method: Notifications::DidChangeWorkspaceFoldersMethod, params);
308}
309
310void ProtocolGen::notifyDidChangeConfiguration(const DidChangeConfigurationParams &params)
311{
312 typedRpc()->sendNotification(method: Notifications::DidChangeConfigurationMethod, params);
313}
314
315void ProtocolGen::requestConfiguration(
316 const ConfigurationParams &params,
317 std::function<void(const QList<QJsonValue> &)> responseHandler,
318 ResponseErrorHandler errorHandler)
319{
320 typedRpc()->sendRequest(
321 method: QByteArray(Requests::ConfigurationMethod),
322 handler: [responseHandler = std::move(responseHandler),
323 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
324 if (response.errorCode.isDouble())
325 errorHandler(ResponseError { .code: response.errorCode.toInt(),
326 .message: response.errorMessage.toUtf8(), .data: response.data });
327 else
328 decodeAndCall<QList<QJsonValue>>(value: response.data, funct: responseHandler, errorHandler);
329 },
330 params);
331}
332
333void ProtocolGen::notifyDidChangeWatchedFiles(const DidChangeWatchedFilesParams &params)
334{
335 typedRpc()->sendNotification(method: Notifications::DidChangeWatchedFilesMethod, params);
336}
337
338void ProtocolGen::requestWorkspaceSymbol(
339 const WorkspaceSymbolParams &params,
340 std::function<void(const std::variant<QList<SymbolInformation>, std::nullptr_t> &)>
341 responseHandler,
342 ResponseErrorHandler errorHandler)
343{
344 typedRpc()->sendRequest(
345 method: QByteArray(Requests::WorkspaceSymbolMethod),
346 handler: [responseHandler = std::move(responseHandler),
347 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
348 if (response.errorCode.isDouble())
349 errorHandler(ResponseError { .code: response.errorCode.toInt(),
350 .message: response.errorMessage.toUtf8(), .data: response.data });
351 else
352 decodeAndCall<std::variant<QList<SymbolInformation>, std::nullptr_t>>(
353 value: response.data, funct: responseHandler, errorHandler);
354 },
355 params);
356}
357
358void ProtocolGen::requestExecuteCommand(
359 const ExecuteCommandParams &params,
360 std::function<void(const std::variant<QJsonValue, std::nullptr_t> &)> responseHandler,
361 ResponseErrorHandler errorHandler)
362{
363 typedRpc()->sendRequest(
364 method: QByteArray(Requests::ExecuteCommandMethod),
365 handler: [responseHandler = std::move(responseHandler),
366 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
367 if (response.errorCode.isDouble())
368 errorHandler(ResponseError { .code: response.errorCode.toInt(),
369 .message: response.errorMessage.toUtf8(), .data: response.data });
370 else
371 decodeAndCall<std::variant<QJsonValue, std::nullptr_t>>(
372 value: response.data, funct: responseHandler, errorHandler);
373 },
374 params);
375}
376
377void ProtocolGen::requestApplyWorkspaceEdit(
378 const ApplyWorkspaceEditParams &params,
379 std::function<void(const ApplyWorkspaceEditResponse &)> responseHandler,
380 ResponseErrorHandler errorHandler)
381{
382 typedRpc()->sendRequest(
383 method: QByteArray(Requests::ApplyWorkspaceEditMethod),
384 handler: [responseHandler = std::move(responseHandler),
385 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
386 if (response.errorCode.isDouble())
387 errorHandler(ResponseError { .code: response.errorCode.toInt(),
388 .message: response.errorMessage.toUtf8(), .data: response.data });
389 else
390 decodeAndCall<ApplyWorkspaceEditResponse>(value: response.data, funct: responseHandler,
391 errorHandler);
392 },
393 params);
394}
395
396void ProtocolGen::requestCreateFiles(
397 const CreateFilesParams &params,
398 std::function<void(const std::variant<WorkspaceEdit, std::nullptr_t> &)> responseHandler,
399 ResponseErrorHandler errorHandler)
400{
401 typedRpc()->sendRequest(
402 method: QByteArray(Requests::CreateFilesMethod),
403 handler: [responseHandler = std::move(responseHandler),
404 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
405 if (response.errorCode.isDouble())
406 errorHandler(ResponseError { .code: response.errorCode.toInt(),
407 .message: response.errorMessage.toUtf8(), .data: response.data });
408 else
409 decodeAndCall<std::variant<WorkspaceEdit, std::nullptr_t>>(
410 value: response.data, funct: responseHandler, errorHandler);
411 },
412 params);
413}
414
415void ProtocolGen::notifyCreateFiles(const CreateFilesParams &params)
416{
417 typedRpc()->sendNotification(method: Notifications::CreateFilesMethod, params);
418}
419
420void ProtocolGen::requestRenameFiles(
421 const RenameFilesParams &params,
422 std::function<void(const std::variant<WorkspaceEdit, std::nullptr_t> &)> responseHandler,
423 ResponseErrorHandler errorHandler)
424{
425 typedRpc()->sendRequest(
426 method: QByteArray(Requests::RenameFilesMethod),
427 handler: [responseHandler = std::move(responseHandler),
428 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
429 if (response.errorCode.isDouble())
430 errorHandler(ResponseError { .code: response.errorCode.toInt(),
431 .message: response.errorMessage.toUtf8(), .data: response.data });
432 else
433 decodeAndCall<std::variant<WorkspaceEdit, std::nullptr_t>>(
434 value: response.data, funct: responseHandler, errorHandler);
435 },
436 params);
437}
438
439void ProtocolGen::notifyRenameFiles(const RenameFilesParams &params)
440{
441 typedRpc()->sendNotification(method: Notifications::RenameFilesMethod, params);
442}
443
444void ProtocolGen::requestDeleteFiles(
445 const DeleteFilesParams &params,
446 std::function<void(const std::variant<WorkspaceEdit, std::nullptr_t> &)> responseHandler,
447 ResponseErrorHandler errorHandler)
448{
449 typedRpc()->sendRequest(
450 method: QByteArray(Requests::DeleteFilesMethod),
451 handler: [responseHandler = std::move(responseHandler),
452 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
453 if (response.errorCode.isDouble())
454 errorHandler(ResponseError { .code: response.errorCode.toInt(),
455 .message: response.errorMessage.toUtf8(), .data: response.data });
456 else
457 decodeAndCall<std::variant<WorkspaceEdit, std::nullptr_t>>(
458 value: response.data, funct: responseHandler, errorHandler);
459 },
460 params);
461}
462
463void ProtocolGen::notifyDeleteFiles(const DeleteFilesParams &params)
464{
465 typedRpc()->sendNotification(method: Notifications::DeleteFilesMethod, params);
466}
467
468void ProtocolGen::notifyDidOpenTextDocument(const DidOpenTextDocumentParams &params)
469{
470 typedRpc()->sendNotification(method: Notifications::DidOpenTextDocumentMethod, params);
471}
472
473void ProtocolGen::notifyDidChangeTextDocument(const DidChangeTextDocumentParams &params)
474{
475 typedRpc()->sendNotification(method: Notifications::DidChangeTextDocumentMethod, params);
476}
477
478void ProtocolGen::notifyWillSaveTextDocument(const WillSaveTextDocumentParams &params)
479{
480 typedRpc()->sendNotification(method: Notifications::WillSaveTextDocumentMethod, params);
481}
482
483void ProtocolGen::requestWillSaveTextDocument(
484 const WillSaveTextDocumentParams &params,
485 std::function<void(const std::variant<QList<TextEdit>, std::nullptr_t> &)> responseHandler,
486 ResponseErrorHandler errorHandler)
487{
488 typedRpc()->sendRequest(
489 method: QByteArray(Requests::WillSaveTextDocumentMethod),
490 handler: [responseHandler = std::move(responseHandler),
491 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
492 if (response.errorCode.isDouble())
493 errorHandler(ResponseError { .code: response.errorCode.toInt(),
494 .message: response.errorMessage.toUtf8(), .data: response.data });
495 else
496 decodeAndCall<std::variant<QList<TextEdit>, std::nullptr_t>>(
497 value: response.data, funct: responseHandler, errorHandler);
498 },
499 params);
500}
501
502void ProtocolGen::notifyDidSaveTextDocument(const DidSaveTextDocumentParams &params)
503{
504 typedRpc()->sendNotification(method: Notifications::DidSaveTextDocumentMethod, params);
505}
506
507void ProtocolGen::notifyDidCloseTextDocument(const DidCloseTextDocumentParams &params)
508{
509 typedRpc()->sendNotification(method: Notifications::DidCloseTextDocumentMethod, params);
510}
511
512void ProtocolGen::notifyPublishDiagnostics(const PublishDiagnosticsParams &params)
513{
514 typedRpc()->sendNotification(method: Notifications::PublishDiagnosticsMethod, params);
515}
516
517void ProtocolGen::requestCompletion(
518 const CompletionParams &params,
519 std::function<
520 void(const std::variant<QList<CompletionItem>, CompletionList, std::nullptr_t> &)>
521 responseHandler,
522 ResponseErrorHandler errorHandler)
523{
524 typedRpc()->sendRequest(
525 method: QByteArray(Requests::CompletionMethod),
526 handler: [responseHandler = std::move(responseHandler),
527 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
528 if (response.errorCode.isDouble())
529 errorHandler(ResponseError { .code: response.errorCode.toInt(),
530 .message: response.errorMessage.toUtf8(), .data: response.data });
531 else
532 decodeAndCall<
533 std::variant<QList<CompletionItem>, CompletionList, std::nullptr_t>>(
534 value: response.data, funct: responseHandler, errorHandler);
535 },
536 params);
537}
538
539void ProtocolGen::requestCompletionItemResolve(
540 const CompletionItem &params, std::function<void(const CompletionItem &)> responseHandler,
541 ResponseErrorHandler errorHandler)
542{
543 typedRpc()->sendRequest(
544 method: QByteArray(Requests::CompletionItemResolveMethod),
545 handler: [responseHandler = std::move(responseHandler),
546 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
547 if (response.errorCode.isDouble())
548 errorHandler(ResponseError { .code: response.errorCode.toInt(),
549 .message: response.errorMessage.toUtf8(), .data: response.data });
550 else
551 decodeAndCall<CompletionItem>(value: response.data, funct: responseHandler, errorHandler);
552 },
553 params);
554}
555
556void ProtocolGen::requestHover(
557 const HoverParams &params,
558 std::function<void(const std::variant<Hover, std::nullptr_t> &)> responseHandler,
559 ResponseErrorHandler errorHandler)
560{
561 typedRpc()->sendRequest(
562 method: QByteArray(Requests::HoverMethod),
563 handler: [responseHandler = std::move(responseHandler),
564 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
565 if (response.errorCode.isDouble())
566 errorHandler(ResponseError { .code: response.errorCode.toInt(),
567 .message: response.errorMessage.toUtf8(), .data: response.data });
568 else
569 decodeAndCall<std::variant<Hover, std::nullptr_t>>(
570 value: response.data, funct: responseHandler, errorHandler);
571 },
572 params);
573}
574
575void ProtocolGen::requestSignatureHelp(
576 const SignatureHelpParams &params,
577 std::function<void(const std::variant<SignatureHelp, std::nullptr_t> &)> responseHandler,
578 ResponseErrorHandler errorHandler)
579{
580 typedRpc()->sendRequest(
581 method: QByteArray(Requests::SignatureHelpMethod),
582 handler: [responseHandler = std::move(responseHandler),
583 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
584 if (response.errorCode.isDouble())
585 errorHandler(ResponseError { .code: response.errorCode.toInt(),
586 .message: response.errorMessage.toUtf8(), .data: response.data });
587 else
588 decodeAndCall<std::variant<SignatureHelp, std::nullptr_t>>(
589 value: response.data, funct: responseHandler, errorHandler);
590 },
591 params);
592}
593
594void ProtocolGen::requestDeclaration(
595 const DeclarationParams &params,
596 std::function<void(const std::variant<Location, QList<Location>, QList<LocationLink>,
597 std::nullptr_t> &)>
598 responseHandler,
599 ResponseErrorHandler errorHandler)
600{
601 typedRpc()->sendRequest(
602 method: QByteArray(Requests::DeclarationMethod),
603 handler: [responseHandler = std::move(responseHandler),
604 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
605 if (response.errorCode.isDouble())
606 errorHandler(ResponseError { .code: response.errorCode.toInt(),
607 .message: response.errorMessage.toUtf8(), .data: response.data });
608 else
609 decodeAndCall<std::variant<Location, QList<Location>, QList<LocationLink>,
610 std::nullptr_t>>(value: response.data, funct: responseHandler,
611 errorHandler);
612 },
613 params);
614}
615
616void ProtocolGen::requestDefinition(
617 const DefinitionParams &params,
618 std::function<void(const std::variant<Location, QList<Location>, QList<LocationLink>,
619 std::nullptr_t> &)>
620 responseHandler,
621 ResponseErrorHandler errorHandler)
622{
623 typedRpc()->sendRequest(
624 method: QByteArray(Requests::DefinitionMethod),
625 handler: [responseHandler = std::move(responseHandler),
626 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
627 if (response.errorCode.isDouble())
628 errorHandler(ResponseError { .code: response.errorCode.toInt(),
629 .message: response.errorMessage.toUtf8(), .data: response.data });
630 else
631 decodeAndCall<std::variant<Location, QList<Location>, QList<LocationLink>,
632 std::nullptr_t>>(value: response.data, funct: responseHandler,
633 errorHandler);
634 },
635 params);
636}
637
638void ProtocolGen::requestTypeDefinition(
639 const TypeDefinitionParams &params,
640 std::function<void(const std::variant<Location, QList<Location>, QList<LocationLink>,
641 std::nullptr_t> &)>
642 responseHandler,
643 ResponseErrorHandler errorHandler)
644{
645 typedRpc()->sendRequest(
646 method: QByteArray(Requests::TypeDefinitionMethod),
647 handler: [responseHandler = std::move(responseHandler),
648 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
649 if (response.errorCode.isDouble())
650 errorHandler(ResponseError { .code: response.errorCode.toInt(),
651 .message: response.errorMessage.toUtf8(), .data: response.data });
652 else
653 decodeAndCall<std::variant<Location, QList<Location>, QList<LocationLink>,
654 std::nullptr_t>>(value: response.data, funct: responseHandler,
655 errorHandler);
656 },
657 params);
658}
659
660void ProtocolGen::requestImplementation(
661 const ImplementationParams &params,
662 std::function<void(const std::variant<Location, QList<Location>, QList<LocationLink>,
663 std::nullptr_t> &)>
664 responseHandler,
665 ResponseErrorHandler errorHandler)
666{
667 typedRpc()->sendRequest(
668 method: QByteArray(Requests::ImplementationMethod),
669 handler: [responseHandler = std::move(responseHandler),
670 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
671 if (response.errorCode.isDouble())
672 errorHandler(ResponseError { .code: response.errorCode.toInt(),
673 .message: response.errorMessage.toUtf8(), .data: response.data });
674 else
675 decodeAndCall<std::variant<Location, QList<Location>, QList<LocationLink>,
676 std::nullptr_t>>(value: response.data, funct: responseHandler,
677 errorHandler);
678 },
679 params);
680}
681
682void ProtocolGen::requestReference(
683 const ReferenceParams &params,
684 std::function<void(const std::variant<QList<Location>, std::nullptr_t> &)> responseHandler,
685 ResponseErrorHandler errorHandler)
686{
687 typedRpc()->sendRequest(
688 method: QByteArray(Requests::ReferenceMethod),
689 handler: [responseHandler = std::move(responseHandler),
690 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
691 if (response.errorCode.isDouble())
692 errorHandler(ResponseError { .code: response.errorCode.toInt(),
693 .message: response.errorMessage.toUtf8(), .data: response.data });
694 else
695 decodeAndCall<std::variant<QList<Location>, std::nullptr_t>>(
696 value: response.data, funct: responseHandler, errorHandler);
697 },
698 params);
699}
700
701void ProtocolGen::requestDocumentHighlight(
702 const DocumentHighlightParams &params,
703 std::function<void(const std::variant<QList<DocumentHighlight>, std::nullptr_t> &)>
704 responseHandler,
705 ResponseErrorHandler errorHandler)
706{
707 typedRpc()->sendRequest(
708 method: QByteArray(Requests::DocumentHighlightMethod),
709 handler: [responseHandler = std::move(responseHandler),
710 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
711 if (response.errorCode.isDouble())
712 errorHandler(ResponseError { .code: response.errorCode.toInt(),
713 .message: response.errorMessage.toUtf8(), .data: response.data });
714 else
715 decodeAndCall<std::variant<QList<DocumentHighlight>, std::nullptr_t>>(
716 value: response.data, funct: responseHandler, errorHandler);
717 },
718 params);
719}
720
721void ProtocolGen::requestDocumentSymbol(
722 const DocumentSymbolParams &params,
723 std::function<void(const std::variant<QList<DocumentSymbol>, QList<SymbolInformation>,
724 std::nullptr_t> &)>
725 responseHandler,
726 ResponseErrorHandler errorHandler)
727{
728 typedRpc()->sendRequest(
729 method: QByteArray(Requests::DocumentSymbolMethod),
730 handler: [responseHandler = std::move(responseHandler),
731 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
732 if (response.errorCode.isDouble())
733 errorHandler(ResponseError { .code: response.errorCode.toInt(),
734 .message: response.errorMessage.toUtf8(), .data: response.data });
735 else
736 decodeAndCall<std::variant<QList<DocumentSymbol>, QList<SymbolInformation>,
737 std::nullptr_t>>(value: response.data, funct: responseHandler,
738 errorHandler);
739 },
740 params);
741}
742
743void ProtocolGen::requestCodeAction(
744 const CodeActionParams &params,
745 std::function<void(
746 const std::variant<QList<std::variant<Command, CodeAction>>, std::nullptr_t> &)>
747 responseHandler,
748 ResponseErrorHandler errorHandler)
749{
750 typedRpc()->sendRequest(
751 method: QByteArray(Requests::CodeActionMethod),
752 handler: [responseHandler = std::move(responseHandler),
753 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
754 if (response.errorCode.isDouble())
755 errorHandler(ResponseError { .code: response.errorCode.toInt(),
756 .message: response.errorMessage.toUtf8(), .data: response.data });
757 else
758 decodeAndCall<
759 std::variant<QList<std::variant<Command, CodeAction>>, std::nullptr_t>>(
760 value: response.data, funct: responseHandler, errorHandler);
761 },
762 params);
763}
764
765void ProtocolGen::requestCodeActionResolve(const CodeAction &params,
766 std::function<void(const CodeAction &)> responseHandler,
767 ResponseErrorHandler errorHandler)
768{
769 typedRpc()->sendRequest(
770 method: QByteArray(Requests::CodeActionResolveMethod),
771 handler: [responseHandler = std::move(responseHandler),
772 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
773 if (response.errorCode.isDouble())
774 errorHandler(ResponseError { .code: response.errorCode.toInt(),
775 .message: response.errorMessage.toUtf8(), .data: response.data });
776 else
777 decodeAndCall<CodeAction>(value: response.data, funct: responseHandler, errorHandler);
778 },
779 params);
780}
781
782void ProtocolGen::requestCodeLens(
783 const CodeLensParams &params,
784 std::function<void(const std::variant<QList<CodeLens>, std::nullptr_t> &)> responseHandler,
785 ResponseErrorHandler errorHandler)
786{
787 typedRpc()->sendRequest(
788 method: QByteArray(Requests::CodeLensMethod),
789 handler: [responseHandler = std::move(responseHandler),
790 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
791 if (response.errorCode.isDouble())
792 errorHandler(ResponseError { .code: response.errorCode.toInt(),
793 .message: response.errorMessage.toUtf8(), .data: response.data });
794 else
795 decodeAndCall<std::variant<QList<CodeLens>, std::nullptr_t>>(
796 value: response.data, funct: responseHandler, errorHandler);
797 },
798 params);
799}
800
801void ProtocolGen::requestCodeLensResolve(const CodeLens &params,
802 std::function<void(const CodeLens &)> responseHandler,
803 ResponseErrorHandler errorHandler)
804{
805 typedRpc()->sendRequest(
806 method: QByteArray(Requests::CodeLensResolveMethod),
807 handler: [responseHandler = std::move(responseHandler),
808 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
809 if (response.errorCode.isDouble())
810 errorHandler(ResponseError { .code: response.errorCode.toInt(),
811 .message: response.errorMessage.toUtf8(), .data: response.data });
812 else
813 decodeAndCall<CodeLens>(value: response.data, funct: responseHandler, errorHandler);
814 },
815 params);
816}
817
818void ProtocolGen::requestCodeLensRefresh(const std::nullptr_t &params,
819 std::function<void()> responseHandler,
820 ResponseErrorHandler errorHandler)
821{
822 typedRpc()->sendRequest(
823 method: QByteArray(Requests::CodeLensRefreshMethod),
824 handler: [responseHandler = std::move(responseHandler),
825 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
826 if (response.errorCode.isDouble())
827 errorHandler(ResponseError { .code: response.errorCode.toInt(),
828 .message: response.errorMessage.toUtf8(), .data: response.data });
829 else
830 decodeAndCall<std::nullptr_t>(value: response.data, funct: responseHandler, errorHandler);
831 },
832 params);
833}
834
835void ProtocolGen::requestDocumentLink(
836 const DocumentLinkParams &params,
837 std::function<void(const std::variant<QList<DocumentLink>, std::nullptr_t> &)>
838 responseHandler,
839 ResponseErrorHandler errorHandler)
840{
841 typedRpc()->sendRequest(
842 method: QByteArray(Requests::DocumentLinkMethod),
843 handler: [responseHandler = std::move(responseHandler),
844 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
845 if (response.errorCode.isDouble())
846 errorHandler(ResponseError { .code: response.errorCode.toInt(),
847 .message: response.errorMessage.toUtf8(), .data: response.data });
848 else
849 decodeAndCall<std::variant<QList<DocumentLink>, std::nullptr_t>>(
850 value: response.data, funct: responseHandler, errorHandler);
851 },
852 params);
853}
854
855void ProtocolGen::requestDocumentLinkResolve(
856 const DocumentLink &params, std::function<void(const DocumentLink &)> responseHandler,
857 ResponseErrorHandler errorHandler)
858{
859 typedRpc()->sendRequest(
860 method: QByteArray(Requests::DocumentLinkResolveMethod),
861 handler: [responseHandler = std::move(responseHandler),
862 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
863 if (response.errorCode.isDouble())
864 errorHandler(ResponseError { .code: response.errorCode.toInt(),
865 .message: response.errorMessage.toUtf8(), .data: response.data });
866 else
867 decodeAndCall<DocumentLink>(value: response.data, funct: responseHandler, errorHandler);
868 },
869 params);
870}
871
872void ProtocolGen::requestDocumentColor(
873 const DocumentColorParams &params,
874 std::function<void(const QList<ColorInformation> &)> responseHandler,
875 ResponseErrorHandler errorHandler)
876{
877 typedRpc()->sendRequest(
878 method: QByteArray(Requests::DocumentColorMethod),
879 handler: [responseHandler = std::move(responseHandler),
880 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
881 if (response.errorCode.isDouble())
882 errorHandler(ResponseError { .code: response.errorCode.toInt(),
883 .message: response.errorMessage.toUtf8(), .data: response.data });
884 else
885 decodeAndCall<QList<ColorInformation>>(value: response.data, funct: responseHandler,
886 errorHandler);
887 },
888 params);
889}
890
891void ProtocolGen::requestColorPresentation(
892 const ColorPresentationParams &params,
893 std::function<void(const QList<ColorPresentation> &)> responseHandler,
894 ResponseErrorHandler errorHandler)
895{
896 typedRpc()->sendRequest(
897 method: QByteArray(Requests::ColorPresentationMethod),
898 handler: [responseHandler = std::move(responseHandler),
899 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
900 if (response.errorCode.isDouble())
901 errorHandler(ResponseError { .code: response.errorCode.toInt(),
902 .message: response.errorMessage.toUtf8(), .data: response.data });
903 else
904 decodeAndCall<QList<ColorPresentation>>(value: response.data, funct: responseHandler,
905 errorHandler);
906 },
907 params);
908}
909
910void ProtocolGen::requestDocumentFormatting(
911 const DocumentFormattingParams &params,
912 std::function<void(const std::variant<QList<TextEdit>, std::nullptr_t> &)> responseHandler,
913 ResponseErrorHandler errorHandler)
914{
915 typedRpc()->sendRequest(
916 method: QByteArray(Requests::DocumentFormattingMethod),
917 handler: [responseHandler = std::move(responseHandler),
918 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
919 if (response.errorCode.isDouble())
920 errorHandler(ResponseError { .code: response.errorCode.toInt(),
921 .message: response.errorMessage.toUtf8(), .data: response.data });
922 else
923 decodeAndCall<std::variant<QList<TextEdit>, std::nullptr_t>>(
924 value: response.data, funct: responseHandler, errorHandler);
925 },
926 params);
927}
928
929void ProtocolGen::requestDocumentRangeFormatting(
930 const DocumentRangeFormattingParams &params,
931 std::function<void(const std::variant<QList<TextEdit>, std::nullptr_t> &)> responseHandler,
932 ResponseErrorHandler errorHandler)
933{
934 typedRpc()->sendRequest(
935 method: QByteArray(Requests::DocumentRangeFormattingMethod),
936 handler: [responseHandler = std::move(responseHandler),
937 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
938 if (response.errorCode.isDouble())
939 errorHandler(ResponseError { .code: response.errorCode.toInt(),
940 .message: response.errorMessage.toUtf8(), .data: response.data });
941 else
942 decodeAndCall<std::variant<QList<TextEdit>, std::nullptr_t>>(
943 value: response.data, funct: responseHandler, errorHandler);
944 },
945 params);
946}
947
948void ProtocolGen::requestDocumentOnTypeFormatting(
949 const DocumentOnTypeFormattingParams &params,
950 std::function<void(const std::variant<QList<TextEdit>, std::nullptr_t> &)> responseHandler,
951 ResponseErrorHandler errorHandler)
952{
953 typedRpc()->sendRequest(
954 method: QByteArray(Requests::DocumentOnTypeFormattingMethod),
955 handler: [responseHandler = std::move(responseHandler),
956 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
957 if (response.errorCode.isDouble())
958 errorHandler(ResponseError { .code: response.errorCode.toInt(),
959 .message: response.errorMessage.toUtf8(), .data: response.data });
960 else
961 decodeAndCall<std::variant<QList<TextEdit>, std::nullptr_t>>(
962 value: response.data, funct: responseHandler, errorHandler);
963 },
964 params);
965}
966
967void ProtocolGen::requestRename(
968 const RenameParams &params,
969 std::function<void(const std::variant<WorkspaceEdit, std::nullptr_t> &)> responseHandler,
970 ResponseErrorHandler errorHandler)
971{
972 typedRpc()->sendRequest(
973 method: QByteArray(Requests::RenameMethod),
974 handler: [responseHandler = std::move(responseHandler),
975 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
976 if (response.errorCode.isDouble())
977 errorHandler(ResponseError { .code: response.errorCode.toInt(),
978 .message: response.errorMessage.toUtf8(), .data: response.data });
979 else
980 decodeAndCall<std::variant<WorkspaceEdit, std::nullptr_t>>(
981 value: response.data, funct: responseHandler, errorHandler);
982 },
983 params);
984}
985
986void ProtocolGen::requestPrepareRename(
987 const PrepareRenameParams &params,
988 std::function<void(const std::variant<Range, RangePlaceHolder, DefaultBehaviorStruct,
989 std::nullptr_t> &)>
990 responseHandler,
991 ResponseErrorHandler errorHandler)
992{
993 typedRpc()->sendRequest(
994 method: QByteArray(Requests::PrepareRenameMethod),
995 handler: [responseHandler = std::move(responseHandler),
996 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
997 if (response.errorCode.isDouble())
998 errorHandler(ResponseError { .code: response.errorCode.toInt(),
999 .message: response.errorMessage.toUtf8(), .data: response.data });
1000 else
1001 decodeAndCall<std::variant<Range, RangePlaceHolder, DefaultBehaviorStruct,
1002 std::nullptr_t>>(value: response.data, funct: responseHandler,
1003 errorHandler);
1004 },
1005 params);
1006}
1007
1008void ProtocolGen::requestFoldingRange(
1009 const FoldingRangeParams &params,
1010 std::function<void(const std::variant<QList<FoldingRange>, std::nullptr_t> &)>
1011 responseHandler,
1012 ResponseErrorHandler errorHandler)
1013{
1014 typedRpc()->sendRequest(
1015 method: QByteArray(Requests::FoldingRangeMethod),
1016 handler: [responseHandler = std::move(responseHandler),
1017 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1018 if (response.errorCode.isDouble())
1019 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1020 .message: response.errorMessage.toUtf8(), .data: response.data });
1021 else
1022 decodeAndCall<std::variant<QList<FoldingRange>, std::nullptr_t>>(
1023 value: response.data, funct: responseHandler, errorHandler);
1024 },
1025 params);
1026}
1027
1028void ProtocolGen::requestSelectionRange(
1029 const SelectionRangeParams &params,
1030 std::function<void(const std::variant<QList<SelectionRange>, std::nullptr_t> &)>
1031 responseHandler,
1032 ResponseErrorHandler errorHandler)
1033{
1034 typedRpc()->sendRequest(
1035 method: QByteArray(Requests::SelectionRangeMethod),
1036 handler: [responseHandler = std::move(responseHandler),
1037 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1038 if (response.errorCode.isDouble())
1039 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1040 .message: response.errorMessage.toUtf8(), .data: response.data });
1041 else
1042 decodeAndCall<std::variant<QList<SelectionRange>, std::nullptr_t>>(
1043 value: response.data, funct: responseHandler, errorHandler);
1044 },
1045 params);
1046}
1047
1048void ProtocolGen::requestCallHierarchyPrepare(
1049 const CallHierarchyPrepareParams &params,
1050 std::function<void(const std::variant<QList<CallHierarchyItem>, std::nullptr_t> &)>
1051 responseHandler,
1052 ResponseErrorHandler errorHandler)
1053{
1054 typedRpc()->sendRequest(
1055 method: QByteArray(Requests::CallHierarchyPrepareMethod),
1056 handler: [responseHandler = std::move(responseHandler),
1057 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1058 if (response.errorCode.isDouble())
1059 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1060 .message: response.errorMessage.toUtf8(), .data: response.data });
1061 else
1062 decodeAndCall<std::variant<QList<CallHierarchyItem>, std::nullptr_t>>(
1063 value: response.data, funct: responseHandler, errorHandler);
1064 },
1065 params);
1066}
1067
1068void ProtocolGen::requestCallHierarchyIncomingCalls(
1069 const CallHierarchyIncomingCallsParams &params,
1070 std::function<void(const std::variant<QList<CallHierarchyIncomingCall>, std::nullptr_t> &)>
1071 responseHandler,
1072 ResponseErrorHandler errorHandler)
1073{
1074 typedRpc()->sendRequest(
1075 method: QByteArray(Requests::CallHierarchyIncomingCallsMethod),
1076 handler: [responseHandler = std::move(responseHandler),
1077 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1078 if (response.errorCode.isDouble())
1079 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1080 .message: response.errorMessage.toUtf8(), .data: response.data });
1081 else
1082 decodeAndCall<std::variant<QList<CallHierarchyIncomingCall>, std::nullptr_t>>(
1083 value: response.data, funct: responseHandler, errorHandler);
1084 },
1085 params);
1086}
1087
1088void ProtocolGen::requestCallHierarchyOutgoingCalls(
1089 const CallHierarchyOutgoingCallsParams &params,
1090 std::function<void(const std::variant<QList<CallHierarchyOutgoingCall>, std::nullptr_t> &)>
1091 responseHandler,
1092 ResponseErrorHandler errorHandler)
1093{
1094 typedRpc()->sendRequest(
1095 method: QByteArray(Requests::CallHierarchyOutgoingCallsMethod),
1096 handler: [responseHandler = std::move(responseHandler),
1097 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1098 if (response.errorCode.isDouble())
1099 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1100 .message: response.errorMessage.toUtf8(), .data: response.data });
1101 else
1102 decodeAndCall<std::variant<QList<CallHierarchyOutgoingCall>, std::nullptr_t>>(
1103 value: response.data, funct: responseHandler, errorHandler);
1104 },
1105 params);
1106}
1107
1108void ProtocolGen::requestSemanticTokens(
1109 const SemanticTokensParams &params,
1110 std::function<void(const std::variant<SemanticTokens, std::nullptr_t> &)> responseHandler,
1111 ResponseErrorHandler errorHandler)
1112{
1113 typedRpc()->sendRequest(
1114 method: QByteArray(Requests::SemanticTokensMethod),
1115 handler: [responseHandler = std::move(responseHandler),
1116 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1117 if (response.errorCode.isDouble())
1118 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1119 .message: response.errorMessage.toUtf8(), .data: response.data });
1120 else
1121 decodeAndCall<std::variant<SemanticTokens, std::nullptr_t>>(
1122 value: response.data, funct: responseHandler, errorHandler);
1123 },
1124 params);
1125}
1126
1127void ProtocolGen::requestSemanticTokensDelta(
1128 const SemanticTokensDeltaParams &params,
1129 std::function<
1130 void(const std::variant<SemanticTokens, SemanticTokensDelta, std::nullptr_t> &)>
1131 responseHandler,
1132 ResponseErrorHandler errorHandler)
1133{
1134 typedRpc()->sendRequest(
1135 method: QByteArray(Requests::SemanticTokensDeltaMethod),
1136 handler: [responseHandler = std::move(responseHandler),
1137 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1138 if (response.errorCode.isDouble())
1139 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1140 .message: response.errorMessage.toUtf8(), .data: response.data });
1141 else
1142 decodeAndCall<
1143 std::variant<SemanticTokens, SemanticTokensDelta, std::nullptr_t>>(
1144 value: response.data, funct: responseHandler, errorHandler);
1145 },
1146 params);
1147}
1148
1149void ProtocolGen::requestSemanticTokensRange(
1150 const SemanticTokensRangeParams &params,
1151 std::function<void(const std::variant<SemanticTokens, std::nullptr_t> &)> responseHandler,
1152 ResponseErrorHandler errorHandler)
1153{
1154 typedRpc()->sendRequest(
1155 method: QByteArray(Requests::SemanticTokensRangeMethod),
1156 handler: [responseHandler = std::move(responseHandler),
1157 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1158 if (response.errorCode.isDouble())
1159 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1160 .message: response.errorMessage.toUtf8(), .data: response.data });
1161 else
1162 decodeAndCall<std::variant<SemanticTokens, std::nullptr_t>>(
1163 value: response.data, funct: responseHandler, errorHandler);
1164 },
1165 params);
1166}
1167
1168void ProtocolGen::requestRequestingARefreshOfAllSemanticTokens(
1169 const std::nullptr_t &params, std::function<void()> responseHandler,
1170 ResponseErrorHandler errorHandler)
1171{
1172 typedRpc()->sendRequest(
1173 method: QByteArray(Requests::RequestingARefreshOfAllSemanticTokensMethod),
1174 handler: [responseHandler = std::move(responseHandler),
1175 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1176 if (response.errorCode.isDouble())
1177 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1178 .message: response.errorMessage.toUtf8(), .data: response.data });
1179 else
1180 decodeAndCall<std::nullptr_t>(value: response.data, funct: responseHandler, errorHandler);
1181 },
1182 params);
1183}
1184
1185void ProtocolGen::requestLinkedEditingRange(
1186 const LinkedEditingRangeParams &params,
1187 std::function<void(const std::variant<LinkedEditingRanges, std::nullptr_t> &)>
1188 responseHandler,
1189 ResponseErrorHandler errorHandler)
1190{
1191 typedRpc()->sendRequest(
1192 method: QByteArray(Requests::LinkedEditingRangeMethod),
1193 handler: [responseHandler = std::move(responseHandler),
1194 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1195 if (response.errorCode.isDouble())
1196 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1197 .message: response.errorMessage.toUtf8(), .data: response.data });
1198 else
1199 decodeAndCall<std::variant<LinkedEditingRanges, std::nullptr_t>>(
1200 value: response.data, funct: responseHandler, errorHandler);
1201 },
1202 params);
1203}
1204
1205void ProtocolGen::requestMoniker(
1206 const MonikerParams &params,
1207 std::function<void(const std::variant<QList<Moniker>, std::nullptr_t> &)> responseHandler,
1208 ResponseErrorHandler errorHandler)
1209{
1210 typedRpc()->sendRequest(
1211 method: QByteArray(Requests::MonikerMethod),
1212 handler: [responseHandler = std::move(responseHandler),
1213 errorHandler = std::move(errorHandler)](const QJsonRpcProtocol::Response &response) {
1214 if (response.errorCode.isDouble())
1215 errorHandler(ResponseError { .code: response.errorCode.toInt(),
1216 .message: response.errorMessage.toUtf8(), .data: response.data });
1217 else
1218 decodeAndCall<std::variant<QList<Moniker>, std::nullptr_t>>(
1219 value: response.data, funct: responseHandler, errorHandler);
1220 },
1221 params);
1222}
1223
1224void ProtocolGen::registerCancelNotificationHandler(
1225 const std::function<void(const QByteArray &, const CancelParams &)> &handler)
1226{
1227 typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::CancelParamsType>(
1228 method: QByteArray(QLspSpecification::Notifications::CancelMethod), handler);
1229}
1230
1231void ProtocolGen::registerInitializeRequestHandler(
1232 const std::function<void(const QByteArray &, const InitializeParams &,
1233 LSPResponse<InitializeResult> &&)> &handler)
1234{
1235 typedRpc()
1236 ->registerRequestHandler<QLspSpecification::Requests::InitializeParamsType,
1237 QLspSpecification::Responses::InitializeResponseType>(
1238 method: QByteArray(QLspSpecification::Requests::InitializeMethod), handler);
1239}
1240
1241void ProtocolGen::registerInitializedNotificationHandler(
1242 const std::function<void(const QByteArray &, const InitializedParams &)> &handler)
1243{
1244 typedRpc()
1245 ->registerNotificationHandler<QLspSpecification::Notifications::InitializedParamsType>(
1246 method: QByteArray(QLspSpecification::Notifications::InitializedMethod), handler);
1247}
1248
1249void ProtocolGen::registerShutdownRequestHandler(
1250 const std::function<void(const QByteArray &, const std::nullptr_t &,
1251 LSPResponse<std::nullptr_t> &&)> &handler)
1252{
1253 typedRpc()
1254 ->registerRequestHandler<QLspSpecification::Requests::ShutdownParamsType,
1255 QLspSpecification::Responses::ShutdownResponseType>(
1256 method: QByteArray(QLspSpecification::Requests::ShutdownMethod), handler);
1257}
1258
1259void ProtocolGen::registerExitNotificationHandler(
1260 const std::function<void(const QByteArray &, const std::nullptr_t &)> &handler)
1261{
1262 typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::ExitParamsType>(
1263 method: QByteArray(QLspSpecification::Notifications::ExitMethod), handler);
1264}
1265
1266void ProtocolGen::registerLogTraceNotificationHandler(
1267 const std::function<void(const QByteArray &, const LogTraceParams &)> &handler)
1268{
1269 typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::LogTraceParamsType>(
1270 method: QByteArray(QLspSpecification::Notifications::LogTraceMethod), handler);
1271}
1272
1273void ProtocolGen::registerSetTraceNotificationHandler(
1274 const std::function<void(const QByteArray &, const SetTraceParams &)> &handler)
1275{
1276 typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::SetTraceParamsType>(
1277 method: QByteArray(QLspSpecification::Notifications::SetTraceMethod), handler);
1278}
1279
1280void ProtocolGen::registerShowMessageNotificationHandler(
1281 const std::function<void(const QByteArray &, const ShowMessageParams &)> &handler)
1282{
1283 typedRpc()
1284 ->registerNotificationHandler<QLspSpecification::Notifications::ShowMessageParamsType>(
1285 method: QByteArray(QLspSpecification::Notifications::ShowMessageMethod), handler);
1286}
1287
1288void ProtocolGen::registerShowMessageRequestRequestHandler(
1289 const std::function<void(const QByteArray &, const ShowMessageRequestParams &,
1290 LSPResponse<std::variant<MessageActionItem, std::nullptr_t>> &&)>
1291 &handler)
1292{
1293 typedRpc()
1294 ->registerRequestHandler<QLspSpecification::Requests::ShowMessageRequestParamsType,
1295 QLspSpecification::Responses::ShowMessageRequestResponseType>(
1296 method: QByteArray(QLspSpecification::Requests::ShowMessageRequestMethod), handler);
1297}
1298
1299void ProtocolGen::registerShowDocumentRequestHandler(
1300 const std::function<void(const QByteArray &, const ShowDocumentParams &,
1301 LSPResponse<ShowDocumentResult> &&)> &handler)
1302{
1303 typedRpc()
1304 ->registerRequestHandler<QLspSpecification::Requests::ShowDocumentParamsType,
1305 QLspSpecification::Responses::ShowDocumentResponseType>(
1306 method: QByteArray(QLspSpecification::Requests::ShowDocumentMethod), handler);
1307}
1308
1309void ProtocolGen::registerLogMessageNotificationHandler(
1310 const std::function<void(const QByteArray &, const LogMessageParams &)> &handler)
1311{
1312 typedRpc()->registerNotificationHandler<QLspSpecification::Notifications::LogMessageParamsType>(
1313 method: QByteArray(QLspSpecification::Notifications::LogMessageMethod), handler);
1314}
1315
1316void ProtocolGen::registerWorkDoneProgressCreateRequestHandler(
1317 const std::function<void(const QByteArray &, const WorkDoneProgressCreateParams &,
1318 LSPResponse<std::nullptr_t> &&)> &handler)
1319{
1320 typedRpc()
1321 ->registerRequestHandler<
1322 QLspSpecification::Requests::WorkDoneProgressCreateParamsType,
1323 QLspSpecification::Responses::WorkDoneProgressCreateResponseType>(
1324 method: QByteArray(QLspSpecification::Requests::WorkDoneProgressCreateMethod), handler);
1325}
1326
1327void ProtocolGen::registerWorkDoneProgressCancelNotificationHandler(
1328 const std::function<void(const QByteArray &, const WorkDoneProgressCancelParams &)>
1329 &handler)
1330{
1331 typedRpc()
1332 ->registerNotificationHandler<
1333 QLspSpecification::Notifications::WorkDoneProgressCancelParamsType>(
1334 method: QByteArray(QLspSpecification::Notifications::WorkDoneProgressCancelMethod),
1335 handler);
1336}
1337
1338void ProtocolGen::registerTelemetryEventNotificationHandler(
1339 const std::function<void(const QByteArray &, const QJsonObject &)> &handler)
1340{
1341 typedRpc()
1342 ->registerNotificationHandler<
1343 QLspSpecification::Notifications::TelemetryEventParamsType>(
1344 method: QByteArray(QLspSpecification::Notifications::TelemetryEventMethod), handler);
1345}
1346
1347void ProtocolGen::registerRegistrationRequestHandler(
1348 const std::function<void(const QByteArray &, const RegistrationParams &,
1349 LSPResponse<std::nullptr_t> &&)> &handler)
1350{
1351 typedRpc()
1352 ->registerRequestHandler<QLspSpecification::Requests::RegistrationParamsType,
1353 QLspSpecification::Responses::RegistrationResponseType>(
1354 method: QByteArray(QLspSpecification::Requests::RegistrationMethod), handler);
1355}
1356
1357void ProtocolGen::registerUnregistrationRequestHandler(
1358 const std::function<void(const QByteArray &, const UnregistrationParams &,
1359 LSPResponse<std::nullptr_t> &&)> &handler)
1360{
1361 typedRpc()
1362 ->registerRequestHandler<QLspSpecification::Requests::UnregistrationParamsType,
1363 QLspSpecification::Responses::UnregistrationResponseType>(
1364 method: QByteArray(QLspSpecification::Requests::UnregistrationMethod), handler);
1365}
1366
1367void ProtocolGen::registerWorkspaceWorkspaceFoldersRequestHandler(
1368 const std::function<void(
1369 const QByteArray &, const std::nullptr_t &,
1370 LSPResponse<std::variant<QList<WorkspaceFolder>, std::nullptr_t>> &&)> &handler)
1371{
1372 typedRpc()
1373 ->registerRequestHandler<
1374 QLspSpecification::Requests::WorkspaceWorkspaceFoldersParamsType,
1375 QLspSpecification::Responses::WorkspaceWorkspaceFoldersResponseType>(
1376 method: QByteArray(QLspSpecification::Requests::WorkspaceWorkspaceFoldersMethod),
1377 handler);
1378}
1379
1380void ProtocolGen::registerDidChangeWorkspaceFoldersNotificationHandler(
1381 const std::function<void(const QByteArray &, const DidChangeWorkspaceFoldersParams &)>
1382 &handler)
1383{
1384 typedRpc()
1385 ->registerNotificationHandler<
1386 QLspSpecification::Notifications::DidChangeWorkspaceFoldersParamsType>(
1387 method: QByteArray(QLspSpecification::Notifications::DidChangeWorkspaceFoldersMethod),
1388 handler);
1389}
1390
1391void ProtocolGen::registerDidChangeConfigurationNotificationHandler(
1392 const std::function<void(const QByteArray &, const DidChangeConfigurationParams &)>
1393 &handler)
1394{
1395 typedRpc()
1396 ->registerNotificationHandler<
1397 QLspSpecification::Notifications::DidChangeConfigurationParamsType>(
1398 method: QByteArray(QLspSpecification::Notifications::DidChangeConfigurationMethod),
1399 handler);
1400}
1401
1402void ProtocolGen::registerConfigurationRequestHandler(
1403 const std::function<void(const QByteArray &, const ConfigurationParams &,
1404 LSPResponse<QList<QJsonValue>> &&)> &handler)
1405{
1406 typedRpc()
1407 ->registerRequestHandler<QLspSpecification::Requests::ConfigurationParamsType,
1408 QLspSpecification::Responses::ConfigurationResponseType>(
1409 method: QByteArray(QLspSpecification::Requests::ConfigurationMethod), handler);
1410}
1411
1412void ProtocolGen::registerDidChangeWatchedFilesNotificationHandler(
1413 const std::function<void(const QByteArray &, const DidChangeWatchedFilesParams &)> &handler)
1414{
1415 typedRpc()
1416 ->registerNotificationHandler<
1417 QLspSpecification::Notifications::DidChangeWatchedFilesParamsType>(
1418 method: QByteArray(QLspSpecification::Notifications::DidChangeWatchedFilesMethod),
1419 handler);
1420}
1421
1422void ProtocolGen::registerWorkspaceSymbolRequestHandler(
1423 const std::function<
1424 void(const QByteArray &, const WorkspaceSymbolParams &,
1425 LSPPartialResponse<std::variant<QList<SymbolInformation>, std::nullptr_t>,
1426 QList<SymbolInformation>> &&)> &handler)
1427{
1428 typedRpc()
1429 ->registerRequestHandler<QLspSpecification::Requests::WorkspaceSymbolParamsType,
1430 QLspSpecification::Responses::WorkspaceSymbolResponseType>(
1431 method: QByteArray(QLspSpecification::Requests::WorkspaceSymbolMethod), handler);
1432}
1433
1434void ProtocolGen::registerExecuteCommandRequestHandler(
1435 const std::function<void(const QByteArray &, const ExecuteCommandParams &,
1436 LSPResponse<std::variant<QJsonValue, std::nullptr_t>> &&)>
1437 &handler)
1438{
1439 typedRpc()
1440 ->registerRequestHandler<QLspSpecification::Requests::ExecuteCommandParamsType,
1441 QLspSpecification::Responses::ExecuteCommandResponseType>(
1442 method: QByteArray(QLspSpecification::Requests::ExecuteCommandMethod), handler);
1443}
1444
1445void ProtocolGen::registerApplyWorkspaceEditRequestHandler(
1446 const std::function<void(const QByteArray &, const ApplyWorkspaceEditParams &,
1447 LSPResponse<ApplyWorkspaceEditResponse> &&)> &handler)
1448{
1449 typedRpc()
1450 ->registerRequestHandler<QLspSpecification::Requests::ApplyWorkspaceEditParamsType,
1451 QLspSpecification::Responses::ApplyWorkspaceEditResponseType>(
1452 method: QByteArray(QLspSpecification::Requests::ApplyWorkspaceEditMethod), handler);
1453}
1454
1455void ProtocolGen::registerCreateFilesRequestHandler(
1456 const std::function<void(const QByteArray &, const CreateFilesParams &,
1457 LSPResponse<std::variant<WorkspaceEdit, std::nullptr_t>> &&)>
1458 &handler)
1459{
1460 typedRpc()
1461 ->registerRequestHandler<QLspSpecification::Requests::CreateFilesParamsType,
1462 QLspSpecification::Responses::CreateFilesResponseType>(
1463 method: QByteArray(QLspSpecification::Requests::CreateFilesMethod), handler);
1464}
1465
1466void ProtocolGen::registerCreateFilesNotificationHandler(
1467 const std::function<void(const QByteArray &, const CreateFilesParams &)> &handler)
1468{
1469 typedRpc()
1470 ->registerNotificationHandler<QLspSpecification::Notifications::CreateFilesParamsType>(
1471 method: QByteArray(QLspSpecification::Notifications::CreateFilesMethod), handler);
1472}
1473
1474void ProtocolGen::registerRenameFilesRequestHandler(
1475 const std::function<void(const QByteArray &, const RenameFilesParams &,
1476 LSPResponse<std::variant<WorkspaceEdit, std::nullptr_t>> &&)>
1477 &handler)
1478{
1479 typedRpc()
1480 ->registerRequestHandler<QLspSpecification::Requests::RenameFilesParamsType,
1481 QLspSpecification::Responses::RenameFilesResponseType>(
1482 method: QByteArray(QLspSpecification::Requests::RenameFilesMethod), handler);
1483}
1484
1485void ProtocolGen::registerRenameFilesNotificationHandler(
1486 const std::function<void(const QByteArray &, const RenameFilesParams &)> &handler)
1487{
1488 typedRpc()
1489 ->registerNotificationHandler<QLspSpecification::Notifications::RenameFilesParamsType>(
1490 method: QByteArray(QLspSpecification::Notifications::RenameFilesMethod), handler);
1491}
1492
1493void ProtocolGen::registerDeleteFilesRequestHandler(
1494 const std::function<void(const QByteArray &, const DeleteFilesParams &,
1495 LSPResponse<std::variant<WorkspaceEdit, std::nullptr_t>> &&)>
1496 &handler)
1497{
1498 typedRpc()
1499 ->registerRequestHandler<QLspSpecification::Requests::DeleteFilesParamsType,
1500 QLspSpecification::Responses::DeleteFilesResponseType>(
1501 method: QByteArray(QLspSpecification::Requests::DeleteFilesMethod), handler);
1502}
1503
1504void ProtocolGen::registerDeleteFilesNotificationHandler(
1505 const std::function<void(const QByteArray &, const DeleteFilesParams &)> &handler)
1506{
1507 typedRpc()
1508 ->registerNotificationHandler<QLspSpecification::Notifications::DeleteFilesParamsType>(
1509 method: QByteArray(QLspSpecification::Notifications::DeleteFilesMethod), handler);
1510}
1511
1512void ProtocolGen::registerDidOpenTextDocumentNotificationHandler(
1513 const std::function<void(const QByteArray &, const DidOpenTextDocumentParams &)> &handler)
1514{
1515 typedRpc()
1516 ->registerNotificationHandler<
1517 QLspSpecification::Notifications::DidOpenTextDocumentParamsType>(
1518 method: QByteArray(QLspSpecification::Notifications::DidOpenTextDocumentMethod),
1519 handler);
1520}
1521
1522void ProtocolGen::registerDidChangeTextDocumentNotificationHandler(
1523 const std::function<void(const QByteArray &, const DidChangeTextDocumentParams &)> &handler)
1524{
1525 typedRpc()
1526 ->registerNotificationHandler<
1527 QLspSpecification::Notifications::DidChangeTextDocumentParamsType>(
1528 method: QByteArray(QLspSpecification::Notifications::DidChangeTextDocumentMethod),
1529 handler);
1530}
1531
1532void ProtocolGen::registerWillSaveTextDocumentNotificationHandler(
1533 const std::function<void(const QByteArray &, const WillSaveTextDocumentParams &)> &handler)
1534{
1535 typedRpc()
1536 ->registerNotificationHandler<
1537 QLspSpecification::Notifications::WillSaveTextDocumentParamsType>(
1538 method: QByteArray(QLspSpecification::Notifications::WillSaveTextDocumentMethod),
1539 handler);
1540}
1541
1542void ProtocolGen::registerWillSaveTextDocumentRequestHandler(
1543 const std::function<void(const QByteArray &, const WillSaveTextDocumentParams &,
1544 LSPResponse<std::variant<QList<TextEdit>, std::nullptr_t>> &&)>
1545 &handler)
1546{
1547 typedRpc()
1548 ->registerRequestHandler<
1549 QLspSpecification::Requests::WillSaveTextDocumentParamsType,
1550 QLspSpecification::Responses::WillSaveTextDocumentResponseType>(
1551 method: QByteArray(QLspSpecification::Requests::WillSaveTextDocumentMethod), handler);
1552}
1553
1554void ProtocolGen::registerDidSaveTextDocumentNotificationHandler(
1555 const std::function<void(const QByteArray &, const DidSaveTextDocumentParams &)> &handler)
1556{
1557 typedRpc()
1558 ->registerNotificationHandler<
1559 QLspSpecification::Notifications::DidSaveTextDocumentParamsType>(
1560 method: QByteArray(QLspSpecification::Notifications::DidSaveTextDocumentMethod),
1561 handler);
1562}
1563
1564void ProtocolGen::registerDidCloseTextDocumentNotificationHandler(
1565 const std::function<void(const QByteArray &, const DidCloseTextDocumentParams &)> &handler)
1566{
1567 typedRpc()
1568 ->registerNotificationHandler<
1569 QLspSpecification::Notifications::DidCloseTextDocumentParamsType>(
1570 method: QByteArray(QLspSpecification::Notifications::DidCloseTextDocumentMethod),
1571 handler);
1572}
1573
1574void ProtocolGen::registerPublishDiagnosticsNotificationHandler(
1575 const std::function<void(const QByteArray &, const PublishDiagnosticsParams &)> &handler)
1576{
1577 typedRpc()
1578 ->registerNotificationHandler<
1579 QLspSpecification::Notifications::PublishDiagnosticsParamsType>(
1580 method: QByteArray(QLspSpecification::Notifications::PublishDiagnosticsMethod),
1581 handler);
1582}
1583
1584void ProtocolGen::registerCompletionRequestHandler(
1585 const std::function<
1586 void(const QByteArray &, const CompletionParams &,
1587 LSPPartialResponse<
1588 std::variant<QList<CompletionItem>, CompletionList, std::nullptr_t>,
1589 std::variant<CompletionList, QList<CompletionItem>>> &&)> &handler)
1590{
1591 typedRpc()
1592 ->registerRequestHandler<QLspSpecification::Requests::CompletionParamsType,
1593 QLspSpecification::Responses::CompletionResponseType>(
1594 method: QByteArray(QLspSpecification::Requests::CompletionMethod), handler);
1595}
1596
1597void ProtocolGen::registerCompletionItemResolveRequestHandler(
1598 const std::function<void(const QByteArray &, const CompletionItem &,
1599 LSPResponse<CompletionItem> &&)> &handler)
1600{
1601 typedRpc()
1602 ->registerRequestHandler<
1603 QLspSpecification::Requests::CompletionItemResolveParamsType,
1604 QLspSpecification::Responses::CompletionItemResolveResponseType>(
1605 method: QByteArray(QLspSpecification::Requests::CompletionItemResolveMethod), handler);
1606}
1607
1608void ProtocolGen::registerHoverRequestHandler(
1609 const std::function<void(const QByteArray &, const HoverParams &,
1610 LSPResponse<std::variant<Hover, std::nullptr_t>> &&)> &handler)
1611{
1612 typedRpc()
1613 ->registerRequestHandler<QLspSpecification::Requests::HoverParamsType,
1614 QLspSpecification::Responses::HoverResponseType>(
1615 method: QByteArray(QLspSpecification::Requests::HoverMethod), handler);
1616}
1617
1618void ProtocolGen::registerSignatureHelpRequestHandler(
1619 const std::function<void(const QByteArray &, const SignatureHelpParams &,
1620 LSPResponse<std::variant<SignatureHelp, std::nullptr_t>> &&)>
1621 &handler)
1622{
1623 typedRpc()
1624 ->registerRequestHandler<QLspSpecification::Requests::SignatureHelpParamsType,
1625 QLspSpecification::Responses::SignatureHelpResponseType>(
1626 method: QByteArray(QLspSpecification::Requests::SignatureHelpMethod), handler);
1627}
1628
1629void ProtocolGen::registerDeclarationRequestHandler(
1630 const std::function<
1631 void(const QByteArray &, const DeclarationParams &,
1632 LSPPartialResponse<std::variant<Location, QList<Location>, QList<LocationLink>,
1633 std::nullptr_t>,
1634 std::variant<QList<Location>, QList<LocationLink>>> &&)>
1635 &handler)
1636{
1637 typedRpc()
1638 ->registerRequestHandler<QLspSpecification::Requests::DeclarationParamsType,
1639 QLspSpecification::Responses::DeclarationResponseType>(
1640 method: QByteArray(QLspSpecification::Requests::DeclarationMethod), handler);
1641}
1642
1643void ProtocolGen::registerDefinitionRequestHandler(
1644 const std::function<
1645 void(const QByteArray &, const DefinitionParams &,
1646 LSPPartialResponse<std::variant<Location, QList<Location>, QList<LocationLink>,
1647 std::nullptr_t>,
1648 std::variant<QList<Location>, QList<LocationLink>>> &&)>
1649 &handler)
1650{
1651 typedRpc()
1652 ->registerRequestHandler<QLspSpecification::Requests::DefinitionParamsType,
1653 QLspSpecification::Responses::DefinitionResponseType>(
1654 method: QByteArray(QLspSpecification::Requests::DefinitionMethod), handler);
1655}
1656
1657void ProtocolGen::registerTypeDefinitionRequestHandler(
1658 const std::function<
1659 void(const QByteArray &, const TypeDefinitionParams &,
1660 LSPPartialResponse<std::variant<Location, QList<Location>, QList<LocationLink>,
1661 std::nullptr_t>,
1662 std::variant<QList<Location>, QList<LocationLink>>> &&)>
1663 &handler)
1664{
1665 typedRpc()
1666 ->registerRequestHandler<QLspSpecification::Requests::TypeDefinitionParamsType,
1667 QLspSpecification::Responses::TypeDefinitionResponseType>(
1668 method: QByteArray(QLspSpecification::Requests::TypeDefinitionMethod), handler);
1669}
1670
1671void ProtocolGen::registerImplementationRequestHandler(
1672 const std::function<
1673 void(const QByteArray &, const ImplementationParams &,
1674 LSPPartialResponse<std::variant<Location, QList<Location>, QList<LocationLink>,
1675 std::nullptr_t>,
1676 std::variant<QList<Location>, QList<LocationLink>>> &&)>
1677 &handler)
1678{
1679 typedRpc()
1680 ->registerRequestHandler<QLspSpecification::Requests::ImplementationParamsType,
1681 QLspSpecification::Responses::ImplementationResponseType>(
1682 method: QByteArray(QLspSpecification::Requests::ImplementationMethod), handler);
1683}
1684
1685void ProtocolGen::registerReferenceRequestHandler(
1686 const std::function<void(const QByteArray &, const ReferenceParams &,
1687 LSPPartialResponse<std::variant<QList<Location>, std::nullptr_t>,
1688 QList<Location>> &&)> &handler)
1689{
1690 typedRpc()
1691 ->registerRequestHandler<QLspSpecification::Requests::ReferenceParamsType,
1692 QLspSpecification::Responses::ReferenceResponseType>(
1693 method: QByteArray(QLspSpecification::Requests::ReferenceMethod), handler);
1694}
1695
1696void ProtocolGen::registerDocumentHighlightRequestHandler(
1697 const std::function<
1698 void(const QByteArray &, const DocumentHighlightParams &,
1699 LSPPartialResponse<std::variant<QList<DocumentHighlight>, std::nullptr_t>,
1700 QList<DocumentHighlight>> &&)> &handler)
1701{
1702 typedRpc()
1703 ->registerRequestHandler<QLspSpecification::Requests::DocumentHighlightParamsType,
1704 QLspSpecification::Responses::DocumentHighlightResponseType>(
1705 method: QByteArray(QLspSpecification::Requests::DocumentHighlightMethod), handler);
1706}
1707
1708void ProtocolGen::registerDocumentSymbolRequestHandler(
1709 const std::function<void(
1710 const QByteArray &, const DocumentSymbolParams &,
1711 LSPPartialResponse<std::variant<QList<DocumentSymbol>, QList<SymbolInformation>,
1712 std::nullptr_t>,
1713 std::variant<QList<DocumentSymbol>, QList<SymbolInformation>>>
1714 &&)> &handler)
1715{
1716 typedRpc()
1717 ->registerRequestHandler<QLspSpecification::Requests::DocumentSymbolParamsType,
1718 QLspSpecification::Responses::DocumentSymbolResponseType>(
1719 method: QByteArray(QLspSpecification::Requests::DocumentSymbolMethod), handler);
1720}
1721
1722void ProtocolGen::registerCodeActionRequestHandler(
1723 const std::function<
1724 void(const QByteArray &, const CodeActionParams &,
1725 LSPPartialResponse<
1726 std::variant<QList<std::variant<Command, CodeAction>>, std::nullptr_t>,
1727 QList<std::variant<Command, CodeAction>>> &&)> &handler)
1728{
1729 typedRpc()
1730 ->registerRequestHandler<QLspSpecification::Requests::CodeActionParamsType,
1731 QLspSpecification::Responses::CodeActionResponseType>(
1732 method: QByteArray(QLspSpecification::Requests::CodeActionMethod), handler);
1733}
1734
1735void ProtocolGen::registerCodeActionResolveRequestHandler(
1736 const std::function<void(const QByteArray &, const CodeAction &,
1737 LSPResponse<CodeAction> &&)> &handler)
1738{
1739 typedRpc()
1740 ->registerRequestHandler<QLspSpecification::Requests::CodeActionResolveParamsType,
1741 QLspSpecification::Responses::CodeActionResolveResponseType>(
1742 method: QByteArray(QLspSpecification::Requests::CodeActionResolveMethod), handler);
1743}
1744
1745void ProtocolGen::registerCodeLensRequestHandler(
1746 const std::function<void(const QByteArray &, const CodeLensParams &,
1747 LSPPartialResponse<std::variant<QList<CodeLens>, std::nullptr_t>,
1748 QList<CodeLens>> &&)> &handler)
1749{
1750 typedRpc()
1751 ->registerRequestHandler<QLspSpecification::Requests::CodeLensParamsType,
1752 QLspSpecification::Responses::CodeLensResponseType>(
1753 method: QByteArray(QLspSpecification::Requests::CodeLensMethod), handler);
1754}
1755
1756void ProtocolGen::registerCodeLensResolveRequestHandler(
1757 const std::function<void(const QByteArray &, const CodeLens &, LSPResponse<CodeLens> &&)>
1758 &handler)
1759{
1760 typedRpc()
1761 ->registerRequestHandler<QLspSpecification::Requests::CodeLensResolveParamsType,
1762 QLspSpecification::Responses::CodeLensResolveResponseType>(
1763 method: QByteArray(QLspSpecification::Requests::CodeLensResolveMethod), handler);
1764}
1765
1766void ProtocolGen::registerCodeLensRefreshRequestHandler(
1767 const std::function<void(const QByteArray &, const std::nullptr_t &,
1768 LSPResponse<std::nullptr_t> &&)> &handler)
1769{
1770 typedRpc()
1771 ->registerRequestHandler<QLspSpecification::Requests::CodeLensRefreshParamsType,
1772 QLspSpecification::Responses::CodeLensRefreshResponseType>(
1773 method: QByteArray(QLspSpecification::Requests::CodeLensRefreshMethod), handler);
1774}
1775
1776void ProtocolGen::registerDocumentLinkRequestHandler(
1777 const std::function<
1778 void(const QByteArray &, const DocumentLinkParams &,
1779 LSPPartialResponse<std::variant<QList<DocumentLink>, std::nullptr_t>,
1780 QList<DocumentLink>> &&)> &handler)
1781{
1782 typedRpc()
1783 ->registerRequestHandler<QLspSpecification::Requests::DocumentLinkParamsType,
1784 QLspSpecification::Responses::DocumentLinkResponseType>(
1785 method: QByteArray(QLspSpecification::Requests::DocumentLinkMethod), handler);
1786}
1787
1788void ProtocolGen::registerDocumentLinkResolveRequestHandler(
1789 const std::function<void(const QByteArray &, const DocumentLink &,
1790 LSPResponse<DocumentLink> &&)> &handler)
1791{
1792 typedRpc()
1793 ->registerRequestHandler<QLspSpecification::Requests::DocumentLinkResolveParamsType,
1794 QLspSpecification::Responses::DocumentLinkResolveResponseType>(
1795 method: QByteArray(QLspSpecification::Requests::DocumentLinkResolveMethod), handler);
1796}
1797
1798void ProtocolGen::registerDocumentColorRequestHandler(
1799 const std::function<void(
1800 const QByteArray &, const DocumentColorParams &,
1801 LSPPartialResponse<QList<ColorInformation>, QList<ColorInformation>> &&)> &handler)
1802{
1803 typedRpc()
1804 ->registerRequestHandler<QLspSpecification::Requests::DocumentColorParamsType,
1805 QLspSpecification::Responses::DocumentColorResponseType>(
1806 method: QByteArray(QLspSpecification::Requests::DocumentColorMethod), handler);
1807}
1808
1809void ProtocolGen::registerColorPresentationRequestHandler(
1810 const std::function<void(const QByteArray &, const ColorPresentationParams &,
1811 LSPPartialResponse<QList<ColorPresentation>,
1812 QList<ColorPresentation>> &&)> &handler)
1813{
1814 typedRpc()
1815 ->registerRequestHandler<QLspSpecification::Requests::ColorPresentationParamsType,
1816 QLspSpecification::Responses::ColorPresentationResponseType>(
1817 method: QByteArray(QLspSpecification::Requests::ColorPresentationMethod), handler);
1818}
1819
1820void ProtocolGen::registerDocumentFormattingRequestHandler(
1821 const std::function<void(const QByteArray &, const DocumentFormattingParams &,
1822 LSPResponse<std::variant<QList<TextEdit>, std::nullptr_t>> &&)>
1823 &handler)
1824{
1825 typedRpc()
1826 ->registerRequestHandler<QLspSpecification::Requests::DocumentFormattingParamsType,
1827 QLspSpecification::Responses::DocumentFormattingResponseType>(
1828 method: QByteArray(QLspSpecification::Requests::DocumentFormattingMethod), handler);
1829}
1830
1831void ProtocolGen::registerDocumentRangeFormattingRequestHandler(
1832 const std::function<void(const QByteArray &, const DocumentRangeFormattingParams &,
1833 LSPResponse<std::variant<QList<TextEdit>, std::nullptr_t>> &&)>
1834 &handler)
1835{
1836 typedRpc()
1837 ->registerRequestHandler<
1838 QLspSpecification::Requests::DocumentRangeFormattingParamsType,
1839 QLspSpecification::Responses::DocumentRangeFormattingResponseType>(
1840 method: QByteArray(QLspSpecification::Requests::DocumentRangeFormattingMethod),
1841 handler);
1842}
1843
1844void ProtocolGen::registerDocumentOnTypeFormattingRequestHandler(
1845 const std::function<void(const QByteArray &, const DocumentOnTypeFormattingParams &,
1846 LSPResponse<std::variant<QList<TextEdit>, std::nullptr_t>> &&)>
1847 &handler)
1848{
1849 typedRpc()
1850 ->registerRequestHandler<
1851 QLspSpecification::Requests::DocumentOnTypeFormattingParamsType,
1852 QLspSpecification::Responses::DocumentOnTypeFormattingResponseType>(
1853 method: QByteArray(QLspSpecification::Requests::DocumentOnTypeFormattingMethod),
1854 handler);
1855}
1856
1857void ProtocolGen::registerRenameRequestHandler(
1858 const std::function<void(const QByteArray &, const RenameParams &,
1859 LSPResponse<std::variant<WorkspaceEdit, std::nullptr_t>> &&)>
1860 &handler)
1861{
1862 typedRpc()
1863 ->registerRequestHandler<QLspSpecification::Requests::RenameParamsType,
1864 QLspSpecification::Responses::RenameResponseType>(
1865 method: QByteArray(QLspSpecification::Requests::RenameMethod), handler);
1866}
1867
1868void ProtocolGen::registerPrepareRenameRequestHandler(
1869 const std::function<
1870 void(const QByteArray &, const PrepareRenameParams &,
1871 LSPResponse<std::variant<Range, RangePlaceHolder, DefaultBehaviorStruct,
1872 std::nullptr_t>> &&)> &handler)
1873{
1874 typedRpc()
1875 ->registerRequestHandler<QLspSpecification::Requests::PrepareRenameParamsType,
1876 QLspSpecification::Responses::PrepareRenameResponseType>(
1877 method: QByteArray(QLspSpecification::Requests::PrepareRenameMethod), handler);
1878}
1879
1880void ProtocolGen::registerFoldingRangeRequestHandler(
1881 const std::function<
1882 void(const QByteArray &, const FoldingRangeParams &,
1883 LSPPartialResponse<std::variant<QList<FoldingRange>, std::nullptr_t>,
1884 QList<FoldingRange>> &&)> &handler)
1885{
1886 typedRpc()
1887 ->registerRequestHandler<QLspSpecification::Requests::FoldingRangeParamsType,
1888 QLspSpecification::Responses::FoldingRangeResponseType>(
1889 method: QByteArray(QLspSpecification::Requests::FoldingRangeMethod), handler);
1890}
1891
1892void ProtocolGen::registerSelectionRangeRequestHandler(
1893 const std::function<
1894 void(const QByteArray &, const SelectionRangeParams &,
1895 LSPPartialResponse<std::variant<QList<SelectionRange>, std::nullptr_t>,
1896 QList<SelectionRange>> &&)> &handler)
1897{
1898 typedRpc()
1899 ->registerRequestHandler<QLspSpecification::Requests::SelectionRangeParamsType,
1900 QLspSpecification::Responses::SelectionRangeResponseType>(
1901 method: QByteArray(QLspSpecification::Requests::SelectionRangeMethod), handler);
1902}
1903
1904void ProtocolGen::registerCallHierarchyPrepareRequestHandler(
1905 const std::function<void(
1906 const QByteArray &, const CallHierarchyPrepareParams &,
1907 LSPResponse<std::variant<QList<CallHierarchyItem>, std::nullptr_t>> &&)> &handler)
1908{
1909 typedRpc()
1910 ->registerRequestHandler<
1911 QLspSpecification::Requests::CallHierarchyPrepareParamsType,
1912 QLspSpecification::Responses::CallHierarchyPrepareResponseType>(
1913 method: QByteArray(QLspSpecification::Requests::CallHierarchyPrepareMethod), handler);
1914}
1915
1916void ProtocolGen::registerCallHierarchyIncomingCallsRequestHandler(
1917 const std::function<void(
1918 const QByteArray &, const CallHierarchyIncomingCallsParams &,
1919 LSPPartialResponse<std::variant<QList<CallHierarchyIncomingCall>, std::nullptr_t>,
1920 QList<CallHierarchyIncomingCall>> &&)> &handler)
1921{
1922 typedRpc()
1923 ->registerRequestHandler<
1924 QLspSpecification::Requests::CallHierarchyIncomingCallsParamsType,
1925 QLspSpecification::Responses::CallHierarchyIncomingCallsResponseType>(
1926 method: QByteArray(QLspSpecification::Requests::CallHierarchyIncomingCallsMethod),
1927 handler);
1928}
1929
1930void ProtocolGen::registerCallHierarchyOutgoingCallsRequestHandler(
1931 const std::function<void(
1932 const QByteArray &, const CallHierarchyOutgoingCallsParams &,
1933 LSPPartialResponse<std::variant<QList<CallHierarchyOutgoingCall>, std::nullptr_t>,
1934 QList<CallHierarchyOutgoingCall>> &&)> &handler)
1935{
1936 typedRpc()
1937 ->registerRequestHandler<
1938 QLspSpecification::Requests::CallHierarchyOutgoingCallsParamsType,
1939 QLspSpecification::Responses::CallHierarchyOutgoingCallsResponseType>(
1940 method: QByteArray(QLspSpecification::Requests::CallHierarchyOutgoingCallsMethod),
1941 handler);
1942}
1943
1944void ProtocolGen::registerSemanticTokensRequestHandler(
1945 const std::function<void(const QByteArray &, const SemanticTokensParams &,
1946 LSPPartialResponse<std::variant<SemanticTokens, std::nullptr_t>,
1947 SemanticTokensPartialResult> &&)> &handler)
1948{
1949 typedRpc()
1950 ->registerRequestHandler<QLspSpecification::Requests::SemanticTokensParamsType,
1951 QLspSpecification::Responses::SemanticTokensResponseType>(
1952 method: QByteArray(QLspSpecification::Requests::SemanticTokensMethod), handler);
1953}
1954
1955void ProtocolGen::registerSemanticTokensDeltaRequestHandler(
1956 const std::function<
1957 void(const QByteArray &, const SemanticTokensDeltaParams &,
1958 LSPPartialResponse<
1959 std::variant<SemanticTokens, SemanticTokensDelta, std::nullptr_t>,
1960 SemanticTokensDeltaPartialResult> &&)> &handler)
1961{
1962 typedRpc()
1963 ->registerRequestHandler<QLspSpecification::Requests::SemanticTokensDeltaParamsType,
1964 QLspSpecification::Responses::SemanticTokensDeltaResponseType>(
1965 method: QByteArray(QLspSpecification::Requests::SemanticTokensDeltaMethod), handler);
1966}
1967
1968void ProtocolGen::registerSemanticTokensRangeRequestHandler(
1969 const std::function<void(const QByteArray &, const SemanticTokensRangeParams &,
1970 LSPPartialResponse<std::variant<SemanticTokens, std::nullptr_t>,
1971 SemanticTokensPartialResult> &&)> &handler)
1972{
1973 typedRpc()
1974 ->registerRequestHandler<QLspSpecification::Requests::SemanticTokensRangeParamsType,
1975 QLspSpecification::Responses::SemanticTokensRangeResponseType>(
1976 method: QByteArray(QLspSpecification::Requests::SemanticTokensRangeMethod), handler);
1977}
1978
1979void ProtocolGen::registerRequestingARefreshOfAllSemanticTokensRequestHandler(
1980 const std::function<void(const QByteArray &, const std::nullptr_t &,
1981 LSPResponse<std::nullptr_t> &&)> &handler)
1982{
1983 typedRpc()
1984 ->registerRequestHandler<
1985 QLspSpecification::Requests::RequestingARefreshOfAllSemanticTokensParamsType,
1986 QLspSpecification::Responses::
1987 RequestingARefreshOfAllSemanticTokensResponseType>(
1988 method: QByteArray(QLspSpecification::Requests::
1989 RequestingARefreshOfAllSemanticTokensMethod),
1990 handler);
1991}
1992
1993void ProtocolGen::registerLinkedEditingRangeRequestHandler(
1994 const std::function<void(const QByteArray &, const LinkedEditingRangeParams &,
1995 LSPResponse<std::variant<LinkedEditingRanges, std::nullptr_t>> &&)>
1996 &handler)
1997{
1998 typedRpc()
1999 ->registerRequestHandler<QLspSpecification::Requests::LinkedEditingRangeParamsType,
2000 QLspSpecification::Responses::LinkedEditingRangeResponseType>(
2001 method: QByteArray(QLspSpecification::Requests::LinkedEditingRangeMethod), handler);
2002}
2003
2004void ProtocolGen::registerMonikerRequestHandler(
2005 const std::function<void(const QByteArray &, const MonikerParams &,
2006 LSPPartialResponse<std::variant<QList<Moniker>, std::nullptr_t>,
2007 QList<Moniker>> &&)> &handler)
2008{
2009 typedRpc()
2010 ->registerRequestHandler<QLspSpecification::Requests::MonikerParamsType,
2011 QLspSpecification::Responses::MonikerResponseType>(
2012 method: QByteArray(QLspSpecification::Requests::MonikerMethod), handler);
2013}
2014
2015} // namespace QLspSpecification
2016
2017QT_END_NAMESPACE
2018

source code of qtlanguageserver/src/languageserver/qlanguageservergen.cpp