| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #include "lifecyclemessage.h" |
| 6 | |
| 7 | namespace newlsp { |
| 8 | using namespace json; |
| 9 | std::string toJsonValueStr(const ResolveSupport &val) |
| 10 | { |
| 11 | std::string ret; |
| 12 | ret = json::addValue(ret, json::KV{"properties" , val.properties}); |
| 13 | return json::addScope(ret); |
| 14 | } |
| 15 | |
| 16 | std::string toJsonValueStr(const CompletionClientCapabilities::CompletionList &val) |
| 17 | { |
| 18 | std::string ret; |
| 19 | if (val.itemDefaults) |
| 20 | ret = json::addValue(ret, json::KV{"itemDefaults" , val.itemDefaults}); |
| 21 | return json::addScope(ret); |
| 22 | } |
| 23 | |
| 24 | std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItemKind &val) |
| 25 | { |
| 26 | std::string ret; |
| 27 | if (val.valueSet) |
| 28 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 29 | return json::addScope(ret); |
| 30 | } |
| 31 | |
| 32 | std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItem::TagSupport &val) |
| 33 | { |
| 34 | std::string ret; |
| 35 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 36 | return json::addScope(ret); |
| 37 | } |
| 38 | |
| 39 | std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItem &val) |
| 40 | { |
| 41 | std::string ret; |
| 42 | if (val.snippetSupport) |
| 43 | ret = json::addValue(ret, json::KV{"snippetSupport" , val.snippetSupport}); |
| 44 | |
| 45 | if (val.commitCharactersSupport) |
| 46 | ret = json::addValue(ret, json::KV{"commitCharactersSupport" , val.commitCharactersSupport}); |
| 47 | |
| 48 | if (val.documentationFormat) |
| 49 | ret = json::addValue(ret, json::KV{"documentationFormat" , val.documentationFormat}); |
| 50 | |
| 51 | if (val.deprecatedSupport) |
| 52 | ret = json::addValue(ret, json::KV{"deprecatedSupport" , val.deprecatedSupport}); |
| 53 | |
| 54 | if (val.preselectSupport) |
| 55 | ret = json::addValue(ret, json::KV{"preselectSupport" , val.preselectSupport}); |
| 56 | |
| 57 | if (val.tagSupport) |
| 58 | ret = json::addValue(ret, json::KV{"tagSupport" , val.tagSupport}); |
| 59 | |
| 60 | if (val.insertReplaceSupport) |
| 61 | ret = json::addValue(ret, json::KV{"insertReplaceSupport" , val.insertReplaceSupport}); |
| 62 | |
| 63 | if (val.resolveSupport) |
| 64 | ret = json::addValue(ret, json::KV{"resolveSupport" , val.resolveSupport}); |
| 65 | |
| 66 | if (val.insertTextModeSupport) |
| 67 | ret = json::addValue(ret, json::KV{"insertTextModeSupport" , val.insertTextModeSupport}); |
| 68 | |
| 69 | if (val.labelDetailsSupport) |
| 70 | ret = json::addValue(ret, json::KV{"labelDetailsSupport" , val.labelDetailsSupport}); |
| 71 | |
| 72 | return json::addScope(ret); |
| 73 | } |
| 74 | |
| 75 | std::string toJsonValueStr(const CodeActionLiteralSupport &val) |
| 76 | { |
| 77 | std::string ret; |
| 78 | ret = json::addValue(ret, json::KV{"codeActionKind" , val.codeActionKind}); |
| 79 | return json::addScope(ret); |
| 80 | } |
| 81 | |
| 82 | std::string toJsonValueStr(const SignatureHelpClientCapabilities::SignatureInformation::ParameterInformation &val) |
| 83 | { |
| 84 | std::string ret; |
| 85 | if (val.labelOffsetSupport) |
| 86 | ret = json::addValue(ret, json::KV{"labelOffsetSupport" , val.labelOffsetSupport}); |
| 87 | return json::addScope(ret); |
| 88 | } |
| 89 | |
| 90 | std::string toJsonValueStr(const SignatureHelpClientCapabilities::SignatureInformation &val) |
| 91 | { |
| 92 | std::string ret; |
| 93 | if (val.documentationFormat) |
| 94 | ret = json::addValue(ret, json::KV{"documentationFormat" , val.documentationFormat}); |
| 95 | |
| 96 | if (val.parameterInformation) |
| 97 | ret = json::addValue(ret, json::KV{"parameterInformation" , val.parameterInformation}); |
| 98 | |
| 99 | if (val.activeParameterSupport) |
| 100 | ret = json::addValue(ret, json::KV{"activeParameterSupport" , val.activeParameterSupport}); |
| 101 | |
| 102 | return json::addScope(ret); |
| 103 | } |
| 104 | |
| 105 | std::string toJsonValueStr(const CodeActionKind &val) |
| 106 | { |
| 107 | std::string ret; |
| 108 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 109 | return json::addScope(ret); |
| 110 | } |
| 111 | |
| 112 | std::string toJsonValueStr(const ChangeAnotationSupport &val) |
| 113 | { |
| 114 | std::string ret; |
| 115 | if (val.groupsOnLabel) |
| 116 | ret = json::addValue(ret, json::KV{"groupsOnLabel" , val.groupsOnLabel}); |
| 117 | return json::addScope(ret); |
| 118 | } |
| 119 | |
| 120 | std::string toJsonValueStr(const SymbolKind &val) |
| 121 | { |
| 122 | std::string ret; |
| 123 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 124 | return json::addScope(ret); |
| 125 | } |
| 126 | |
| 127 | std::string toJsonValueStr(const WorkspaceEditClientCapabilities &val) |
| 128 | { |
| 129 | std::string ret; |
| 130 | if (val.documentChanges) |
| 131 | ret = json::addValue(ret, json::KV{"documentChanges" , val.documentChanges}); |
| 132 | if (val.resourceOperations) |
| 133 | ret = json::addValue(ret, json::KV{"resourceOperations" , val.resourceOperations}); |
| 134 | if (val.failureHandling) |
| 135 | ret = json::addValue(ret, json::KV{"failureHandling" , val.failureHandling}); |
| 136 | if (val.normalizesLineEndings) |
| 137 | ret = json::addValue(ret, json::KV{"normalizesLineEndings" , val.normalizesLineEndings}); |
| 138 | if (val.changeAnnotationSupport) |
| 139 | ret = json::addValue(ret, json::KV{"changeAnnotationSupport" , val.changeAnnotationSupport}); |
| 140 | return json::addScope(ret); |
| 141 | } |
| 142 | |
| 143 | std::string toJsonValueStr(const DidChangeConfigurationClientCapabilities &val) |
| 144 | { |
| 145 | std::string ret; |
| 146 | if (val.dynamicRegistration) |
| 147 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 148 | return json::addScope(ret); |
| 149 | } |
| 150 | |
| 151 | std::string toJsonValueStr(const DidChangeWatchedFilesClientCapabilities &val) |
| 152 | { |
| 153 | std::string ret; |
| 154 | if (val.dynamicRegistration) |
| 155 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 156 | if (val.relativePatternSupport) |
| 157 | ret = json::addValue(ret, json::KV{"relativePatternSupport" , val.relativePatternSupport}); |
| 158 | return json::addScope(ret); |
| 159 | } |
| 160 | |
| 161 | std::string toJsonValueStr(const ExecuteCommandClientCapabilities &val) |
| 162 | { |
| 163 | std::string ret; |
| 164 | if (val.dynamicRegistration) |
| 165 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 166 | return json::addScope(ret); |
| 167 | } |
| 168 | |
| 169 | std::string toJsonValueStr(const WorkspaceSymbolClientCapabilities::TagSupport &val) |
| 170 | { |
| 171 | std::string ret; |
| 172 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 173 | return json::addScope(ret); |
| 174 | } |
| 175 | |
| 176 | std::string toJsonValueStr(const WorkspaceSymbolClientCapabilities &val){ |
| 177 | std::string ret; |
| 178 | if (val.dynamicRegistration) |
| 179 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 180 | if (val.symbolKind) |
| 181 | ret = json::addValue(ret, json::KV{"symbolKind" , val.symbolKind}); |
| 182 | if (val.tagSupport) |
| 183 | ret = json::addValue(ret, json::KV{"tagSupport" , val.tagSupport}); |
| 184 | if (val.resolveSupport) |
| 185 | ret = json::addValue(ret, json::KV{"resolveSupport" , val.resolveSupport}); |
| 186 | return json::addScope(ret); |
| 187 | } |
| 188 | |
| 189 | std::string toJsonValueStr(const SemanticTokensWorkspaceClientCapabilities &val) |
| 190 | { |
| 191 | std::string ret; |
| 192 | if (val.refreshSupport) |
| 193 | ret = json::addValue(ret, json::KV{"refreshSupport" , val.refreshSupport}); |
| 194 | return json::addScope(ret); |
| 195 | } |
| 196 | |
| 197 | std::string toJsonValueStr(const CodeLensWorkspaceClientCapabilities &val) |
| 198 | { |
| 199 | std::string ret; |
| 200 | if (val.refreshSupport) |
| 201 | ret = json::addValue(ret, json::KV{"refreshSupport" , val.refreshSupport}); |
| 202 | return json::addScope(ret); |
| 203 | } |
| 204 | |
| 205 | std::string toJsonValueStr(const InlineValueWorkspaceClientCapabilities &val) |
| 206 | { |
| 207 | std::string ret; |
| 208 | if (val.refreshSupport) |
| 209 | ret = json::addValue(ret, json::KV{"refreshSupport" , val.refreshSupport}); |
| 210 | return json::addScope(ret); |
| 211 | } |
| 212 | |
| 213 | std::string toJsonValueStr(const InlayHintWorkspaceClientCapabilities &val) |
| 214 | { |
| 215 | std::string ret; |
| 216 | if (val.refreshSupport) |
| 217 | ret = json::addValue(ret, json::KV{"refreshSupport" , val.refreshSupport}); |
| 218 | return json::addScope(ret); |
| 219 | } |
| 220 | |
| 221 | std::string toJsonValueStr(const DiagnosticWorkspaceClientCapabilities &val) |
| 222 | { |
| 223 | std::string ret; |
| 224 | if (val.refreshSupport) |
| 225 | ret = json::addValue(ret, json::KV{"refreshSupport" , val.refreshSupport}); |
| 226 | return json::addScope(ret); |
| 227 | } |
| 228 | |
| 229 | std::string toJsonValueStr(const TextDocumentSyncClientCapabilities &val) |
| 230 | { |
| 231 | std::string ret; |
| 232 | if (val.dynamicRegistration) |
| 233 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 234 | if (val.willSave) |
| 235 | ret = json::addValue(ret, json::KV{"willSave" , val.willSave}); |
| 236 | if (val.willSaveWaitUntil) |
| 237 | ret = json::addValue(ret, json::KV{"willSaveWaitUntil" , val.willSaveWaitUntil}); |
| 238 | if (val.didSave) |
| 239 | ret = json::addValue(ret, json::KV{"didSave" , val.didSave}); |
| 240 | return json::addScope(ret); |
| 241 | } |
| 242 | |
| 243 | std::string toJsonValueStr(const CompletionClientCapabilities &val) |
| 244 | { |
| 245 | std::string ret; |
| 246 | if (val.dynamicRegistration) |
| 247 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 248 | if (val.completionItem) |
| 249 | ret = json::addValue(ret, json::KV{"completionItem" , val.completionItem}); |
| 250 | if (val.completionItemKind) |
| 251 | ret = json::addValue(ret, json::KV{"completionItemKind" , val.completionItemKind}); |
| 252 | if (val.contextSupport) |
| 253 | ret = json::addValue(ret, json::KV{"contextSupport" , val.contextSupport}); |
| 254 | if (val.insertTextMode) |
| 255 | ret = json::addValue(ret, json::KV{"insertTextMode" , val.insertTextMode}); |
| 256 | if (val.itemDefaults) |
| 257 | ret = json::addValue(ret, json::KV{"itemDefaults" , val.itemDefaults}); |
| 258 | return json::addScope(ret); |
| 259 | } |
| 260 | |
| 261 | std::string toJsonValueStr(const HoverClientCapabilities &val) |
| 262 | { |
| 263 | std::string ret; |
| 264 | if (val.dynamicRegistration) |
| 265 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 266 | if (val.contentFormat) |
| 267 | ret = json::addValue(ret, json::KV{"contentFormat" , val.contentFormat}); |
| 268 | return json::addScope(ret); |
| 269 | } |
| 270 | |
| 271 | std::string toJsonValueStr(const SignatureHelpClientCapabilities &val) |
| 272 | { |
| 273 | std::string ret; |
| 274 | if (val.dynamicRegistration) |
| 275 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 276 | if (val.signatureInformation) |
| 277 | ret = json::addValue(ret, json::KV{"signatureInformation" , val.signatureInformation}); |
| 278 | if (val.contextSupport) |
| 279 | ret = json::addValue(ret, json::KV{"contextSupport" , val.contextSupport}); |
| 280 | return json::addScope(ret); |
| 281 | } |
| 282 | |
| 283 | std::string toJsonValueStr(const DeclarationClientCapabilities &val) |
| 284 | { |
| 285 | std::string ret; |
| 286 | if (val.dynamicRegistration) |
| 287 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 288 | if (val.linkSupport) |
| 289 | ret = json::addValue(ret, json::KV{"linkSupport" , val.linkSupport}); |
| 290 | return json::addScope(ret); |
| 291 | } |
| 292 | |
| 293 | std::string toJsonValueStr(const DefinitionClientCapabilities &val) |
| 294 | { |
| 295 | std::string ret; |
| 296 | if (val.dynamicRegistration) |
| 297 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 298 | if (val.linkSupport) |
| 299 | ret = json::addValue(ret, json::KV{"linkSupport" , val.linkSupport}); |
| 300 | return json::addScope(ret); |
| 301 | } |
| 302 | |
| 303 | std::string toJsonValueStr(const TypeDefinitionClientCapabilities &val) |
| 304 | { |
| 305 | std::string ret; |
| 306 | if (val.dynamicRegistration) |
| 307 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 308 | if (val.linkSupport) |
| 309 | ret = json::addValue(ret, json::KV{"linkSupport" , val.linkSupport}); |
| 310 | return json::addScope(ret); |
| 311 | } |
| 312 | |
| 313 | std::string toJsonValueStr(const ImplementationClientCapabilities &val) |
| 314 | { |
| 315 | std::string ret; |
| 316 | if (val.dynamicRegistration) |
| 317 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 318 | if (val.linkSupport) |
| 319 | ret = json::addValue(ret, json::KV{"linkSupport" , val.linkSupport}); |
| 320 | return json::addScope(ret); |
| 321 | } |
| 322 | |
| 323 | std::string toJsonValueStr(const ReferenceClientCapabilities &val) |
| 324 | { |
| 325 | std::string ret; |
| 326 | if (val.dynamicRegistration) |
| 327 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 328 | return json::addScope(ret); |
| 329 | } |
| 330 | |
| 331 | std::string toJsonValueStr(const DocumentHighlightClientCapabilities &val) |
| 332 | { |
| 333 | std::string ret; |
| 334 | if (val.dynamicRegistration) |
| 335 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 336 | return json::addScope(ret); |
| 337 | } |
| 338 | |
| 339 | std::string toJsonValueStr(const DocumentSymbolClientCapabilities &val) |
| 340 | { |
| 341 | std::string ret; |
| 342 | if (val.dynamicRegistration) |
| 343 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 344 | if (val.symbolKind) |
| 345 | ret = json::addValue(ret, json::KV{"symbolKind" , val.symbolKind}); |
| 346 | if (val.hierarchicalDocumentSymbolSupport) |
| 347 | ret = json::addValue(ret, json::KV{"hierarchicalDocumentSymbolSupport" , |
| 348 | val.hierarchicalDocumentSymbolSupport}); |
| 349 | if (val.tagSupport) |
| 350 | ret = json::addValue(ret, json::KV{"tagSupport" , val.tagSupport}); |
| 351 | if (val.labelSupport) |
| 352 | ret = json::addValue(ret, json::KV{"labelSupport" , val.labelSupport}); |
| 353 | return json::addScope(ret); |
| 354 | } |
| 355 | |
| 356 | std::string toJsonValueStr(const CodeActionClientCapabilities &val) |
| 357 | { |
| 358 | std::string ret; |
| 359 | if (val.dynamicRegistration) |
| 360 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 361 | if (val.codeActionLiteralSupport) |
| 362 | ret = json::addValue(ret, json::KV{"codeActionLiteralSupport" , val.codeActionLiteralSupport}); |
| 363 | if (val.isPreferredSupport) |
| 364 | ret = json::addValue(ret, json::KV{"isPreferredSupport" , val.isPreferredSupport}); |
| 365 | if (val.disabledSupport) |
| 366 | ret = json::addValue(ret, json::KV{"disabledSupport" , val.disabledSupport}); |
| 367 | if (val.dataSupport) |
| 368 | ret = json::addValue(ret, json::KV{"dataSupport" , val.dataSupport}); |
| 369 | if (val.resolveSupport) |
| 370 | ret = json::addValue(ret, json::KV{"resolveSupport" , val.resolveSupport}); |
| 371 | if (val.honorsChangeAnnotations) |
| 372 | ret = json::addValue(ret, json::KV{"honorsChangeAnnotations" , val.honorsChangeAnnotations}); |
| 373 | return json::addScope(ret); |
| 374 | } |
| 375 | |
| 376 | std::string toJsonValueStr(const CodeLensClientCapabilities &val) |
| 377 | { |
| 378 | std::string ret; |
| 379 | if (val.dynamicRegistration) |
| 380 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 381 | return json::addScope(ret); |
| 382 | } |
| 383 | |
| 384 | std::string toJsonValueStr(const DocumentLinkClientCapabilities &val) |
| 385 | { |
| 386 | std::string ret; |
| 387 | if (val.dynamicRegistration) |
| 388 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 389 | if (val.tooltipSupport) |
| 390 | ret = json::addValue(ret, json::KV{"tooltipSupport" , val.tooltipSupport}); |
| 391 | return json::addScope(ret); |
| 392 | } |
| 393 | |
| 394 | std::string toJsonValueStr(const DocumentColorClientCapabilities &val) |
| 395 | { |
| 396 | std::string ret; |
| 397 | if (val.dynamicRegistration) |
| 398 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 399 | return json::addScope(ret); |
| 400 | } |
| 401 | |
| 402 | std::string toJsonValueStr(const DocumentFormattingClientCapabilities &val) |
| 403 | { |
| 404 | std::string ret; |
| 405 | if (val.dynamicRegistration) |
| 406 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 407 | return json::addScope(ret); |
| 408 | } |
| 409 | |
| 410 | std::string toJsonValueStr(const DocumentRangeFormattingClientCapabilities &val) |
| 411 | { |
| 412 | std::string ret; |
| 413 | if (val.dynamicRegistration) |
| 414 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 415 | return json::addScope(ret); |
| 416 | } |
| 417 | |
| 418 | std::string toJsonValueStr(const DocumentOnTypeFormattingClientCapabilities &val) |
| 419 | { |
| 420 | std::string ret; |
| 421 | if (val.dynamicRegistration) |
| 422 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 423 | return json::addScope(ret); |
| 424 | } |
| 425 | |
| 426 | std::string toJsonValueStr(const RenameClientCapabilities &val) |
| 427 | { |
| 428 | std::string ret; |
| 429 | if (val.dynamicRegistration) |
| 430 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 431 | if (val.prepareSupport) |
| 432 | ret = json::addValue(ret, json::KV{"prepareSupport" , val.prepareSupport}); |
| 433 | if (val.prepareSupportDefaultBehavior) |
| 434 | ret = json::addValue(ret, json::KV{"prepareSupportDefaultBehavior" , val.prepareSupportDefaultBehavior}); |
| 435 | if (val.honorsChangeAnnotations) |
| 436 | ret = json::addValue(ret, json::KV{"honorsChangeAnnotations" , val.honorsChangeAnnotations}); |
| 437 | return json::addScope(ret); |
| 438 | } |
| 439 | |
| 440 | std::string toJsonValueStr(const PublishDiagnosticsClientCapabilities &val) |
| 441 | { |
| 442 | std::string ret; |
| 443 | if (val.relatedInformation) |
| 444 | ret = json::addValue(ret, json::KV{"relatedInformation" , val.relatedInformation}); |
| 445 | if (val.tagSupport) |
| 446 | ret = json::addValue(ret, json::KV{"tagSupport" , val.tagSupport}); |
| 447 | if (val.versionSupport) |
| 448 | ret = json::addValue(ret, json::KV{"versionSupport" , val.versionSupport}); |
| 449 | if (val.codeDescriptionSupport) |
| 450 | ret = json::addValue(ret, json::KV{"codeDescriptionSupport" , val.codeDescriptionSupport}); |
| 451 | if (val.dataSupport) |
| 452 | ret = json::addValue(ret, json::KV{"dataSupport" , val.dataSupport}); |
| 453 | return json::addScope(ret); |
| 454 | } |
| 455 | |
| 456 | std::string toJsonValueStr(const FoldingRangeClientCapabilities::FoldingRangeKind &val) |
| 457 | { |
| 458 | std::string ret; |
| 459 | if (val.valueSet) |
| 460 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 461 | return json::addScope(ret); |
| 462 | } |
| 463 | |
| 464 | std::string toJsonValueStr(const FoldingRangeClientCapabilities::FoldingRange &val) |
| 465 | { |
| 466 | std::string ret; |
| 467 | if (val.collapsedText) |
| 468 | ret = json::addValue(ret, json::KV{"collapsedText" , val.collapsedText}); |
| 469 | return json::addScope(ret); |
| 470 | } |
| 471 | |
| 472 | std::string toJsonValueStr(const FoldingRangeClientCapabilities &val) |
| 473 | { |
| 474 | std::string ret; |
| 475 | if (val.dynamicRegistration) |
| 476 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 477 | if (val.rangeLimit) |
| 478 | ret = json::addValue(ret, json::KV{"rangeLimit" , val.rangeLimit}); |
| 479 | if (val.lineFoldingOnly) |
| 480 | ret = json::addValue(ret, json::KV{"lineFoldingOnly" , val.lineFoldingOnly}); |
| 481 | if (val.foldingRangeKind) |
| 482 | ret = json::addValue(ret, json::KV{"foldingRangeKind" , val.foldingRangeKind}); |
| 483 | if (val.foldingRange) |
| 484 | ret = json::addValue(ret, json::KV{"foldingRange" , val.foldingRange}); |
| 485 | return json::addScope(ret); |
| 486 | } |
| 487 | |
| 488 | std::string toJsonValueStr(const SelectionRangeClientCapabilities &val) |
| 489 | { |
| 490 | std::string ret; |
| 491 | if (val.dynamicRegistration) |
| 492 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 493 | return json::addScope(ret); |
| 494 | } |
| 495 | |
| 496 | std::string toJsonValueStr(const LinkedEditingRangeClientCapabilities &val) |
| 497 | { |
| 498 | std::string ret; |
| 499 | if (val.dynamicRegistration) |
| 500 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 501 | return json::addScope(ret); |
| 502 | } |
| 503 | |
| 504 | std::string toJsonValueStr(const CallHierarchyClientCapabilities &val) |
| 505 | { |
| 506 | std::string ret; |
| 507 | if (val.dynamicRegistration) |
| 508 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 509 | return json::addScope(ret); |
| 510 | } |
| 511 | |
| 512 | std::string toJsonValueStr(const SemanticTokensClientCapabilities::Requests::Full &val) |
| 513 | { |
| 514 | std::string ret; |
| 515 | if (val.delta) { |
| 516 | ret = json::addValue(ret, json::KV{"delta" , val.delta}); |
| 517 | } |
| 518 | return json::addScope(ret); |
| 519 | } |
| 520 | |
| 521 | std::string toJsonValueStr(const SemanticTokensClientCapabilities::Requests &val) |
| 522 | { |
| 523 | std::string ret; |
| 524 | if (val.range) { |
| 525 | if (any_contrast<bool>(val.range.value())) { |
| 526 | ret = json::addValue(ret, json::KV{"range" , std::any_cast<bool>(val.range.value())}); |
| 527 | } else { |
| 528 | ret = json::addValue(ret, json::KV{"range" , std::string("{}" )}); |
| 529 | } |
| 530 | } |
| 531 | if (val.full) { |
| 532 | ret = json::addValue(ret, json::KV{"full" , val.full}); |
| 533 | } |
| 534 | return json::addScope(ret); |
| 535 | } |
| 536 | |
| 537 | std::string toJsonValueStr(const SemanticTokensClientCapabilities &val) |
| 538 | { |
| 539 | std::string ret; |
| 540 | if (val.dynamicRegistration) |
| 541 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 542 | ret = json::addValue(ret, json::KV{"requests" , val.requests}); |
| 543 | ret = json::addValue(ret, json::KV{"tokenTypes" , val.tokenTypes}); |
| 544 | ret = json::addValue(ret, json::KV{"tokenModifiers" , val.tokenModifiers}); |
| 545 | ret = json::addValue(ret, json::KV{"formats" , val.formats}); |
| 546 | if (val.overlappingTokenSupport) |
| 547 | ret = json::addValue(ret, json::KV{"overlappingTokenSupport" , val.overlappingTokenSupport}); |
| 548 | if (val.multilineTokenSupport) |
| 549 | ret = json::addValue(ret, json::KV{"multilineTokenSupport" , val.multilineTokenSupport}); |
| 550 | if (val.serverCancelSupport) |
| 551 | ret = json::addValue(ret, json::KV{"serverCancelSupport" , val.multilineTokenSupport}); |
| 552 | if (val.augmentsSyntaxTokens) |
| 553 | ret = json::addValue(ret, json::KV{"augmentsSyntaxTokens" , val.multilineTokenSupport}); |
| 554 | return json::addScope(ret); |
| 555 | } |
| 556 | |
| 557 | |
| 558 | |
| 559 | std::string toJsonValueStr(const MonikerClientCapabilities &val) |
| 560 | { |
| 561 | std::string ret; |
| 562 | if (val.dynamicRegistration) |
| 563 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 564 | return json::addScope(ret); |
| 565 | } |
| 566 | |
| 567 | std::string toJsonValueStr(const TypeHierarchyClientCapabilities &val) |
| 568 | { |
| 569 | std::string ret; |
| 570 | if (val.dynamicRegistration) |
| 571 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 572 | return json::addScope(ret); |
| 573 | } |
| 574 | |
| 575 | std::string toJsonValueStr(const InlineValueClientCapabilities &val) |
| 576 | { |
| 577 | std::string ret; |
| 578 | if (val.dynamicRegistration) |
| 579 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 580 | return json::addScope(ret); |
| 581 | } |
| 582 | |
| 583 | std::string toJsonValueStr(const InlayHintClientCapabilities &val) |
| 584 | { |
| 585 | std::string ret; |
| 586 | if (val.dynamicRegistration) |
| 587 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 588 | if (val.resolveSupport) |
| 589 | ret = json::addValue(ret, json::KV{"resolveSupport" , val.resolveSupport}); |
| 590 | return json::addScope(ret); |
| 591 | } |
| 592 | |
| 593 | std::string toJsonValueStr(const DiagnosticClientCapabilities &val) |
| 594 | { |
| 595 | std::string ret; |
| 596 | if (val.dynamicRegistration) |
| 597 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 598 | if (val.relatedDocumentSupport) |
| 599 | ret = json::addValue(ret, json::KV{"relatedDocumentSupport" , val.relatedDocumentSupport}); |
| 600 | return json::addScope(ret); |
| 601 | } |
| 602 | |
| 603 | std::string toJsonValueStr(const TextDocumentClientCapabilities &val) { |
| 604 | std::string ret; |
| 605 | if (val.synchronization) |
| 606 | ret = json::addValue(ret, json::KV{"synchronization" , val.synchronization}); |
| 607 | if (val.completion) |
| 608 | ret = json::addValue(ret, json::KV{"completion" , val.completion}); |
| 609 | if (val.hover) |
| 610 | ret = json::addValue(ret, json::KV{"hover" , val.hover}); |
| 611 | if (val.signatureHelp) |
| 612 | ret = json::addValue(ret, json::KV{"signatureHelp" , val.signatureHelp}); |
| 613 | if (val.declaration) |
| 614 | ret = json::addValue(ret, json::KV{"declaration" , val.declaration}); |
| 615 | if (val.definition) |
| 616 | ret = json::addValue(ret, json::KV{"definition" , val.definition}); |
| 617 | if (val.typeDefinition) |
| 618 | ret = json::addValue(ret, json::KV{"typeDefinition" , val.typeDefinition}); |
| 619 | if (val.implementation) |
| 620 | ret = json::addValue(ret, json::KV{"implementation" , val.implementation}); |
| 621 | if (val.references) |
| 622 | ret = json::addValue(ret, json::KV{"references" , val.references}); |
| 623 | if (val.documentHighlight) |
| 624 | ret = json::addValue(ret, json::KV{"documentHighlight" , val.documentHighlight}); |
| 625 | if (val.documentSymbol) |
| 626 | ret = json::addValue(ret, json::KV{"documentSymbol" , val.documentSymbol}); |
| 627 | if (val.codeAction) |
| 628 | ret = json::addValue(ret, json::KV{"codeAction" , val.codeAction}); |
| 629 | if (val.codeLens) |
| 630 | ret = json::addValue(ret, json::KV{"codeLens" , val.codeLens}); |
| 631 | if (val.documentLink) |
| 632 | ret = json::addValue(ret, json::KV{"documentLink" , val.documentLink}); |
| 633 | if (val.colorProvider) |
| 634 | ret = json::addValue(ret, json::KV{"colorProvider" , val.colorProvider}); |
| 635 | if (val.formatting) |
| 636 | ret = json::addValue(ret, json::KV{"formatting" , val.formatting}); |
| 637 | if (val.rangeFormatting) |
| 638 | ret = json::addValue(ret, json::KV{"rangeFormatting" , val.formatting}); |
| 639 | if (val.onTypeFormatting) |
| 640 | ret = json::addValue(ret, json::KV{"onTypeFormatting" , val.onTypeFormatting}); |
| 641 | if (val.rename) |
| 642 | ret = json::addValue(ret, json::KV{"rename" , val.rename}); |
| 643 | if (val.publishDiagnostics) |
| 644 | ret = json::addValue(ret, json::KV{"publishDiagnostics" , val.publishDiagnostics}); |
| 645 | if (val.foldingRange) |
| 646 | ret = json::addValue(ret, json::KV{"foldingRange" , val.foldingRange}); |
| 647 | if (val.selectionRange) |
| 648 | ret = json::addValue(ret, json::KV{"selectionRange" , val.selectionRange}); |
| 649 | if (val.linkedEditingRange) |
| 650 | ret = json::addValue(ret, json::KV{"linkedEditingRange" , val.linkedEditingRange}); |
| 651 | if (val.callHierarchy) |
| 652 | ret = json::addValue(ret, json::KV{"callHierarchy" , val.callHierarchy}); |
| 653 | if (val.semanticTokens) |
| 654 | ret = json::addValue(ret, json::KV{"semanticTokens" , val.semanticTokens}); |
| 655 | if (val.moniker) |
| 656 | ret = json::addValue(ret, json::KV{"moniker" , val.moniker}); |
| 657 | if (val.typeHierarchy) |
| 658 | ret = json::addValue(ret, json::KV{"typeHierarchy" , val.typeHierarchy}); |
| 659 | if (val.inlineValue) |
| 660 | ret = json::addValue(ret, json::KV{"inlineValue" , val.inlineValue}); |
| 661 | if (val.inlayHint) |
| 662 | ret = json::addValue(ret, json::KV{"inlayHint" , val.inlayHint}); |
| 663 | if (val.diagnostic) |
| 664 | ret = json::addValue(ret, json::KV{"diagnostic" , val.diagnostic}); |
| 665 | return json::addScope(ret); |
| 666 | } |
| 667 | |
| 668 | std::string toJsonValueStr(const FileOperations &val) |
| 669 | { |
| 670 | std::string ret; |
| 671 | if (val.dynamicRegistration) |
| 672 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 673 | if (val.didCreate) |
| 674 | ret = json::addValue(ret, json::KV{"didCreate" , val.didCreate}); |
| 675 | if (val.willCreate) |
| 676 | ret = json::addValue(ret, json::KV{"willCreate" , val.willCreate}); |
| 677 | if (val.didRename) |
| 678 | ret = json::addValue(ret, json::KV{"didRename" , val.didRename}); |
| 679 | if (val.willRename) |
| 680 | ret = json::addValue(ret, json::KV{"willRename" , val.willRename}); |
| 681 | if (val.didDelete) |
| 682 | ret = json::addValue(ret, json::KV{"didDelete" , val.didDelete}); |
| 683 | if (val.willDelete) |
| 684 | ret = json::addValue(ret, json::KV{"willDelete" , val.willDelete}); |
| 685 | return json::addScope(ret); |
| 686 | } |
| 687 | |
| 688 | std::string toJsonValueStr(const Workspace &val) |
| 689 | { |
| 690 | std::string ret; |
| 691 | if (val.applyEdit) |
| 692 | ret = json::addValue(ret, json::KV{"applyEdit" , val.applyEdit}); |
| 693 | if (val.workspaceEdit) |
| 694 | ret = json::addValue(ret, json::KV{"workspaceEdit" , val.workspaceEdit}); |
| 695 | if (val.didChangeConfiguration) |
| 696 | ret = json::addValue(ret, json::KV{"didChangeConfiguration" , val.didChangeConfiguration}); |
| 697 | if (val.didChangeWatchedFiles) |
| 698 | ret = json::addValue(ret, json::KV{"didChangeWatchedFiles" , val.didChangeWatchedFiles}); |
| 699 | if (val.symbol) |
| 700 | ret = json::addValue(ret, json::KV{"symbol" , val.symbol}); |
| 701 | if (val.executeCommand) |
| 702 | ret = json::addValue(ret, json::KV{"executeCommand" , val.executeCommand}); |
| 703 | if (val.workspaceFolders) |
| 704 | ret = json::addValue(ret, json::KV{"workspaceFolders" , val.workspaceFolders}); |
| 705 | if (val.configuration) |
| 706 | ret = json::addValue(ret, json::KV{"configuration" , val.configuration}); |
| 707 | if (val.semanticTokens) |
| 708 | ret = json::addValue(ret, json::KV{"semanticTokens" , val.semanticTokens}); |
| 709 | if (val.codeLens) |
| 710 | ret = json::addValue(ret, json::KV{"codeLens" , val.codeLens}); |
| 711 | if (val.fileOperations) |
| 712 | ret = json::addValue(ret, json::KV{"fileOperations" , val.fileOperations}); |
| 713 | if (val.inlineValue) |
| 714 | ret = json::addValue(ret, json::KV{"inlineValue" , val.inlineValue}); |
| 715 | if (val.inlayHint) |
| 716 | ret = json::addValue(ret, json::KV{"inlayHint" , val.inlayHint}); |
| 717 | if (val.diagnostics) |
| 718 | ret = json::addValue(ret, json::KV{"diagnostics" , val.diagnostics}); |
| 719 | return json::addScope(ret); |
| 720 | } |
| 721 | |
| 722 | std::string toJsonValueStr(const ClientInfo &val) |
| 723 | { |
| 724 | std::string result{}; |
| 725 | result = json::addValue(result, json::KV{"name" , val.name}); |
| 726 | if (val.version) |
| 727 | result = json::addValue(result, json::KV{"version" , val.version}); |
| 728 | return json::addScope(result); |
| 729 | } |
| 730 | |
| 731 | std::string toJsonValueStr(const NotebookDocumentSyncClientCapabilities &val) |
| 732 | { |
| 733 | std::string ret = "" ; |
| 734 | if (val.dynamicRegistration) |
| 735 | ret = json::addValue(ret, json::KV{"dynamicRegistration" , val.dynamicRegistration}); |
| 736 | if (val.executionSummarySupport) |
| 737 | ret = json::addValue(ret, json::KV{"executionSummarySupport" , val.executionSummarySupport}); |
| 738 | return json::addScope(ret); |
| 739 | } |
| 740 | |
| 741 | std::string toJsonValueStr(const NotebookDocumentClientCapabilities &val) |
| 742 | { |
| 743 | std::string ret; |
| 744 | ret = json::addValue(ret, json::KV{"synchronization" , val.synchronization}); |
| 745 | return json::addScope(ret); |
| 746 | } |
| 747 | |
| 748 | std::string toJsonValueStr(const MessageActionItem &val) |
| 749 | { |
| 750 | std::string ret; |
| 751 | if (val.additionalPropertiesSupport) |
| 752 | ret = json::addValue(ret, json::KV{"additionalPropertiesSupport" , val.additionalPropertiesSupport}); |
| 753 | return json::addScope(ret); |
| 754 | } |
| 755 | |
| 756 | std::string toJsonValueStr(const ShowMessageRequestClientCapabilities &val) |
| 757 | { |
| 758 | std::string ret; |
| 759 | if (val.messageActionItem) |
| 760 | ret = json::addValue(ret, json::KV{"messageActionItem" , val.messageActionItem}); |
| 761 | return json::addScope(ret); |
| 762 | } |
| 763 | |
| 764 | std::string toJsonValueStr(const ShowDocumentClientCapabilities &val) { |
| 765 | std::string ret; |
| 766 | ret = json::addValue(ret, json::KV{"support" , val.support}); |
| 767 | return json::addScope(ret); |
| 768 | } |
| 769 | |
| 770 | std::string toJsonValueStr(const Window &val) |
| 771 | { |
| 772 | std::string ret; |
| 773 | if (val.workDoneProgress) |
| 774 | ret = json::addValue(ret, json::KV{"workDoneProgress" , val.workDoneProgress}); |
| 775 | if (val.showMessage) |
| 776 | ret = json::addValue(ret, json::KV{"showMessage" , val.showMessage}); |
| 777 | if (val.showDocument) |
| 778 | ret = json::addValue(ret, json::KV{"showDocument" , val.showDocument}); |
| 779 | return json::addScope(ret); |
| 780 | } |
| 781 | |
| 782 | std::string toJsonValueStr(const StaleRequestSupport &val) |
| 783 | { |
| 784 | std::string ret; |
| 785 | ret = json::addValue(ret, json::KV{"cancel" , val.cancel}); |
| 786 | ret = json::addValue(ret,json::KV{"retryOnContentModified" , val.retryOnContentModified}); |
| 787 | return json::addScope(ret); |
| 788 | } |
| 789 | |
| 790 | std::string toJsonValueStr(const RegularExpressionsClientCapabilities &val) |
| 791 | { |
| 792 | std::string ret; |
| 793 | ret = json::addValue(ret, json::KV{"engine" , val.engine}); |
| 794 | if (val.version) |
| 795 | ret = json::addValue(ret, json::KV{"version" , val.version}); |
| 796 | return json::addScope(ret); |
| 797 | } |
| 798 | |
| 799 | std::string toJsonValueStr(const MarkdownClientCapabilities &val) |
| 800 | { |
| 801 | std::string ret; |
| 802 | ret = json::addValue(ret, json::KV{"parser" , val.parser}); |
| 803 | if (val.version) |
| 804 | ret = json::addValue(ret, json::KV{"version" , val.version}); |
| 805 | if (val.allowedTags) |
| 806 | ret = json::addValue(ret, json::KV{"allowedTags" , val.allowedTags}); |
| 807 | return json::addScope(ret); |
| 808 | } |
| 809 | |
| 810 | std::string toJsonValueStr(const General &val) |
| 811 | { |
| 812 | std::string ret; |
| 813 | if (val.staleRequestSupport) |
| 814 | ret = json::addValue(ret, json::KV{"staleRequestSupport" , val.staleRequestSupport}); |
| 815 | if (val.regularExpressions) |
| 816 | ret = json::addValue(ret, json::KV{"regularExpressions" , val.regularExpressions}); |
| 817 | if (val.markdown) |
| 818 | ret = json::addValue(ret, json::KV{"markdown" , val.markdown}); |
| 819 | if (val.positionEncodings) |
| 820 | ret = json::addValue(ret, json::KV{"positionEncodings" , val.positionEncodings}); |
| 821 | if (val.experimental) |
| 822 | ret = json::addValue(ret, json::KV{"experimental" , std::string("{}" )}); |
| 823 | return json::addScope(ret); |
| 824 | } |
| 825 | |
| 826 | std::string toJsonValueStr(const ClientCapabilities &val) |
| 827 | { |
| 828 | std::string ret; |
| 829 | if (val.workspace) |
| 830 | ret = json::addValue(ret, json::KV{"workspace" , val.workspace}); |
| 831 | if (val.textDocument) |
| 832 | ret = json::addValue(ret, json::KV{"textDocument" , val.textDocument}); |
| 833 | if (val.notebookDocument) |
| 834 | ret = json::addValue(ret, json::KV{"notebookDocument" , val.notebookDocument}); |
| 835 | if (val.window) |
| 836 | ret = json::addValue(ret, json::KV{"window" , val.window}); |
| 837 | if (val.general) |
| 838 | ret = json::addValue(ret, json::KV{"general" , val.general}); |
| 839 | return json::addScope(ret); |
| 840 | } |
| 841 | |
| 842 | std::string toJsonValueStr(const WorkspaceFolder &val) |
| 843 | { |
| 844 | std::string ret; |
| 845 | ret = json::addValue(ret, json::KV{"uri" , val.uri}); |
| 846 | ret = json::addValue(ret, json::KV{"name" , val.name}); |
| 847 | return json::addScope(ret); |
| 848 | } |
| 849 | |
| 850 | std::string toJsonValueStr(const DocumentSymbolClientCapabilities::TagSupport &val) |
| 851 | { |
| 852 | std::string ret; |
| 853 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 854 | return json::addScope(ret); |
| 855 | } |
| 856 | |
| 857 | std::string toJsonValueStr(const PublishDiagnosticsClientCapabilities::TagSupport &val) |
| 858 | { |
| 859 | std::string ret; |
| 860 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 861 | return json::addScope(ret); |
| 862 | } |
| 863 | |
| 864 | std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItem::InsertTextModeSupport &val) |
| 865 | { |
| 866 | std::string ret; |
| 867 | ret = json::addValue(ret, json::KV{"valueSet" , val.valueSet}); |
| 868 | return json::addScope(ret); |
| 869 | } |
| 870 | |
| 871 | std::string toJsonValueStr(const std::vector<WorkspaceFolder> &val) |
| 872 | { |
| 873 | std::string ret; |
| 874 | ret += "[" ; |
| 875 | int valSize = val.size(); |
| 876 | for (int i = 0; i < valSize; i++) { |
| 877 | ret += toJsonValueStr(val[i]); |
| 878 | if (i < valSize -1) { |
| 879 | ret += "," ; |
| 880 | } |
| 881 | } |
| 882 | ret += "]" ; |
| 883 | return ret; |
| 884 | } |
| 885 | |
| 886 | std::string toJsonValueStr(const InitializeParams &val) |
| 887 | { |
| 888 | std::string ret; |
| 889 | |
| 890 | if (val.workDoneToken) |
| 891 | ret += json::addValue(ret, json::KV{"workDoneToken" , val.workDoneToken}); |
| 892 | if (val.language) |
| 893 | ret = json::addValue(ret, json::KV{"language" , val.language}); |
| 894 | if (val.processId) |
| 895 | ret = json::addValue(ret, json::KV{"processId" , val.processId}); |
| 896 | if (val.clientInfo) |
| 897 | ret = json::addValue(ret, json::KV{"clientInfo" , val.clientInfo}); |
| 898 | if (val.locale) |
| 899 | ret = json::addValue(ret, json::KV{"locale" , val.locale}); |
| 900 | if (val.rootPath) |
| 901 | ret = json::addValue(ret, json::KV{"rootPath" , val.rootPath}); |
| 902 | if (val.rootUri) |
| 903 | ret = json::addValue(ret, json::KV{"rootUri" , val.rootUri}); |
| 904 | if (val.initializationOptions) |
| 905 | ret = json::addValue(ret, json::KV{"initializationOptions" , std::string("{}" )}); |
| 906 | |
| 907 | ret = json::addValue(ret, json::KV{"capabilities" , val.capabilities}); |
| 908 | |
| 909 | if (val.trace) |
| 910 | ret = json::addValue(ret, json::KV{"trace" , val.trace}); |
| 911 | if (val.workspaceFolders) |
| 912 | ret = json::addValue(ret, json::KV{"workspaceFolders" , val.workspaceFolders}); |
| 913 | |
| 914 | return json::addScope(ret); |
| 915 | } |
| 916 | |
| 917 | std::string toJsonValueStr(const InitializedParams &val) |
| 918 | { |
| 919 | std::string result; |
| 920 | return json::addScope(result); |
| 921 | } |
| 922 | |
| 923 | } // newlsp |
| 924 | |
| 925 | |