16#include "clang/Basic/LLVM.h"
17#include "clang/Index/IndexSymbol.h"
18#include "llvm/ADT/StringExtras.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/ADT/StringSwitch.h"
21#include "llvm/Support/ErrorHandling.h"
22#include "llvm/Support/JSON.h"
23#include "llvm/Support/Path.h"
24#include "llvm/Support/raw_ostream.h"
32bool mapOptOrNull(
const llvm::json::Value &Params, llvm::StringLiteral Prop,
33 T &
Out, llvm::json::Path P) {
34 auto *O = Params.getAsObject();
36 auto *V = O->get(Prop);
38 if (!V || V->getAsNull())
47 llvm::StringRef TUPath) {
48 assert(llvm::sys::path::is_absolute(AbsPath) &&
"the path is relative");
51 elog(
"URIForFile: failed to resolve path {0} with TU path {1}: "
52 "{2}.\nUsing unresolved path.",
53 AbsPath, TUPath, Resolved.takeError());
60 llvm::StringRef HintPath) {
63 return Resolved.takeError();
68 if (
auto S =
E.getAsString()) {
71 consumeError(Parsed.takeError());
72 P.report(
"failed to parse URI");
75 if (Parsed->scheme() !=
"file" && Parsed->scheme() !=
"test") {
76 P.report(
"clangd only supports 'file' URI scheme for workspace files");
82 P.report(
"unresolvable URI");
83 consumeError(U.takeError());
99 return llvm::json::Object{{
"uri", R.
uri}};
103 llvm::json::Path P) {
104 llvm::json::ObjectMapper O(Params, P);
105 return O && O.map(
"uri", R.
uri);
110 Result.getAsObject()->try_emplace(
"version", R.
version);
116 llvm::json::ObjectMapper O(Params, P);
122 llvm::json::Path P) {
123 llvm::json::ObjectMapper O(Params, P);
124 return O && O.map(
"line", R.
line) && O.map(
"character", R.
character);
128 return llvm::json::Object{
138bool fromJSON(
const llvm::json::Value &Params,
Range &R, llvm::json::Path P) {
139 llvm::json::ObjectMapper O(Params, P);
140 return O && O.map(
"start", R.
start) && O.map(
"end", R.
end);
144 return llvm::json::Object{
155 return llvm::json::Object{
162 return OS << L.range <<
'@' << L.uri;
166 llvm::json::Object Result{
177 return OS << L.range <<
'@' << L.uri <<
" (container: " << L.containerName
182 llvm::json::Path P) {
183 llvm::json::ObjectMapper O(Params, P);
184 return O && O.map(
"uri", R.
uri) && O.map(
"languageId", R.
languageId) &&
185 O.map(
"version", R.
version) && O.map(
"text", R.
text);
189 llvm::json::Path P) {
190 llvm::json::ObjectMapper O(Params, P);
191 return O && O.map(
"range", R.
range) && O.map(
"newText", R.
newText) &&
196 llvm::json::Object Result{
206 llvm::json::Path P) {
207 llvm::json::ObjectMapper O(Params, P);
208 return O && O.map(
"label", R.
label) &&
213 llvm::json::Object Result{{
"label", CA.
label}};
222 llvm::json::Path P) {
223 llvm::json::ObjectMapper O(Params, P);
227 llvm::json::Object Result{{
"textDocument", P.
textDocument},
234 llvm::printEscapedString(TE.
newText,
OS);
239 if (
auto S =
E.getAsString()) {
244 if (*S ==
"messages") {
248 if (*S ==
"verbose") {
257 if (
auto T =
E.getAsInteger()) {
258 if (*T <
static_cast<int>(SymbolKind::File) ||
259 *T >
static_cast<int>(SymbolKind::TypeParameter))
268 llvm::json::Path P) {
269 if (
auto *A =
E.getAsArray()) {
270 for (
size_t I = 0; I < A->size(); ++I) {
272 if (
fromJSON((*A)[I], KindOut, P.index(I)))
273 Out.set(
size_t(KindOut));
282 auto KindVal =
static_cast<size_t>(
Kind);
283 if (KindVal >=
SymbolKindMin && KindVal <= SupportedSymbolKinds.size() &&
284 SupportedSymbolKinds[KindVal])
289 case SymbolKind::Struct:
290 return SymbolKind::Class;
291 case SymbolKind::EnumMember:
292 return SymbolKind::Enum;
294 return SymbolKind::String;
300 case index::SymbolKind::Unknown:
301 return SymbolKind::Variable;
302 case index::SymbolKind::Module:
303 return SymbolKind::Module;
304 case index::SymbolKind::Namespace:
305 return SymbolKind::Namespace;
306 case index::SymbolKind::NamespaceAlias:
307 return SymbolKind::Namespace;
308 case index::SymbolKind::Macro:
309 return SymbolKind::String;
310 case index::SymbolKind::Enum:
311 return SymbolKind::Enum;
312 case index::SymbolKind::Struct:
313 return SymbolKind::Struct;
314 case index::SymbolKind::Class:
315 return SymbolKind::Class;
316 case index::SymbolKind::Protocol:
317 return SymbolKind::Interface;
318 case index::SymbolKind::Extension:
319 return SymbolKind::Interface;
320 case index::SymbolKind::Union:
321 return SymbolKind::Class;
322 case index::SymbolKind::TypeAlias:
323 return SymbolKind::Class;
324 case index::SymbolKind::Function:
325 return SymbolKind::Function;
326 case index::SymbolKind::Variable:
327 return SymbolKind::Variable;
328 case index::SymbolKind::Field:
329 return SymbolKind::Field;
330 case index::SymbolKind::EnumConstant:
331 return SymbolKind::EnumMember;
332 case index::SymbolKind::InstanceMethod:
333 case index::SymbolKind::ClassMethod:
334 case index::SymbolKind::StaticMethod:
335 return SymbolKind::Method;
336 case index::SymbolKind::InstanceProperty:
337 case index::SymbolKind::ClassProperty:
338 case index::SymbolKind::StaticProperty:
339 return SymbolKind::Property;
340 case index::SymbolKind::Constructor:
341 case index::SymbolKind::Destructor:
342 return SymbolKind::Constructor;
343 case index::SymbolKind::ConversionFunction:
344 return SymbolKind::Function;
345 case index::SymbolKind::Parameter:
346 case index::SymbolKind::NonTypeTemplateParm:
347 return SymbolKind::Variable;
348 case index::SymbolKind::Using:
349 return SymbolKind::Namespace;
350 case index::SymbolKind::TemplateTemplateParm:
351 case index::SymbolKind::TemplateTypeParm:
352 return SymbolKind::TypeParameter;
353 case index::SymbolKind::Concept:
354 return SymbolKind::Interface;
356 llvm_unreachable(
"invalid symbol kind");
360 llvm::json::Path P) {
361 const llvm::json::Object *O = Params.getAsObject();
363 P.report(
"expected object");
366 if (
auto *TextDocument = O->getObject(
"textDocument")) {
367 if (
auto *SemanticHighlighting =
368 TextDocument->getObject(
"semanticHighlightingCapabilities")) {
369 if (
auto SemanticHighlightingSupport =
370 SemanticHighlighting->getBoolean(
"semanticHighlighting"))
373 if (
auto *InactiveRegions =
374 TextDocument->getObject(
"inactiveRegionsCapabilities")) {
375 if (
auto InactiveRegionsSupport =
376 InactiveRegions->getBoolean(
"inactiveRegions")) {
380 if (TextDocument->getObject(
"semanticTokens"))
382 if (
auto *
Diagnostics = TextDocument->getObject(
"publishDiagnostics")) {
383 if (
auto CategorySupport =
Diagnostics->getBoolean(
"categorySupport"))
385 if (
auto CodeActions =
Diagnostics->getBoolean(
"codeActionsInline"))
387 if (
auto RelatedInfo =
Diagnostics->getBoolean(
"relatedInformation"))
390 if (
auto *
References = TextDocument->getObject(
"references"))
391 if (
auto ContainerSupport =
References->getBoolean(
"container"))
393 if (
auto *Completion = TextDocument->getObject(
"completion")) {
394 if (
auto *Item = Completion->getObject(
"completionItem")) {
395 if (
auto SnippetSupport = Item->getBoolean(
"snippetSupport"))
397 if (
auto LabelDetailsSupport = Item->getBoolean(
"labelDetailsSupport"))
399 if (
const auto *DocumentationFormat =
400 Item->getArray(
"documentationFormat")) {
401 for (
const auto &Format : *DocumentationFormat) {
407 if (
auto *ItemKind = Completion->getObject(
"completionItemKind")) {
408 if (
auto *ValueSet = ItemKind->get(
"valueSet")) {
411 P.field(
"textDocument")
413 .field(
"completionItemKind")
418 if (
auto EditsNearCursor = Completion->getBoolean(
"editsNearCursor"))
421 if (
auto *
CodeAction = TextDocument->getObject(
"codeAction")) {
422 if (
CodeAction->getObject(
"codeActionLiteralSupport"))
425 if (
auto *
DocumentSymbol = TextDocument->getObject(
"documentSymbol")) {
426 if (
auto HierarchicalSupport =
430 if (
auto *
Hover = TextDocument->getObject(
"hover")) {
431 if (
auto *ContentFormat =
Hover->getArray(
"contentFormat")) {
432 for (
const auto &Format : *ContentFormat) {
438 if (
auto *Help = TextDocument->getObject(
"signatureHelp")) {
440 if (
auto *
Info = Help->getObject(
"signatureInformation")) {
441 if (
auto *
Parameter =
Info->getObject(
"parameterInformation")) {
442 if (
auto OffsetSupport =
Parameter->getBoolean(
"labelOffsetSupport"))
445 if (
const auto *DocumentationFormat =
446 Info->getArray(
"documentationFormat")) {
447 for (
const auto &Format : *DocumentationFormat) {
454 if (
auto *Folding = TextDocument->getObject(
"foldingRange")) {
455 if (
auto LineFolding = Folding->getBoolean(
"lineFoldingOnly"))
458 if (
auto *Rename = TextDocument->getObject(
"rename")) {
459 if (
auto RenameSupport = Rename->getBoolean(
"prepareSupport"))
463 if (
auto *Workspace = O->getObject(
"workspace")) {
464 if (
auto *
Symbol = Workspace->getObject(
"symbol")) {
466 if (
auto *ValueSet =
SymbolKind->get(
"valueSet")) {
477 if (
auto *
SemanticTokens = Workspace->getObject(
"semanticTokens")) {
478 if (
auto RefreshSupport =
SemanticTokens->getBoolean(
"refreshSupport"))
481 if (
auto *
WorkspaceEdit = Workspace->getObject(
"workspaceEdit")) {
482 if (
auto DocumentChanges =
WorkspaceEdit->getBoolean(
"documentChanges"))
489 if (
auto *Window = O->getObject(
"window")) {
490 if (
auto WorkDoneProgress = Window->getBoolean(
"workDoneProgress"))
492 if (
auto Implicit = Window->getBoolean(
"implicitWorkDoneProgressCreate"))
495 if (
auto *General = O->getObject(
"general")) {
496 if (
auto *StaleRequestSupport = General->getObject(
"staleRequestSupport")) {
497 if (
auto Cancel = StaleRequestSupport->getBoolean(
"cancel"))
504 P.field(
"offsetEncoding")))
508 if (
auto *Experimental = O->getObject(
"experimental")) {
509 if (
auto *TextDocument = Experimental->getObject(
"textDocument")) {
510 if (
auto *Completion = TextDocument->getObject(
"completion")) {
511 if (
auto EditsNearCursor = Completion->getBoolean(
"editsNearCursor"))
514 if (
auto *
References = TextDocument->getObject(
"references")) {
515 if (
auto ContainerSupport =
References->getBoolean(
"container")) {
519 if (
auto *
Diagnostics = TextDocument->getObject(
"publishDiagnostics")) {
520 if (
auto CodeActions =
Diagnostics->getBoolean(
"codeActionsInline")) {
524 if (
auto *InactiveRegions =
525 TextDocument->getObject(
"inactiveRegionsCapabilities")) {
526 if (
auto InactiveRegionsSupport =
527 InactiveRegions->getBoolean(
"inactiveRegions")) {
532 if (
auto *Window = Experimental->getObject(
"window")) {
534 Window->getBoolean(
"implicitWorkDoneProgressCreate")) {
541 P.field(
"offsetEncoding")))
550 llvm::json::Path P) {
551 llvm::json::ObjectMapper O(Params, P);
560 if (
auto *RawCaps = Params.getAsObject()->getObject(
"capabilities"))
562 O.map(
"trace", R.
trace);
568 return llvm::json::Object{{
"token", P.
token}};
572 llvm::json::Object Result{
577 Result[
"cancellable"] =
true;
579 Result[
"percentage"] = 0;
582 return std::move(Result);
586 llvm::json::Object Result{{
"kind",
"report"}};
590 Result[
"message"] = *P.
message;
594 return std::move(Result);
598 llvm::json::Object Result{{
"kind",
"end"}};
600 Result[
"message"] = *P.
message;
602 return std::move(Result);
606 return static_cast<int64_t
>(R);
610 return llvm::json::Object{{
"type", R.
type}, {
"message", R.
message}};
614 llvm::json::Path P) {
615 llvm::json::ObjectMapper O(Params, P);
620 llvm::json::Path P) {
621 llvm::json::ObjectMapper O(Params, P);
626 llvm::json::Path P) {
627 llvm::json::ObjectMapper O(Params, P);
632 llvm::json::Path P) {
633 llvm::json::ObjectMapper O(Params, P);
637 mapOptOrNull(Params,
"forceRebuild", R.
forceRebuild, P);
641 llvm::json::Path P) {
642 if (
auto T =
E.getAsInteger()) {
653 llvm::json::Path P) {
654 llvm::json::ObjectMapper O(Params, P);
655 return O && O.map(
"uri", R.
uri) && O.map(
"type", R.
type);
659 llvm::json::Path P) {
660 llvm::json::ObjectMapper O(Params, P);
661 return O && O.map(
"changes", R.
changes);
666 llvm::json::ObjectMapper O(Params, P);
667 return O && O.map(
"range", R.
range) && O.map(
"rangeLength", R.
rangeLength) &&
668 O.map(
"text", R.
text);
672 llvm::json::Path P) {
673 llvm::json::ObjectMapper O(Params, P);
679 llvm::json::ObjectMapper O(Params, P);
681 O.map(
"position", R.
position) && O.map(
"ch", R.
ch);
685 llvm::json::Path P) {
686 llvm::json::ObjectMapper O(Params, P);
691 llvm::json::Path P) {
692 llvm::json::ObjectMapper O(Params, P);
697 return llvm::json::Object{
706 return llvm::json::Object{{
"href", D.href}};
710 llvm::json::Object
Diag{
712 {
"severity", D.severity},
713 {
"message", D.message},
716 Diag[
"category"] = *D.category;
718 Diag[
"codeActions"] = D.codeActions;
720 Diag[
"code"] = D.code;
721 if (D.codeDescription)
722 Diag[
"codeDescription"] = *D.codeDescription;
723 if (!D.source.empty())
724 Diag[
"source"] = D.source;
725 if (D.relatedInformation)
726 Diag[
"relatedInformation"] = *D.relatedInformation;
728 Diag[
"data"] = llvm::json::Object(D.data);
730 Diag[
"tags"] = llvm::json::Array{D.tags};
732 return std::move(
Diag);
736 llvm::json::Path P) {
737 llvm::json::ObjectMapper O(Params, P);
740 if (
auto *Data = Params.getAsObject()->getObject(
"data"))
742 return O.map(
"range", R.
range) && O.map(
"message", R.
message) &&
743 mapOptOrNull(Params,
"severity", R.
severity, P) &&
744 mapOptOrNull(Params,
"category", R.
category, P) &&
745 mapOptOrNull(Params,
"code", R.
code, P) &&
746 mapOptOrNull(Params,
"source", R.
source, P);
750 llvm::json::Object Result{
755 Result[
"version"] = PDP.
version;
756 return std::move(Result);
760 llvm::json::Path P) {
761 llvm::json::ObjectMapper O(Params, P);
764 O.map(
"only", R.
only);
769 OS << D.range <<
" [";
770 switch (D.severity) {
787 return OS <<
'(' << D.severity <<
"): " << D.message <<
"]";
791 llvm::json::Path P) {
792 llvm::json::ObjectMapper O(Params, P);
798 llvm::json::Path P) {
799 llvm::json::ObjectMapper O(Params, P);
800 return O && O.map(
"changes", R.
changes) &&
806 llvm::json::Path P) {
807 llvm::json::ObjectMapper O(Params, P);
808 if (!O || !O.map(
"command", R.
command))
811 const auto *
Args = Params.getAsObject()->get(
"arguments");
814 const auto *ArgsArray =
Args->getAsArray();
816 P.field(
"arguments").report(
"expected array");
819 if (ArgsArray->size() > 1) {
820 P.field(
"arguments").report(
"Command should have 0 or 1 argument");
823 if (ArgsArray->size() == 1) {
830 llvm::json::Object O{
832 {
"kind",
static_cast<int>(P.
kind)},
837 O[
"score"] = *P.
score;
855 llvm::json::Object Result{{
"name", llvm::json::Value(
nullptr)},
856 {
"containerName", llvm::json::Value(
nullptr)},
857 {
"usr", llvm::json::Value(
nullptr)},
858 {
"id", llvm::json::Value(
nullptr)}};
861 Result[
"name"] = P.
name;
867 Result[
"usr"] = P.
USR;
870 Result[
"id"] = P.
ID.
str();
879 return std::move(Result);
883 if (!S.containerName.empty()) {
884 O << S.containerName;
885 llvm::StringRef ContNameRef;
886 if (!ContNameRef.ends_with(
"::")) {
890 O << S.name <<
" - " <<
toJSON(S);
895 llvm::json::Path P) {
896 llvm::json::ObjectMapper O(Params, P);
897 return O && O.map(
"query", R.
query) &&
898 mapOptOrNull(Params,
"limit", R.
limit, P);
902 auto Cmd = llvm::json::Object{{
"title",
C.title}, {
"command",
C.command}};
903 if (!
C.argument.getAsNull())
904 Cmd[
"arguments"] = llvm::json::Array{
C.argument};
905 return std::move(Cmd);
928 return O << S.name <<
" - " <<
toJSON(S);
932 llvm::json::Object Result{{
"name", S.name},
933 {
"kind",
static_cast<int>(S.kind)},
935 {
"selectionRange", S.selectionRange}};
937 if (!S.detail.empty())
938 Result[
"detail"] = S.detail;
939 if (!S.children.empty())
940 Result[
"children"] = S.children;
942 Result[
"deprecated"] =
true;
944 return std::move(Result);
948 llvm::json::Object Result;
950 llvm::json::Object FileChanges;
951 for (
auto &Change : *WE.
changes)
952 FileChanges[Change.first] = llvm::json::Array(Change.second);
953 Result[
"changes"] = std::move(FileChanges);
958 llvm::json::Object ChangeAnnotations;
960 ChangeAnnotations[Annotation.first] = Annotation.second;
961 Result[
"changeAnnotations"] = std::move(ChangeAnnotations);
967 llvm::json::Path P) {
968 llvm::json::ObjectMapper O(Params, P);
969 return O && O.map(
"file", A.file) && O.map(
"selection", A.selection) &&
970 O.map(
"tweakID", A.tweakID);
974 return llvm::json::Object{
975 {
"tweakID", A.tweakID}, {
"selection", A.selection}, {
"file", A.file}};
979 return llvm::json::Object{{
"edit", Params.
edit}};
983 llvm::json::Path P) {
984 llvm::json::ObjectMapper O(Response, P);
985 return O && O.map(
"applied", R.
applied) &&
990 llvm::json::Path P) {
991 llvm::json::ObjectMapper O(Params, P);
997 llvm::json::Path P) {
998 llvm::json::ObjectMapper O(Params, P);
1000 if (!O || !O.map(
"triggerKind", TriggerKind) ||
1008 llvm::json::Path P) {
1010 !mapOptOrNull(Params,
"limit", R.
limit, P))
1012 if (
auto *
Context = Params.getAsObject()->
get(
"context"))
1024 llvm_unreachable(
"Invalid MarkupKind");
1028 auto Str = V.getAsString();
1030 P.report(
"expected string");
1033 if (*Str ==
"plaintext")
1035 else if (*Str ==
"markdown")
1038 P.report(
"unknown markup kind");
1049 if (MC.
value.empty())
1052 return llvm::json::Object{
1054 {
"value", MC.
value},
1059 llvm::json::Object Result{{
"contents",
toJSON(H.contents)}};
1062 Result[
"range"] =
toJSON(*H.range);
1064 return std::move(Result);
1068 llvm::json::Path P) {
1069 if (
auto T =
E.getAsInteger()) {
1082 auto KindVal =
static_cast<size_t>(
Kind);
1084 KindVal <= SupportedCompletionItemKinds.size() &&
1085 SupportedCompletionItemKinds[KindVal])
1102 llvm::json::Path P) {
1103 if (
auto *A =
E.getAsArray()) {
1104 for (
size_t I = 0; I < A->size(); ++I) {
1106 if (
fromJSON((*A)[I], KindOut, P.index(I)))
1107 Out.set(
size_t(KindOut));
1115 llvm::json::Object Result;
1117 Result[
"detail"] = CD.
detail;
1124 if (!
C.labelDetails)
1126 if (!
C.labelDetails->detail.empty())
1127 C.label +=
C.labelDetails->detail;
1128 if (!
C.labelDetails->description.empty())
1129 C.label =
C.labelDetails->description +
C.label;
1130 C.labelDetails.reset();
1134 assert(!
CI.label.empty() &&
"completion item label is required");
1135 llvm::json::Object Result{{
"label",
CI.label}};
1137 Result[
"kind"] =
static_cast<int>(
CI.kind);
1138 if (!
CI.detail.empty())
1139 Result[
"detail"] =
CI.detail;
1140 if (
CI.labelDetails)
1141 Result[
"labelDetails"] = *
CI.labelDetails;
1142 if (
CI.documentation)
1143 Result[
"documentation"] =
CI.documentation;
1144 if (!
CI.sortText.empty())
1145 Result[
"sortText"] =
CI.sortText;
1146 if (!
CI.filterText.empty())
1147 Result[
"filterText"] =
CI.filterText;
1148 if (!
CI.insertText.empty())
1149 Result[
"insertText"] =
CI.insertText;
1151 Result[
"insertTextFormat"] =
static_cast<int>(
CI.insertTextFormat);
1153 Result[
"textEdit"] = *
CI.textEdit;
1154 if (!
CI.additionalTextEdits.empty())
1155 Result[
"additionalTextEdits"] = llvm::json::Array(
CI.additionalTextEdits);
1157 Result[
"deprecated"] =
CI.deprecated;
1158 Result[
"score"] =
CI.score;
1159 return std::move(Result);
1168 return (L.sortText.empty() ? L.label : L.sortText) <
1173 return llvm::json::Object{
1174 {
"isIncomplete", L.isIncomplete},
1175 {
"items", llvm::json::Array(L.items)},
1180 assert((PI.labelOffsets || !PI.labelString.empty()) &&
1181 "parameter information label is required");
1182 llvm::json::Object Result;
1183 if (PI.labelOffsets)
1185 llvm::json::Array({PI.labelOffsets->first, PI.labelOffsets->second});
1187 Result[
"label"] = PI.labelString;
1188 if (!PI.documentation.empty())
1189 Result[
"documentation"] = PI.documentation;
1190 return std::move(Result);
1194 assert(!SI.
label.empty() &&
"signature information label is required");
1195 llvm::json::Object Result{
1196 {
"label", SI.
label},
1197 {
"parameters", llvm::json::Array(SI.
parameters)},
1201 return std::move(Result);
1212 "Unexpected negative value for number of active signatures.");
1214 "Unexpected negative value for active parameter index");
1215 return llvm::json::Object{
1218 {
"signatures", llvm::json::Array(SH.
signatures)},
1223 llvm::json::Path P) {
1224 llvm::json::ObjectMapper O(Params, P);
1230 return llvm::json::Object{
1240 return llvm::json::Object{
1247 return llvm::json::Object{
1249 {
"kind",
static_cast<int>(DH.
kind)},
1254 return llvm::json::Object{
1255 {
"uri", FStatus.
uri},
1256 {
"state", FStatus.
state},
1262 llvm::json::Array Result;
1264 for (
const auto &Tok : Toks) {
1265 Result.push_back(Tok.deltaLine);
1266 Result.push_back(Tok.deltaStart);
1267 Result.push_back(Tok.length);
1268 Result.push_back(Tok.tokenType);
1269 Result.push_back(Tok.tokenModifiers);
1272 return std::move(Result);
1276 return std::tie(L.deltaLine, L.deltaStart, L.length, L.tokenType,
1283 return llvm::json::Object{{
"resultId", Tokens.resultId},
1288 return llvm::json::Object{
1295 llvm::json::Object Result{{
"resultId", TE.
resultId}};
1297 Result[
"edits"] = *TE.
edits;
1300 return std::move(Result);
1304 llvm::json::Path P) {
1305 llvm::json::ObjectMapper O(Params, P);
1310 llvm::json::Path P) {
1311 llvm::json::ObjectMapper O(Params, P);
1317 return llvm::json::Object{
1334 llvm::json::ObjectMapper O(Params, P);
1335 return O && O.map(
"settings", CCP.
settings);
1339 llvm::json::Path P) {
1340 llvm::json::ObjectMapper O(Params, P);
1346 llvm::json::Path P) {
1347 llvm::json::ObjectMapper O(Params, P);
1350 return mapOptOrNull(Params,
"compilationDatabaseChanges",
1351 S.compilationDatabaseChanges, P);
1355 llvm::json::Path P) {
1356 llvm::json::ObjectMapper O(Params, P);
1360 return fromJSON(Params, Opts.ConfigSettings, P) &&
1361 O.map(
"compilationDatabasePath", Opts.compilationDatabasePath) &&
1362 mapOptOrNull(Params,
"fallbackFlags", Opts.fallbackFlags, P) &&
1363 mapOptOrNull(Params,
"clangdFileStatus", Opts.FileStatus, P);
1367 llvm::json::Path P) {
1368 auto T =
E.getAsInteger();
1379 llvm::json::Path P) {
1380 llvm::json::ObjectMapper O(Params, P);
1383 mapOptOrNull(Params,
"resolve", R.
resolve, P) &&
1384 mapOptOrNull(Params,
"direction", R.
direction, P);
1393 llvm::json::Object Result{{
"symbolID", RP.
symbolID}};
1395 Result[
"parents"] = RP.
parents;
1396 return std::move(Result);
1400 llvm::json::ObjectMapper O(Params, P);
1401 return O && O.map(
"symbolID", RP.
symbolID) &&
1402 mapOptOrNull(Params,
"parents", RP.
parents, P);
1406 llvm::json::Object Result{
1407 {
"name", I.
name}, {
"kind",
static_cast<int>(I.
kind)},
1409 {
"uri", I.
uri}, {
"data", I.
data},
1413 Result[
"detail"] = I.
detail;
1414 return std::move(Result);
1418 llvm::json::Path P) {
1419 llvm::json::ObjectMapper O(Params, P);
1422 return O && O.map(
"name", I.
name) && O.map(
"kind", I.
kind) &&
1423 O.map(
"uri", I.
uri) && O.map(
"range", I.
range) &&
1425 mapOptOrNull(Params,
"detail", I.
detail, P) &&
1426 mapOptOrNull(Params,
"deprecated", I.
deprecated, P) &&
1427 mapOptOrNull(Params,
"parents", I.
parents, P) &&
1428 mapOptOrNull(Params,
"children", I.
children, P) &&
1429 mapOptOrNull(Params,
"data", I.
data, P);
1434 llvm::json::ObjectMapper O(Params, P);
1435 return O && O.map(
"item", R.
item) &&
1436 mapOptOrNull(Params,
"resolve", R.
resolve, P) &&
1437 mapOptOrNull(Params,
"direction", R.
direction, P);
1441 llvm::json::Path P) {
1442 llvm::json::ObjectMapper O(Params, P);
1447 llvm::json::Path P) {
1449 llvm::json::ObjectMapper O(Params, P);
1450 return fromJSON(Params, Base, P) && O && O.mapOptional(
"context", R.
context);
1454 return llvm::json::Value(
static_cast<int>(
Tag));
1458 llvm::json::Object Result{{
"name", I.
name},
1459 {
"kind",
static_cast<int>(I.
kind)},
1463 if (!I.
tags.empty())
1464 Result[
"tags"] = I.
tags;
1466 Result[
"detail"] = I.
detail;
1467 if (!I.
data.empty())
1468 Result[
"data"] = I.
data;
1469 return std::move(Result);
1473 llvm::json::Path P) {
1474 llvm::json::ObjectMapper O(Params, P);
1479 return O && O.map(
"name", I.
name) && O.map(
"kind", I.
kind) &&
1480 O.map(
"uri", I.
uri) && O.map(
"range", I.
range) &&
1482 mapOptOrNull(Params,
"data", I.
data, P);
1487 llvm::json::ObjectMapper O(Params, P);
1488 return O.map(
"item",
C.item);
1492 return llvm::json::Object{{
"from",
C.from}, {
"fromRanges",
C.fromRanges}};
1497 llvm::json::ObjectMapper O(Params, P);
1498 return O.map(
"item",
C.item);
1502 return llvm::json::Object{{
"to",
C.to}, {
"fromRanges",
C.fromRanges}};
1506 llvm::json::Path P) {
1507 llvm::json::ObjectMapper O(Params, P);
1523 llvm_unreachable(
"Unknown clang.clangd.InlayHintKind");
1527 llvm::json::Object Result{{
"position", H.position},
1529 {
"paddingLeft", H.paddingLeft},
1530 {
"paddingRight", H.paddingRight}};
1533 Result[
"kind"] = std::move(
K);
1534 return std::move(Result);
1537 return std::tie(A.position, A.range, A.kind, A.label) ==
1538 std::tie(B.position, B.range, B.kind, B.label);
1541 return std::tie(A.position, A.range, A.kind, A.label) <
1542 std::tie(B.position, B.range, B.kind, B.label);
1545 return llvm::join(llvm::map_range(
label, [](
auto &L) {
return L.value; }),
1557 return "designator";
1561 return "default-argument";
1563 llvm_unreachable(
"Unknown clang.clangd.InlayHintKind");
1565 return OS << ToString(
Kind);
1569 llvm::json::Object Result{{
"value", L.value}};
1571 Result[
"tooltip"] = *L.tooltip;
1573 Result[
"location"] = *L.location;
1575 Result[
"command"] = *L.command;
1591 OS <<
" (" << L.location <<
")";
1606 llvm_unreachable(
"Unknown clang.clangd.OffsetEncoding");
1610 llvm::json::Path P) {
1611 auto Str = V.getAsString();
1614 OE = llvm::StringSwitch<OffsetEncoding>(*Str)
1626 llvm::json::Path P) {
1627 llvm::json::ObjectMapper O(Params, P);
1628 return O && O.map(
"textDocument", S.textDocument) &&
1629 O.map(
"positions", S.positions);
1634 return llvm::json::Object{{
"range",
Out.range},
1637 return llvm::json::Object{{
"range",
Out.range}};
1641 llvm::json::Path P) {
1642 llvm::json::ObjectMapper O(Params, P);
1647 return llvm::json::Object{
1654 llvm::json::Path P) {
1655 llvm::json::ObjectMapper O(Params, P);
1664 llvm::json::Object Result{
1665 {
"startLine",
Range.startLine},
1666 {
"endLine",
Range.endLine},
1668 if (
Range.startCharacter)
1669 Result[
"startCharacter"] =
Range.startCharacter;
1670 if (
Range.endCharacter)
1671 Result[
"endCharacter"] =
Range.endCharacter;
1672 if (!
Range.kind.empty())
1673 Result[
"kind"] =
Range.kind;
1678 llvm::json::Object
Out;
1683 Total += *Child.getAsObject()->getInteger(
"_total");
1684 Out[
Entry.first] = std::move(Child);
1691 llvm::json::Path P) {
1692 llvm::json::ObjectMapper O(Params, P);
1697 llvm::json::Object Result{
1704 Result[
"detail"] = N.
detail;
1706 Result[
"arcana"] = N.
arcana;
1708 Result[
"range"] = *N.
range;
1713 std::function<void(
const ASTNode &,
unsigned)> Print = [&](
const ASTNode &N,
1715 OS.indent(2 * Level) << N.
role <<
": " << N.
kind;
1720 Print(
C, Level + 1);
1727 auto Str =
E.getAsString();
1729 P.report(
"expected a string");
1734 elog(
"Malformed symbolid: {0}",
ID.takeError());
1735 P.report(
"malformed symbolid");
CompiledFragmentImpl & Out
std::unique_ptr< CompilerInvocation > CI
WantDiagnostics Diagnostics
A context is an immutable container for per-request data that must be propagated through layers that ...
const Type * get(const Key< Type > &Key) const
Get data stored for a typed Key.
static llvm::Expected< SymbolID > fromStr(llvm::StringRef)
A URI describes the location of a source file.
static llvm::Expected< std::string > resolvePath(llvm::StringRef AbsPath, llvm::StringRef HintPath="")
Resolves AbsPath into a canonical path of its URI, by converting AbsPath to URI and resolving the URI...
static llvm::Expected< std::string > resolve(const URI &U, llvm::StringRef HintPath="")
Resolves the absolute path of U.
static llvm::Expected< URI > parse(llvm::StringRef Uri)
Parse a URI string "<scheme>:[//<authority>/]<path>".
@ Created
The file got created.
@ Deleted
The file got deleted.
@ Info
An information message.
std::bitset< SymbolKindMax+1 > SymbolKindBitset
constexpr auto CompletionItemKindMin
constexpr auto SymbolKindMin
CompletionItemKind
The kind of a completion entry.
static const char * toString(OffsetEncoding OE)
bool operator==(const Inclusion &LHS, const Inclusion &RHS)
constexpr unsigned SemanticTokenEncodingSize
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
llvm::json::Value toJSON(const FuzzyFindRequest &Request)
SymbolKind adjustKindToCapability(SymbolKind Kind, SymbolKindBitset &SupportedSymbolKinds)
void removeCompletionLabelDetails(CompletionItem &C)
Remove the labelDetails field (for clients that don't support it).
bool operator<(const Ref &L, const Ref &R)
SymbolKind indexSymbolKindToSymbolKind(index::SymbolKind Kind)
static llvm::StringRef toTextKind(MarkupKind Kind)
InlayHintKind
Inlay hint kinds.
@ BlockEnd
A hint after function, type or namespace definition, indicating the defined symbol name of the defini...
@ DefaultArgument
An inlay hint that is for a default argument.
@ Parameter
An inlay hint that is for a parameter.
@ Type
An inlay hint that for a type annotation.
@ Designator
A hint before an element of an aggregate braced initializer list, indicating what it is initializing.
static llvm::json::Value encodeTokens(llvm::ArrayRef< SemanticToken > Toks)
std::bitset< CompletionItemKindMax+1 > CompletionItemKindBitset
void elog(const char *Fmt, Ts &&... Vals)
bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request, llvm::json::Path P)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Simplified description of a clang AST node.
std::optional< Range > range
The range of the original source file covered by this node.
std::vector< ASTNode > children
Nodes nested within this one, such as the operands of a BinaryOperator.
std::string role
The general kind of node, such as "expression" Corresponds to the base AST node type such as Expr.
std::string kind
The specific kind of node this is, such as "BinaryOperator".
std::string detail
Brief additional information, such as "||" for the particular operator.
std::string arcana
A one-line dump of detailed information about the node.
Payload for textDocument/ast request.
std::optional< Range > range
The position of the node to be dumped.
TextDocumentIdentifier textDocument
The text document.
std::optional< std::string > failureReason
Represents an incoming call, e.g. a caller of a method or constructor.
The parameter of a callHierarchy/incomingCalls request.
Represents programming constructs like functions or constructors in the context of call hierarchy.
std::string name
The name of this item.
URIForFile uri
The resource identifier of this item.
Range range
The range enclosing this symbol not including leading / trailing whitespace but everything else,...
SymbolKind kind
The kind of this item.
std::vector< SymbolTag > tags
Tags for this item.
std::string data
An optional 'data' field, which can be used to identify a call hierarchy item in an incomingCalls or ...
std::string detail
More detaill for this item, e.g. the signature of a function.
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Represents an outgoing call, e.g.
The parameter of a callHierarchy/outgoingCalls request.
std::string description
A human-readable string which is rendered less prominent in the user interface.
std::string label
A human-readable string describing the actual change.
std::optional< bool > needsConfirmation
A flag which indicates that user confirmation is needed before applying the change.
Clangd extension that's used in the 'compilationDatabaseChanges' in workspace/didChangeConfiguration ...
std::string workingDirectory
std::vector< std::string > compilationCommand
bool HierarchicalDocumentSymbol
Client supports hierarchical document symbols.
bool WorkDoneProgress
The client supports progress notifications.
bool DiagnosticCategory
Whether the client accepts diagnostics with category attached to it using the "category" extension.
bool CompletionLabelDetail
The client has support for completion item label details.
MarkupKind HoverContentFormat
The content format that should be used for Hover requests.
bool CodeActionStructure
Client supports CodeAction return value for textDocument/codeAction.
bool OffsetsInSignatureHelp
Client supports processing label offsets instead of a simple label string.
bool DiagnosticFixes
Whether the client accepts diagnostics with codeActions attached inline.
bool HasSignatureHelp
Client supports signature help.
bool TheiaSemanticHighlighting
Client supports Theia semantic highlighting extension.
bool SemanticTokenRefreshSupport
Whether the client implementation supports a refresh request sent from the server to the client.
bool DocumentChanges
The client supports versioned document changes for WorkspaceEdit.
bool ImplicitProgressCreation
The client supports implicit $/progress work-done progress streams, without a preceding window/workDo...
MarkupKind SignatureHelpDocumentationFormat
The documentation format that should be used for textDocument/signatureHelp.
bool DiagnosticRelatedInformation
Whether the client accepts diagnostics with related locations.
bool CompletionFixes
Client supports completions with additionalTextEdit near the cursor.
bool RenamePrepareSupport
The client supports testing for validity of rename operations before execution.
bool CancelsStaleRequests
Whether the client claims to cancel stale requests.
std::optional< CompletionItemKindBitset > CompletionItemKinds
The supported set of CompletionItemKinds for textDocument/completion.
bool CompletionSnippets
Client supports snippets as insert text.
MarkupKind CompletionDocumentationFormat
The documentation format that should be used for textDocument/completion.
bool SemanticTokens
Client advertises support for the semanticTokens feature.
bool ChangeAnnotation
The client supports change annotations on text edits,.
bool LineFoldingOnly
Client signals that it only supports folding complete lines.
bool InactiveRegions
Whether the client supports the textDocument/inactiveRegions notification.
std::optional< SymbolKindBitset > WorkspaceSymbolKinds
The supported set of SymbolKinds for workspace/symbol.
std::optional< std::vector< OffsetEncoding > > offsetEncoding
Supported encodings for LSP character offsets. (clangd extension).
bool ReferenceContainer
Client supports displaying a container string for results of textDocument/reference (clangd extension...
std::vector< Diagnostic > diagnostics
An array of diagnostics known on the client side overlapping the range provided to the textDocument/c...
std::vector< std::string > only
Requested kind of actions to return.
CodeActionContext context
Context carrying additional information.
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Range range
The range for which the command was invoked.
A code action represents a change that can be performed in code, e.g.
static const llvm::StringLiteral INFO_KIND
bool isPreferred
Marks this as a preferred action.
static const llvm::StringLiteral REFACTOR_KIND
std::optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
static const llvm::StringLiteral QUICKFIX_KIND
std::optional< WorkspaceEdit > edit
The workspace edit this code action performs.
std::optional< Command > command
A command this code action executes.
std::optional< std::string > kind
The kind of the code action.
std::string title
A short, human-readable, title for this code action.
Structure to capture a description for an error code.
CompletionTriggerKind triggerKind
How the completion was triggered.
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
Additional details for a completion item label.
std::string detail
An optional string which is rendered less prominently directly after label without any spacing.
std::string description
An optional string which is rendered less prominently after CompletionItemLabelDetails....
std::string sortText
A string that should be used when comparing this item with other items.
std::string label
The label of this completion item.
Represents a collection of completion items to be presented in the editor.
std::optional< int > limit
Max results to return, overriding global default.
CompletionContext context
Clangd extension: parameters configurable at any time, via the workspace/didChangeConfiguration notif...
A top-level diagnostic that may have Notes and Fixes.
llvm::json::Object data
A data entry field that is preserved between a textDocument/publishDiagnostics notification and textD...
std::string code
The diagnostic's code. Can be omitted.
Range range
The range at which the message applies.
std::string source
A human-readable string describing the source of this diagnostic, e.g.
std::string message
The diagnostic's message.
int severity
The diagnostic's severity.
std::optional< std::string > category
The diagnostic's category.
ConfigurationSettings settings
bool forceRebuild
Force a complete rebuild of the file, ignoring all cached state.
VersionedTextDocumentIdentifier textDocument
The document that did change.
std::optional< bool > wantDiagnostics
Forces diagnostics to be generated, or to not be generated, for this version of the file.
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
std::vector< FileEvent > changes
The actual file events.
TextDocumentIdentifier textDocument
The document that was closed.
TextDocumentItem textDocument
The document that was opened.
TextDocumentIdentifier textDocument
The document that was saved.
A document highlight is a range inside a text document which deserves special attention.
Range range
The range this highlight applies to.
DocumentHighlightKind kind
The highlight kind, default is DocumentHighlightKind.Text.
Parameters for the document link request.
TextDocumentIdentifier textDocument
The document to provide document links for.
A range in a text document that links to an internal or external resource, like another text document...
Range range
The range this link applies to.
URIForFile target
The uri this link points to. If missing a resolve request is sent later.
TextDocumentIdentifier textDocument
Represents programming constructs like variables, classes, interfaces etc.
A set of edits generated for a single file.
llvm::json::Value argument
std::string command
The identifier of the actual command handler.
FileChangeType type
The change type.
URIForFile uri
The file's URI.
Clangd extension: indicates the current state of the file in clangd, sent from server via the textDoc...
URIForFile uri
The text document's URI.
std::string state
The human-readable string presents the current state of the file, can be shown in the UI (e....
TextDocumentIdentifier textDocument
Stores information about a region of code that can be folded.
static const llvm::StringLiteral REGION_KIND
static const llvm::StringLiteral COMMENT_KIND
static const llvm::StringLiteral IMPORT_KIND
Parameters for the inactive regions (server-side) push notification.
TextDocumentIdentifier TextDocument
The textdocument these inactive regions belong to.
std::vector< Range > InactiveRegions
The inactive regions that should be sent.
Clangd extension: parameters configurable at initialize time.
llvm::json::Object rawCapabilities
The same data as capabilities, but not parsed (to expose to modules).
InitializationOptions initializationOptions
User-provided initialization options.
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool)
std::optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
std::optional< int > processId
The process Id of the parent process that started the server.
std::optional< std::string > rootPath
The rootPath of the workspace.
std::optional< URIForFile > rootUri
The rootUri of the workspace.
An inlay hint label part allows for interactive and composite labels of inlay hints.
std::optional< Location > location
An optional source code location that represents this label part.
std::string value
The value of this label part.
std::string joinLabels() const
Join the label[].value together.
std::vector< InlayHintLabelPart > label
The label of this hint.
A parameter literal used in inlay hint requests.
std::optional< Range > range
The visible document range for which inlay hints should be computed.
TextDocumentIdentifier textDocument
The text document.
URIForFile uri
The text document's URI.
A tree that can be used to represent memory usage of nested components while preserving the hierarchy...
const llvm::DenseMap< llvm::StringRef, MemoryTree > & children() const
Returns edges to direct children of this node.
size_t self() const
Returns total number of bytes used by this node only.
int line
Line position in a document (zero-based).
int character
Character offset on a line in a document (zero-based).
std::string placeholder
Placeholder text to use in the editor if non-empty.
Range range
Range of the string to rename.
std::vector< Diagnostic > diagnostics
An array of diagnostic information items.
std::optional< int64_t > version
The version number of the document the diagnostics are published for.
URIForFile uri
The URI for which diagnostic information is reported.
Position start
The range's start position.
Position end
The range's end position.
bool includeDeclaration
Include the declaration of the current symbol.
Extends Locations returned by textDocument/references with extra info.
std::optional< std::string > containerName
clangd extension: contains the name of the function or class in which the reference occurs
TextDocumentIdentifier textDocument
The document that was opened.
Position position
The position at which this request was sent.
std::string newName
The new name of the symbol.
Parameters for the typeHierarchy/resolve request.
TypeHierarchyItem item
The item to resolve.
int resolve
The hierarchy levels to resolve. 0 indicates no level.
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
Specifies a single semantic token in the document.
unsigned length
the length of the token. A token cannot be multiline
unsigned deltaStart
token start character, relative to the previous token (relative to 0 or the previous token's start if...
unsigned deltaLine
token line number, relative to the previous token
unsigned tokenType
will be looked up in SemanticTokensLegend.tokenTypes
unsigned tokenModifiers
each set bit will be looked up in SemanticTokensLegend.tokenModifiers
Body of textDocument/semanticTokens/full/delta request.
TextDocumentIdentifier textDocument
The text document.
std::string previousResultId
The previous result id.
Describes a replacement of a contiguous range of semanticTokens.
This models LSP SemanticTokensDelta | SemanticTokens, which is the result of textDocument/semanticTok...
std::optional< std::vector< SemanticToken > > tokens
Set if we computed a fresh set of tokens.
std::optional< std::vector< SemanticTokensEdit > > edits
Set if we computed edits relative to a previous set of tokens.
Body of textDocument/semanticTokens/full request.
TextDocumentIdentifier textDocument
The text document.
A versioned set of tokens.
The show message notification is sent from a server to a client to ask the client to display a partic...
MessageType type
The message type.
std::string message
The actual message.
Represents the signature of a callable.
int activeSignature
The active signature.
std::vector< SignatureInformation > signatures
The resulting signatures.
int activeParameter
The active parameter of the active signature.
Represents information about identifier.
std::optional< Location > definitionRange
std::string containerName
std::optional< Location > declarationRange
std::string USR
Unified Symbol Resolution identifier This is an opaque string uniquely identifying a symbol.
The class presents a C++ symbol, e.g.
std::optional< Range > range
The range of the document that changed.
std::string text
The new text of the range/document.
std::optional< int > rangeLength
The length of the range that got replaced.
VersionedTextDocumentIdentifier textDocument
The text document to change.
std::vector< TextEdit > edits
The edits to be applied.
URIForFile uri
The text document's URI.
std::string languageId
The text document's language identifier.
std::optional< int64_t > version
The version number of this document (it will strictly increase after each change, including undo/redo...
URIForFile uri
The text document's URI.
std::string text
The content of the opened text document.
TextDocumentIdentifier textDocument
The text document.
Position position
The position inside the text document.
std::string newText
The string to be inserted.
ChangeAnnotationIdentifier annotationId
The actual annotation identifier (optional) If empty, then this field is nullopt.
Range range
The range of the text document to be manipulated.
Arguments for the 'applyTweak' command.
Used to resolve a client provided item back.
std::optional< std::vector< ResolveParams > > parents
std::nullopt means parents aren't resolved and empty is no parents.
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else,...
URIForFile uri
The resource identifier of this item.
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
SymbolKind kind
The kind of this item.
std::optional< std::vector< TypeHierarchyItem > > children
If this type hierarchy item is resolved, it contains the direct children of the current item.
std::optional< std::vector< TypeHierarchyItem > > parents
This is a clangd exntesion.
bool deprecated
true if the hierarchy item is deprecated.
std::optional< std::string > detail
More detail for this item, e.g. the signature of a function.
ResolveParams data
A data entry field that is preserved between a type hierarchy prepare and supertypes or subtypes requ...
std::string name
The name of this item.
The type hierarchy params is an extension of the TextDocumentPositionsParams with optional properties...
int resolve
The hierarchy levels to resolve.
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
static llvm::Expected< URIForFile > fromURI(const URI &U, llvm::StringRef HintPath)
static URIForFile canonicalize(llvm::StringRef AbsPath, llvm::StringRef TUPath)
Canonicalizes AbsPath via URI.
std::optional< std::int64_t > version
The version number of this document.
To start progress reporting a $/progress notification with the following payload must be sent.
bool percentage
Optional progress percentage to display (value 100 is considered 100%).
bool cancellable
Controls if a cancel button should show to allow the user to cancel the long-running operation.
std::string title
Mandatory title of the progress operation.
llvm::json::Value token
The token to be used to report progress.
Signals the end of progress reporting.
std::optional< std::string > message
Optional, a final message indicating to for example indicate the outcome of the operation.
Reporting progress is done using the following payload.
std::optional< unsigned > percentage
Optional progress percentage to display (value 100 is considered 100%).
std::optional< bool > cancellable
Controls enablement state of a cancel button.
std::optional< std::string > message
Optional, more detailed associated progress message.
The edit should either provide changes or documentChanges.
std::optional< std::vector< TextDocumentEdit > > documentChanges
Versioned document edits.
std::map< std::string, ChangeAnnotation > changeAnnotations
A map of change annotations that can be referenced in AnnotatedTextEdit.
std::optional< std::map< std::string, std::vector< TextEdit > > > changes
Holds changes to existing resources.
The parameters of a Workspace Symbol Request.
std::string query
A query string to filter symbols by.
std::optional< int > limit
Max results to return, overriding global default.