clang-tools  16.0.0git
Protocol.cpp
Go to the documentation of this file.
1 //===--- Protocol.cpp - Language Server Protocol Implementation -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the serialization code for the LSP structs.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "Protocol.h"
14 #include "URI.h"
15 #include "support/Logger.h"
16 #include "clang/Basic/LLVM.h"
17 #include "clang/Index/IndexSymbol.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ADT/StringSwitch.h"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/JSON.h"
22 #include "llvm/Support/Path.h"
23 #include "llvm/Support/raw_ostream.h"
24 
25 namespace clang {
26 namespace clangd {
27 namespace {
28 
29 // Helper that doesn't treat `null` and absent fields as failures.
30 template <typename T>
31 bool mapOptOrNull(const llvm::json::Value &Params, llvm::StringLiteral Prop,
32  T &Out, llvm::json::Path P) {
33  auto *O = Params.getAsObject();
34  assert(O);
35  auto *V = O->get(Prop);
36  // Field is missing or null.
37  if (!V || V->getAsNull())
38  return true;
39  return fromJSON(*V, Out, P.field(Prop));
40 }
41 } // namespace
42 
43 char LSPError::ID;
44 
45 URIForFile URIForFile::canonicalize(llvm::StringRef AbsPath,
46  llvm::StringRef TUPath) {
47  assert(llvm::sys::path::is_absolute(AbsPath) && "the path is relative");
48  auto Resolved = URI::resolvePath(AbsPath, TUPath);
49  if (!Resolved) {
50  elog("URIForFile: failed to resolve path {0} with TU path {1}: "
51  "{2}.\nUsing unresolved path.",
52  AbsPath, TUPath, Resolved.takeError());
53  return URIForFile(std::string(AbsPath));
54  }
55  return URIForFile(std::move(*Resolved));
56 }
57 
58 llvm::Expected<URIForFile> URIForFile::fromURI(const URI &U,
59  llvm::StringRef HintPath) {
60  auto Resolved = URI::resolve(U, HintPath);
61  if (!Resolved)
62  return Resolved.takeError();
63  return URIForFile(std::move(*Resolved));
64 }
65 
67  if (auto S = E.getAsString()) {
68  auto Parsed = URI::parse(*S);
69  if (!Parsed) {
70  consumeError(Parsed.takeError());
71  P.report("failed to parse URI");
72  return false;
73  }
74  if (Parsed->scheme() != "file" && Parsed->scheme() != "test") {
75  P.report("clangd only supports 'file' URI scheme for workspace files");
76  return false;
77  }
78  // "file" and "test" schemes do not require hint path.
79  auto U = URIForFile::fromURI(*Parsed, /*HintPath=*/"");
80  if (!U) {
81  P.report("unresolvable URI");
82  consumeError(U.takeError());
83  return false;
84  }
85  R = std::move(*U);
86  return true;
87  }
88  return false;
89 }
90 
91 llvm::json::Value toJSON(const URIForFile &U) { return U.uri(); }
92 
93 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const URIForFile &U) {
94  return OS << U.uri();
95 }
96 
98  return llvm::json::Object{{"uri", R.uri}};
99 }
100 
102  llvm::json::Path P) {
103  llvm::json::ObjectMapper O(Params, P);
104  return O && O.map("uri", R.uri);
105 }
106 
108  auto Result = toJSON(static_cast<const TextDocumentIdentifier &>(R));
109  Result.getAsObject()->try_emplace("version", R.version);
110  return Result;
111 }
112 
113 bool fromJSON(const llvm::json::Value &Params,
115  llvm::json::ObjectMapper O(Params, P);
116  return fromJSON(Params, static_cast<TextDocumentIdentifier &>(R), P) && O &&
117  O.map("version", R.version);
118 }
119 
120 bool fromJSON(const llvm::json::Value &Params, Position &R,
121  llvm::json::Path P) {
122  llvm::json::ObjectMapper O(Params, P);
123  return O && O.map("line", R.line) && O.map("character", R.character);
124 }
125 
127  return llvm::json::Object{
128  {"line", P.line},
129  {"character", P.character},
130  };
131 }
132 
133 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Position &P) {
134  return OS << P.line << ':' << P.character;
135 }
136 
137 bool fromJSON(const llvm::json::Value &Params, Range &R, llvm::json::Path P) {
138  llvm::json::ObjectMapper O(Params, P);
139  return O && O.map("start", R.start) && O.map("end", R.end);
140 }
141 
143  return llvm::json::Object{
144  {"start", P.start},
145  {"end", P.end},
146  };
147 }
148 
149 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Range &R) {
150  return OS << R.start << '-' << R.end;
151 }
152 
154  return llvm::json::Object{
155  {"uri", P.uri},
156  {"range", P.range},
157  };
158 }
159 
160 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Location &L) {
161  return OS << L.range << '@' << L.uri;
162 }
163 
165  llvm::json::Path P) {
166  llvm::json::ObjectMapper O(Params, P);
167  return O && O.map("uri", R.uri) && O.map("languageId", R.languageId) &&
168  O.map("version", R.version) && O.map("text", R.text);
169 }
170 
171 bool fromJSON(const llvm::json::Value &Params, TextEdit &R,
172  llvm::json::Path P) {
173  llvm::json::ObjectMapper O(Params, P);
174  return O && O.map("range", R.range) && O.map("newText", R.newText);
175 }
176 
178  return llvm::json::Object{
179  {"range", P.range},
180  {"newText", P.newText},
181  };
182 }
183 
184 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const TextEdit &TE) {
185  OS << TE.range << " => \"";
186  llvm::printEscapedString(TE.newText, OS);
187  return OS << '"';
188 }
189 
191  if (auto S = E.getAsString()) {
192  if (*S == "off") {
194  return true;
195  }
196  if (*S == "messages") {
198  return true;
199  }
200  if (*S == "verbose") {
202  return true;
203  }
204  }
205  return false;
206 }
207 
209  if (auto T = E.getAsInteger()) {
210  if (*T < static_cast<int>(SymbolKind::File) ||
211  *T > static_cast<int>(SymbolKind::TypeParameter))
212  return false;
213  Out = static_cast<SymbolKind>(*T);
214  return true;
215  }
216  return false;
217 }
218 
220  llvm::json::Path P) {
221  if (auto *A = E.getAsArray()) {
222  for (size_t I = 0; I < A->size(); ++I) {
223  SymbolKind KindOut;
224  if (fromJSON((*A)[I], KindOut, P.index(I)))
225  Out.set(size_t(KindOut));
226  }
227  return true;
228  }
229  return false;
230 }
231 
233  SymbolKindBitset &SupportedSymbolKinds) {
234  auto KindVal = static_cast<size_t>(Kind);
235  if (KindVal >= SymbolKindMin && KindVal <= SupportedSymbolKinds.size() &&
236  SupportedSymbolKinds[KindVal])
237  return Kind;
238 
239  switch (Kind) {
240  // Provide some fall backs for common kinds that are close enough.
241  case SymbolKind::Struct:
242  return SymbolKind::Class;
244  return SymbolKind::Enum;
245  default:
246  return SymbolKind::String;
247  }
248 }
249 
251  switch (Kind) {
253  return SymbolKind::Variable;
254  case index::SymbolKind::Module:
255  return SymbolKind::Module;
256  case index::SymbolKind::Namespace:
257  return SymbolKind::Namespace;
258  case index::SymbolKind::NamespaceAlias:
259  return SymbolKind::Namespace;
260  case index::SymbolKind::Macro:
261  return SymbolKind::String;
262  case index::SymbolKind::Enum:
263  return SymbolKind::Enum;
264  case index::SymbolKind::Struct:
265  return SymbolKind::Struct;
266  case index::SymbolKind::Class:
267  return SymbolKind::Class;
268  case index::SymbolKind::Protocol:
269  return SymbolKind::Interface;
270  case index::SymbolKind::Extension:
271  return SymbolKind::Interface;
272  case index::SymbolKind::Union:
273  return SymbolKind::Class;
274  case index::SymbolKind::TypeAlias:
275  return SymbolKind::Class;
276  case index::SymbolKind::Function:
277  return SymbolKind::Function;
278  case index::SymbolKind::Variable:
279  return SymbolKind::Variable;
281  return SymbolKind::Field;
282  case index::SymbolKind::EnumConstant:
283  return SymbolKind::EnumMember;
284  case index::SymbolKind::InstanceMethod:
285  case index::SymbolKind::ClassMethod:
286  case index::SymbolKind::StaticMethod:
287  return SymbolKind::Method;
288  case index::SymbolKind::InstanceProperty:
289  case index::SymbolKind::ClassProperty:
290  case index::SymbolKind::StaticProperty:
291  return SymbolKind::Property;
292  case index::SymbolKind::Constructor:
293  case index::SymbolKind::Destructor:
295  case index::SymbolKind::ConversionFunction:
296  return SymbolKind::Function;
297  case index::SymbolKind::Parameter:
298  case index::SymbolKind::NonTypeTemplateParm:
299  return SymbolKind::Variable;
300  case index::SymbolKind::Using:
301  return SymbolKind::Namespace;
302  case index::SymbolKind::TemplateTemplateParm:
303  case index::SymbolKind::TemplateTypeParm:
305  case index::SymbolKind::Concept:
306  return SymbolKind::Interface;
307  }
308  llvm_unreachable("invalid symbol kind");
309 }
310 
312  llvm::json::Path P) {
313  const llvm::json::Object *O = Params.getAsObject();
314  if (!O) {
315  P.report("expected object");
316  return false;
317  }
318  if (auto *TextDocument = O->getObject("textDocument")) {
319  if (auto *SemanticHighlighting =
320  TextDocument->getObject("semanticHighlightingCapabilities")) {
321  if (auto SemanticHighlightingSupport =
322  SemanticHighlighting->getBoolean("semanticHighlighting"))
323  R.TheiaSemanticHighlighting = *SemanticHighlightingSupport;
324  }
325  if (TextDocument->getObject("semanticTokens"))
326  R.SemanticTokens = true;
327  if (auto *Diagnostics = TextDocument->getObject("publishDiagnostics")) {
328  if (auto CategorySupport = Diagnostics->getBoolean("categorySupport"))
329  R.DiagnosticCategory = *CategorySupport;
330  if (auto CodeActions = Diagnostics->getBoolean("codeActionsInline"))
331  R.DiagnosticFixes = *CodeActions;
332  if (auto RelatedInfo = Diagnostics->getBoolean("relatedInformation"))
333  R.DiagnosticRelatedInformation = *RelatedInfo;
334  }
335  if (auto *Completion = TextDocument->getObject("completion")) {
336  if (auto *Item = Completion->getObject("completionItem")) {
337  if (auto SnippetSupport = Item->getBoolean("snippetSupport"))
338  R.CompletionSnippets = *SnippetSupport;
339  if (const auto *DocumentationFormat =
340  Item->getArray("documentationFormat")) {
341  for (const auto &Format : *DocumentationFormat) {
342  if (fromJSON(Format, R.CompletionDocumentationFormat, P))
343  break;
344  }
345  }
346  }
347  if (auto *ItemKind = Completion->getObject("completionItemKind")) {
348  if (auto *ValueSet = ItemKind->get("valueSet")) {
349  R.CompletionItemKinds.emplace();
350  if (!fromJSON(*ValueSet, *R.CompletionItemKinds,
351  P.field("textDocument")
352  .field("completion")
353  .field("completionItemKind")
354  .field("valueSet")))
355  return false;
356  }
357  }
358  if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
359  R.CompletionFixes = *EditsNearCursor;
360  }
361  if (auto *CodeAction = TextDocument->getObject("codeAction")) {
362  if (CodeAction->getObject("codeActionLiteralSupport"))
363  R.CodeActionStructure = true;
364  }
365  if (auto *DocumentSymbol = TextDocument->getObject("documentSymbol")) {
366  if (auto HierarchicalSupport =
367  DocumentSymbol->getBoolean("hierarchicalDocumentSymbolSupport"))
368  R.HierarchicalDocumentSymbol = *HierarchicalSupport;
369  }
370  if (auto *Hover = TextDocument->getObject("hover")) {
371  if (auto *ContentFormat = Hover->getArray("contentFormat")) {
372  for (const auto &Format : *ContentFormat) {
373  if (fromJSON(Format, R.HoverContentFormat, P))
374  break;
375  }
376  }
377  }
378  if (auto *Help = TextDocument->getObject("signatureHelp")) {
379  R.HasSignatureHelp = true;
380  if (auto *Info = Help->getObject("signatureInformation")) {
381  if (auto *Parameter = Info->getObject("parameterInformation")) {
382  if (auto OffsetSupport = Parameter->getBoolean("labelOffsetSupport"))
383  R.OffsetsInSignatureHelp = *OffsetSupport;
384  }
385  if (const auto *DocumentationFormat =
386  Info->getArray("documentationFormat")) {
387  for (const auto &Format : *DocumentationFormat) {
388  if (fromJSON(Format, R.SignatureHelpDocumentationFormat, P))
389  break;
390  }
391  }
392  }
393  }
394  if (auto *Folding = TextDocument->getObject("foldingRange")) {
395  if (auto LineFolding = Folding->getBoolean("lineFoldingOnly"))
396  R.LineFoldingOnly = *LineFolding;
397  }
398  if (auto *Rename = TextDocument->getObject("rename")) {
399  if (auto RenameSupport = Rename->getBoolean("prepareSupport"))
400  R.RenamePrepareSupport = *RenameSupport;
401  }
402  }
403  if (auto *Workspace = O->getObject("workspace")) {
404  if (auto *Symbol = Workspace->getObject("symbol")) {
405  if (auto *SymbolKind = Symbol->getObject("symbolKind")) {
406  if (auto *ValueSet = SymbolKind->get("valueSet")) {
407  R.WorkspaceSymbolKinds.emplace();
408  if (!fromJSON(*ValueSet, *R.WorkspaceSymbolKinds,
409  P.field("workspace")
410  .field("symbol")
411  .field("symbolKind")
412  .field("valueSet")))
413  return false;
414  }
415  }
416  }
417  if (auto *SemanticTokens = Workspace->getObject("semanticTokens")) {
418  if (auto RefreshSupport = SemanticTokens->getBoolean("refreshSupport"))
419  R.SemanticTokenRefreshSupport = *RefreshSupport;
420  }
421  }
422  if (auto *Window = O->getObject("window")) {
423  if (auto WorkDoneProgress = Window->getBoolean("workDoneProgress"))
424  R.WorkDoneProgress = *WorkDoneProgress;
425  if (auto Implicit = Window->getBoolean("implicitWorkDoneProgressCreate"))
426  R.ImplicitProgressCreation = *Implicit;
427  }
428  if (auto *General = O->getObject("general")) {
429  if (auto *StaleRequestSupport = General->getObject("staleRequestSupport")) {
430  if (auto Cancel = StaleRequestSupport->getBoolean("cancel"))
431  R.CancelsStaleRequests = *Cancel;
432  }
433  }
434  if (auto *OffsetEncoding = O->get("offsetEncoding")) {
435  R.offsetEncoding.emplace();
437  P.field("offsetEncoding")))
438  return false;
439  }
440  return true;
441 }
442 
444  llvm::json::Path P) {
445  llvm::json::ObjectMapper O(Params, P);
446  if (!O)
447  return false;
448  // We deliberately don't fail if we can't parse individual fields.
449  // Failing to handle a slightly malformed initialize would be a disaster.
450  O.map("processId", R.processId);
451  O.map("rootUri", R.rootUri);
452  O.map("rootPath", R.rootPath);
453  O.map("capabilities", R.capabilities);
454  if (auto *RawCaps = Params.getAsObject()->getObject("capabilities"))
455  R.rawCapabilities = *RawCaps;
456  O.map("trace", R.trace);
457  O.map("initializationOptions", R.initializationOptions);
458  return true;
459 }
460 
462  return llvm::json::Object{{"token", P.token}};
463 }
464 
466  llvm::json::Object Result{
467  {"kind", "begin"},
468  {"title", P.title},
469  };
470  if (P.cancellable)
471  Result["cancellable"] = true;
472  if (P.percentage)
473  Result["percentage"] = 0;
474 
475  // FIXME: workaround for older gcc/clang
476  return std::move(Result);
477 }
478 
480  llvm::json::Object Result{{"kind", "report"}};
481  if (P.cancellable)
482  Result["cancellable"] = *P.cancellable;
483  if (P.message)
484  Result["message"] = *P.message;
485  if (P.percentage)
486  Result["percentage"] = *P.percentage;
487  // FIXME: workaround for older gcc/clang
488  return std::move(Result);
489 }
490 
492  llvm::json::Object Result{{"kind", "end"}};
493  if (P.message)
494  Result["message"] = *P.message;
495  // FIXME: workaround for older gcc/clang
496  return std::move(Result);
497 }
498 
500  return static_cast<int64_t>(R);
501 }
502 
504  return llvm::json::Object{{"type", R.type}, {"message", R.message}};
505 }
506 
508  llvm::json::Path P) {
509  llvm::json::ObjectMapper O(Params, P);
510  return O && O.map("textDocument", R.textDocument);
511 }
512 
514  llvm::json::Path P) {
515  llvm::json::ObjectMapper O(Params, P);
516  return O && O.map("textDocument", R.textDocument);
517 }
518 
520  llvm::json::Path P) {
521  llvm::json::ObjectMapper O(Params, P);
522  return O && O.map("textDocument", R.textDocument);
523 }
524 
526  llvm::json::Path P) {
527  llvm::json::ObjectMapper O(Params, P);
528  return O && O.map("textDocument", R.textDocument) &&
529  O.map("contentChanges", R.contentChanges) &&
530  O.map("wantDiagnostics", R.wantDiagnostics) &&
531  mapOptOrNull(Params, "forceRebuild", R.forceRebuild, P);
532 }
533 
535  llvm::json::Path P) {
536  if (auto T = E.getAsInteger()) {
537  if (*T < static_cast<int>(FileChangeType::Created) ||
538  *T > static_cast<int>(FileChangeType::Deleted))
539  return false;
540  Out = static_cast<FileChangeType>(*T);
541  return true;
542  }
543  return false;
544 }
545 
546 bool fromJSON(const llvm::json::Value &Params, FileEvent &R,
547  llvm::json::Path P) {
548  llvm::json::ObjectMapper O(Params, P);
549  return O && O.map("uri", R.uri) && O.map("type", R.type);
550 }
551 
553  llvm::json::Path P) {
554  llvm::json::ObjectMapper O(Params, P);
555  return O && O.map("changes", R.changes);
556 }
557 
558 bool fromJSON(const llvm::json::Value &Params,
560  llvm::json::ObjectMapper O(Params, P);
561  return O && O.map("range", R.range) && O.map("rangeLength", R.rangeLength) &&
562  O.map("text", R.text);
563 }
564 
566  llvm::json::Path P) {
567  llvm::json::ObjectMapper O(Params, P);
568  return O && O.map("textDocument", R.textDocument) && O.map("range", R.range);
569 }
570 
571 bool fromJSON(const llvm::json::Value &Params,
573  llvm::json::ObjectMapper O(Params, P);
574  return O && O.map("textDocument", R.textDocument) &&
575  O.map("position", R.position) && O.map("ch", R.ch);
576 }
577 
579  llvm::json::Path P) {
580  llvm::json::ObjectMapper O(Params, P);
581  return O && O.map("textDocument", R.textDocument);
582 }
583 
585  llvm::json::Path P) {
586  llvm::json::ObjectMapper O(Params, P);
587  return O && O.map("textDocument", R.textDocument);
588 }
589 
591  return llvm::json::Object{
592  {"location", DRI.location},
593  {"message", DRI.message},
594  };
595 }
596 
597 llvm::json::Value toJSON(DiagnosticTag Tag) { return static_cast<int>(Tag); }
598 
600  return llvm::json::Object{{"href", D.href}};
601 }
602 
604  llvm::json::Object Diag{
605  {"range", D.range},
606  {"severity", D.severity},
607  {"message", D.message},
608  };
609  if (D.category)
610  Diag["category"] = *D.category;
611  if (D.codeActions)
612  Diag["codeActions"] = D.codeActions;
613  if (!D.code.empty())
614  Diag["code"] = D.code;
615  if (D.codeDescription)
616  Diag["codeDescription"] = *D.codeDescription;
617  if (!D.source.empty())
618  Diag["source"] = D.source;
619  if (D.relatedInformation)
620  Diag["relatedInformation"] = *D.relatedInformation;
621  if (!D.data.empty())
622  Diag["data"] = llvm::json::Object(D.data);
623  if (!D.tags.empty())
624  Diag["tags"] = llvm::json::Array{D.tags};
625  // FIXME: workaround for older gcc/clang
626  return std::move(Diag);
627 }
628 
629 bool fromJSON(const llvm::json::Value &Params, Diagnostic &R,
630  llvm::json::Path P) {
631  llvm::json::ObjectMapper O(Params, P);
632  if (!O)
633  return false;
634  if (auto *Data = Params.getAsObject()->getObject("data"))
635  R.data = *Data;
636  return O.map("range", R.range) && O.map("message", R.message) &&
637  mapOptOrNull(Params, "severity", R.severity, P) &&
638  mapOptOrNull(Params, "category", R.category, P) &&
639  mapOptOrNull(Params, "code", R.code, P) &&
640  mapOptOrNull(Params, "source", R.source, P);
641 }
642 
644  llvm::json::Object Result{
645  {"uri", PDP.uri},
646  {"diagnostics", PDP.diagnostics},
647  };
648  if (PDP.version)
649  Result["version"] = PDP.version;
650  return std::move(Result);
651 }
652 
654  llvm::json::Path P) {
655  llvm::json::ObjectMapper O(Params, P);
656  if (!O || !O.map("diagnostics", R.diagnostics))
657  return false;
658  O.map("only", R.only);
659  return true;
660 }
661 
662 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Diagnostic &D) {
663  OS << D.range << " [";
664  switch (D.severity) {
665  case 1:
666  OS << "error";
667  break;
668  case 2:
669  OS << "warning";
670  break;
671  case 3:
672  OS << "note";
673  break;
674  case 4:
675  OS << "remark";
676  break;
677  default:
678  OS << "diagnostic";
679  break;
680  }
681  return OS << '(' << D.severity << "): " << D.message << "]";
682 }
683 
685  llvm::json::Path P) {
686  llvm::json::ObjectMapper O(Params, P);
687  return O && O.map("textDocument", R.textDocument) &&
688  O.map("range", R.range) && O.map("context", R.context);
689 }
690 
691 bool fromJSON(const llvm::json::Value &Params, WorkspaceEdit &R,
692  llvm::json::Path P) {
693  llvm::json::ObjectMapper O(Params, P);
694  return O && O.map("changes", R.changes);
695 }
696 
698  llvm::json::Path P) {
699  llvm::json::ObjectMapper O(Params, P);
700  if (!O || !O.map("command", R.command))
701  return false;
702 
703  const auto *Args = Params.getAsObject()->get("arguments");
704  if (!Args)
705  return true; // Missing args is ok, argument is null.
706  const auto *ArgsArray = Args->getAsArray();
707  if (!ArgsArray) {
708  P.field("arguments").report("expected array");
709  return false;
710  }
711  if (ArgsArray->size() > 1) {
712  P.field("arguments").report("Command should have 0 or 1 argument");
713  return false;
714  }
715  if (ArgsArray->size() == 1) {
716  R.argument = ArgsArray->front();
717  }
718  return true;
719 }
720 
722  llvm::json::Object O{
723  {"name", P.name},
724  {"kind", static_cast<int>(P.kind)},
725  {"location", P.location},
726  {"containerName", P.containerName},
727  };
728  if (P.score)
729  O["score"] = *P.score;
730  return std::move(O);
731 }
732 
733 llvm::raw_ostream &operator<<(llvm::raw_ostream &O,
734  const SymbolInformation &SI) {
735  O << SI.containerName << "::" << SI.name << " - " << toJSON(SI);
736  return O;
737 }
738 
739 bool operator==(const SymbolDetails &LHS, const SymbolDetails &RHS) {
740  return LHS.name == RHS.name && LHS.containerName == RHS.containerName &&
741  LHS.USR == RHS.USR && LHS.ID == RHS.ID &&
742  LHS.declarationRange == RHS.declarationRange &&
743  LHS.definitionRange == RHS.definitionRange;
744 }
745 
747  llvm::json::Object Result{{"name", llvm::json::Value(nullptr)},
748  {"containerName", llvm::json::Value(nullptr)},
749  {"usr", llvm::json::Value(nullptr)},
750  {"id", llvm::json::Value(nullptr)}};
751 
752  if (!P.name.empty())
753  Result["name"] = P.name;
754 
755  if (!P.containerName.empty())
756  Result["containerName"] = P.containerName;
757 
758  if (!P.USR.empty())
759  Result["usr"] = P.USR;
760 
761  if (P.ID)
762  Result["id"] = P.ID.str();
763 
764  if (P.declarationRange)
765  Result["declarationRange"] = *P.declarationRange;
766 
767  if (P.definitionRange)
768  Result["definitionRange"] = *P.definitionRange;
769 
770  // FIXME: workaround for older gcc/clang
771  return std::move(Result);
772 }
773 
774 llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const SymbolDetails &S) {
775  if (!S.containerName.empty()) {
776  O << S.containerName;
777  llvm::StringRef ContNameRef;
778  if (!ContNameRef.endswith("::")) {
779  O << " ";
780  }
781  }
782  O << S.name << " - " << toJSON(S);
783  return O;
784 }
785 
787  llvm::json::Path P) {
788  llvm::json::ObjectMapper O(Params, P);
789  return O && O.map("query", R.query) &&
790  mapOptOrNull(Params, "limit", R.limit, P);
791 }
792 
793 llvm::json::Value toJSON(const Command &C) {
794  auto Cmd = llvm::json::Object{{"title", C.title}, {"command", C.command}};
795  if (!C.argument.getAsNull())
796  Cmd["arguments"] = llvm::json::Array{C.argument};
797  return std::move(Cmd);
798 }
799 
800 const llvm::StringLiteral CodeAction::QUICKFIX_KIND = "quickfix";
801 const llvm::StringLiteral CodeAction::REFACTOR_KIND = "refactor";
802 const llvm::StringLiteral CodeAction::INFO_KIND = "info";
803 
805  auto CodeAction = llvm::json::Object{{"title", CA.title}};
806  if (CA.kind)
807  CodeAction["kind"] = *CA.kind;
808  if (CA.diagnostics)
809  CodeAction["diagnostics"] = llvm::json::Array(*CA.diagnostics);
810  if (CA.isPreferred)
811  CodeAction["isPreferred"] = true;
812  if (CA.edit)
813  CodeAction["edit"] = *CA.edit;
814  if (CA.command)
815  CodeAction["command"] = *CA.command;
816  return std::move(CodeAction);
817 }
818 
819 llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const DocumentSymbol &S) {
820  return O << S.name << " - " << toJSON(S);
821 }
822 
824  llvm::json::Object Result{{"name", S.name},
825  {"kind", static_cast<int>(S.kind)},
826  {"range", S.range},
827  {"selectionRange", S.selectionRange}};
828 
829  if (!S.detail.empty())
830  Result["detail"] = S.detail;
831  if (!S.children.empty())
832  Result["children"] = S.children;
833  if (S.deprecated)
834  Result["deprecated"] = true;
835  // FIXME: workaround for older gcc/clang
836  return std::move(Result);
837 }
838 
840  llvm::json::Object FileChanges;
841  for (auto &Change : WE.changes)
842  FileChanges[Change.first] = llvm::json::Array(Change.second);
843  return llvm::json::Object{{"changes", std::move(FileChanges)}};
844 }
845 
846 bool fromJSON(const llvm::json::Value &Params, TweakArgs &A,
847  llvm::json::Path P) {
848  llvm::json::ObjectMapper O(Params, P);
849  return O && O.map("file", A.file) && O.map("selection", A.selection) &&
850  O.map("tweakID", A.tweakID);
851 }
852 
854  return llvm::json::Object{
855  {"tweakID", A.tweakID}, {"selection", A.selection}, {"file", A.file}};
856 }
857 
859  return llvm::json::Object{{"edit", Params.edit}};
860 }
861 
863  llvm::json::Path P) {
864  llvm::json::ObjectMapper O(Response, P);
865  return O && O.map("applied", R.applied) &&
866  O.map("failureReason", R.failureReason);
867 }
868 
870  llvm::json::Path P) {
871  llvm::json::ObjectMapper O(Params, P);
872  return O && O.map("textDocument", R.textDocument) &&
873  O.map("position", R.position);
874 }
875 
877  llvm::json::Path P) {
878  llvm::json::ObjectMapper O(Params, P);
879  int TriggerKind;
880  if (!O || !O.map("triggerKind", TriggerKind) ||
881  !mapOptOrNull(Params, "triggerCharacter", R.triggerCharacter, P))
882  return false;
883  R.triggerKind = static_cast<CompletionTriggerKind>(TriggerKind);
884  return true;
885 }
886 
888  llvm::json::Path P) {
889  if (!fromJSON(Params, static_cast<TextDocumentPositionParams &>(R), P) ||
890  !mapOptOrNull(Params, "limit", R.limit, P))
891  return false;
892  if (auto *Context = Params.getAsObject()->get("context"))
893  return fromJSON(*Context, R.context, P.field("context"));
894  return true;
895 }
896 
897 static llvm::StringRef toTextKind(MarkupKind Kind) {
898  switch (Kind) {
900  return "plaintext";
902  return "markdown";
903  }
904  llvm_unreachable("Invalid MarkupKind");
905 }
906 
908  auto Str = V.getAsString();
909  if (!Str) {
910  P.report("expected string");
911  return false;
912  }
913  if (*Str == "plaintext")
915  else if (*Str == "markdown")
917  else {
918  P.report("unknown markup kind");
919  return false;
920  }
921  return true;
922 }
923 
924 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, MarkupKind K) {
925  return OS << toTextKind(K);
926 }
927 
929  if (MC.value.empty())
930  return nullptr;
931 
932  return llvm::json::Object{
933  {"kind", toTextKind(MC.kind)},
934  {"value", MC.value},
935  };
936 }
937 
939  llvm::json::Object Result{{"contents", toJSON(H.contents)}};
940 
941  if (H.range)
942  Result["range"] = toJSON(*H.range);
943 
944  return std::move(Result);
945 }
946 
948  llvm::json::Path P) {
949  if (auto T = E.getAsInteger()) {
950  if (*T < static_cast<int>(CompletionItemKind::Text) ||
951  *T > static_cast<int>(CompletionItemKind::TypeParameter))
952  return false;
953  Out = static_cast<CompletionItemKind>(*T);
954  return true;
955  }
956  return false;
957 }
958 
961  CompletionItemKindBitset &SupportedCompletionItemKinds) {
962  auto KindVal = static_cast<size_t>(Kind);
963  if (KindVal >= CompletionItemKindMin &&
964  KindVal <= SupportedCompletionItemKinds.size() &&
965  SupportedCompletionItemKinds[KindVal])
966  return Kind;
967 
968  switch (Kind) {
969  // Provide some fall backs for common kinds that are close enough.
976  default:
978  }
979 }
980 
982  llvm::json::Path P) {
983  if (auto *A = E.getAsArray()) {
984  for (size_t I = 0; I < A->size(); ++I) {
985  CompletionItemKind KindOut;
986  if (fromJSON((*A)[I], KindOut, P.index(I)))
987  Out.set(size_t(KindOut));
988  }
989  return true;
990  }
991  return false;
992 }
993 
995  assert(!CI.label.empty() && "completion item label is required");
996  llvm::json::Object Result{{"label", CI.label}};
997  if (CI.kind != CompletionItemKind::Missing)
998  Result["kind"] = static_cast<int>(CI.kind);
999  if (!CI.detail.empty())
1000  Result["detail"] = CI.detail;
1001  if (CI.documentation)
1002  Result["documentation"] = CI.documentation;
1003  if (!CI.sortText.empty())
1004  Result["sortText"] = CI.sortText;
1005  if (!CI.filterText.empty())
1006  Result["filterText"] = CI.filterText;
1007  if (!CI.insertText.empty())
1008  Result["insertText"] = CI.insertText;
1009  if (CI.insertTextFormat != InsertTextFormat::Missing)
1010  Result["insertTextFormat"] = static_cast<int>(CI.insertTextFormat);
1011  if (CI.textEdit)
1012  Result["textEdit"] = *CI.textEdit;
1013  if (!CI.additionalTextEdits.empty())
1014  Result["additionalTextEdits"] = llvm::json::Array(CI.additionalTextEdits);
1015  if (CI.deprecated)
1016  Result["deprecated"] = CI.deprecated;
1017  Result["score"] = CI.score;
1018  return std::move(Result);
1019 }
1020 
1021 llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const CompletionItem &I) {
1022  O << I.label << " - " << toJSON(I);
1023  return O;
1024 }
1025 
1026 bool operator<(const CompletionItem &L, const CompletionItem &R) {
1027  return (L.sortText.empty() ? L.label : L.sortText) <
1028  (R.sortText.empty() ? R.label : R.sortText);
1029 }
1030 
1032  return llvm::json::Object{
1033  {"isIncomplete", L.isIncomplete},
1034  {"items", llvm::json::Array(L.items)},
1035  };
1036 }
1037 
1039  assert((PI.labelOffsets || !PI.labelString.empty()) &&
1040  "parameter information label is required");
1041  llvm::json::Object Result;
1042  if (PI.labelOffsets)
1043  Result["label"] =
1044  llvm::json::Array({PI.labelOffsets->first, PI.labelOffsets->second});
1045  else
1046  Result["label"] = PI.labelString;
1047  if (!PI.documentation.empty())
1048  Result["documentation"] = PI.documentation;
1049  return std::move(Result);
1050 }
1051 
1053  assert(!SI.label.empty() && "signature information label is required");
1054  llvm::json::Object Result{
1055  {"label", SI.label},
1056  {"parameters", llvm::json::Array(SI.parameters)},
1057  };
1058  if (!SI.documentation.value.empty())
1059  Result["documentation"] = SI.documentation;
1060  return std::move(Result);
1061 }
1062 
1063 llvm::raw_ostream &operator<<(llvm::raw_ostream &O,
1064  const SignatureInformation &I) {
1065  O << I.label << " - " << toJSON(I);
1066  return O;
1067 }
1068 
1070  assert(SH.activeSignature >= 0 &&
1071  "Unexpected negative value for number of active signatures.");
1072  assert(SH.activeParameter >= 0 &&
1073  "Unexpected negative value for active parameter index");
1074  return llvm::json::Object{
1075  {"activeSignature", SH.activeSignature},
1076  {"activeParameter", SH.activeParameter},
1077  {"signatures", llvm::json::Array(SH.signatures)},
1078  };
1079 }
1080 
1081 bool fromJSON(const llvm::json::Value &Params, RenameParams &R,
1082  llvm::json::Path P) {
1083  llvm::json::ObjectMapper O(Params, P);
1084  return O && O.map("textDocument", R.textDocument) &&
1085  O.map("position", R.position) && O.map("newName", R.newName);
1086 }
1087 
1089  return llvm::json::Object{
1090  {"range", toJSON(DH.range)},
1091  {"kind", static_cast<int>(DH.kind)},
1092  };
1093 }
1094 
1096  return llvm::json::Object{
1097  {"uri", FStatus.uri},
1098  {"state", FStatus.state},
1099  };
1100 }
1101 
1102 constexpr unsigned SemanticTokenEncodingSize = 5;
1103 static llvm::json::Value encodeTokens(llvm::ArrayRef<SemanticToken> Toks) {
1104  llvm::json::Array Result;
1105  Result.reserve(SemanticTokenEncodingSize * Toks.size());
1106  for (const auto &Tok : Toks) {
1107  Result.push_back(Tok.deltaLine);
1108  Result.push_back(Tok.deltaStart);
1109  Result.push_back(Tok.length);
1110  Result.push_back(Tok.tokenType);
1111  Result.push_back(Tok.tokenModifiers);
1112  }
1113  assert(Result.size() == SemanticTokenEncodingSize * Toks.size());
1114  return std::move(Result);
1115 }
1116 
1117 bool operator==(const SemanticToken &L, const SemanticToken &R) {
1118  return std::tie(L.deltaLine, L.deltaStart, L.length, L.tokenType,
1119  L.tokenModifiers) == std::tie(R.deltaLine, R.deltaStart,
1120  R.length, R.tokenType,
1121  R.tokenModifiers);
1122 }
1123 
1125  return llvm::json::Object{{"resultId", Tokens.resultId},
1126  {"data", encodeTokens(Tokens.tokens)}};
1127 }
1128 
1130  return llvm::json::Object{
1131  {"start", SemanticTokenEncodingSize * Edit.startToken},
1132  {"deleteCount", SemanticTokenEncodingSize * Edit.deleteTokens},
1133  {"data", encodeTokens(Edit.tokens)}};
1134 }
1135 
1137  llvm::json::Object Result{{"resultId", TE.resultId}};
1138  if (TE.edits)
1139  Result["edits"] = *TE.edits;
1140  if (TE.tokens)
1141  Result["data"] = encodeTokens(*TE.tokens);
1142  return std::move(Result);
1143 }
1144 
1146  llvm::json::Path P) {
1147  llvm::json::ObjectMapper O(Params, P);
1148  return O && O.map("textDocument", R.textDocument);
1149 }
1150 
1152  llvm::json::Path P) {
1153  llvm::json::ObjectMapper O(Params, P);
1154  return O && O.map("textDocument", R.textDocument) &&
1155  O.map("previousResultId", R.previousResultId);
1156 }
1157 
1158 llvm::raw_ostream &operator<<(llvm::raw_ostream &O,
1159  const DocumentHighlight &V) {
1160  O << V.range;
1162  O << "(r)";
1164  O << "(w)";
1165  return O;
1166 }
1167 
1168 bool fromJSON(const llvm::json::Value &Params,
1170  llvm::json::ObjectMapper O(Params, P);
1171  return O && O.map("settings", CCP.settings);
1172 }
1173 
1174 bool fromJSON(const llvm::json::Value &Params, ClangdCompileCommand &CDbUpdate,
1175  llvm::json::Path P) {
1176  llvm::json::ObjectMapper O(Params, P);
1177  return O && O.map("workingDirectory", CDbUpdate.workingDirectory) &&
1178  O.map("compilationCommand", CDbUpdate.compilationCommand);
1179 }
1180 
1182  llvm::json::Path P) {
1183  llvm::json::ObjectMapper O(Params, P);
1184  if (!O)
1185  return true; // 'any' type in LSP.
1186  return mapOptOrNull(Params, "compilationDatabaseChanges",
1188 }
1189 
1191  llvm::json::Path P) {
1192  llvm::json::ObjectMapper O(Params, P);
1193  if (!O)
1194  return true; // 'any' type in LSP.
1195 
1196  return fromJSON(Params, Opts.ConfigSettings, P) &&
1197  O.map("compilationDatabasePath", Opts.compilationDatabasePath) &&
1198  mapOptOrNull(Params, "fallbackFlags", Opts.fallbackFlags, P) &&
1199  mapOptOrNull(Params, "clangdFileStatus", Opts.FileStatus, P);
1200 }
1201 
1203  llvm::json::Path P) {
1204  auto T = E.getAsInteger();
1205  if (!T)
1206  return false;
1207  if (*T < static_cast<int>(TypeHierarchyDirection::Children) ||
1208  *T > static_cast<int>(TypeHierarchyDirection::Both))
1209  return false;
1210  Out = static_cast<TypeHierarchyDirection>(*T);
1211  return true;
1212 }
1213 
1215  llvm::json::Path P) {
1216  llvm::json::ObjectMapper O(Params, P);
1217  return O && O.map("textDocument", R.textDocument) &&
1218  O.map("position", R.position) &&
1219  mapOptOrNull(Params, "resolve", R.resolve, P) &&
1220  mapOptOrNull(Params, "direction", R.direction, P);
1221 }
1222 
1223 llvm::raw_ostream &operator<<(llvm::raw_ostream &O,
1224  const TypeHierarchyItem &I) {
1225  return O << I.name << " - " << toJSON(I);
1226 }
1227 
1229  llvm::json::Object Result{{"symbolID", RP.symbolID}};
1230  if (RP.parents)
1231  Result["parents"] = RP.parents;
1232  return std::move(Result);
1233 }
1234 bool fromJSON(const llvm::json::Value &Params,
1236  llvm::json::ObjectMapper O(Params, P);
1237  return O && O.map("symbolID", RP.symbolID) &&
1238  mapOptOrNull(Params, "parents", RP.parents, P);
1239 }
1240 
1242  llvm::json::Object Result{
1243  {"name", I.name}, {"kind", static_cast<int>(I.kind)},
1244  {"range", I.range}, {"selectionRange", I.selectionRange},
1245  {"uri", I.uri}, {"data", I.data},
1246  };
1247 
1248  if (I.detail)
1249  Result["detail"] = I.detail;
1250  return std::move(Result);
1251 }
1252 
1254  llvm::json::Path P) {
1255  llvm::json::ObjectMapper O(Params, P);
1256 
1257  // Required fields.
1258  return O && O.map("name", I.name) && O.map("kind", I.kind) &&
1259  O.map("uri", I.uri) && O.map("range", I.range) &&
1260  O.map("selectionRange", I.selectionRange) &&
1261  mapOptOrNull(Params, "detail", I.detail, P) &&
1262  mapOptOrNull(Params, "deprecated", I.deprecated, P) &&
1263  mapOptOrNull(Params, "parents", I.parents, P) &&
1264  mapOptOrNull(Params, "children", I.children, P) &&
1265  mapOptOrNull(Params, "data", I.data, P);
1266 }
1267 
1268 bool fromJSON(const llvm::json::Value &Params,
1270  llvm::json::ObjectMapper O(Params, P);
1271  return O && O.map("item", R.item) &&
1272  mapOptOrNull(Params, "resolve", R.resolve, P) &&
1273  mapOptOrNull(Params, "direction", R.direction, P);
1274 }
1275 
1277  llvm::json::Path P) {
1278  llvm::json::ObjectMapper O(Params, P);
1279  return O && O.mapOptional("includeDeclaration", R.includeDeclaration);
1280 }
1281 
1283  llvm::json::Path P) {
1285  llvm::json::ObjectMapper O(Params, P);
1286  return fromJSON(Params, Base, P) && O && O.mapOptional("context", R.context);
1287 }
1288 
1290  return llvm::json::Value{static_cast<int>(Tag)};
1291 }
1292 
1294  llvm::json::Object Result{{"name", I.name},
1295  {"kind", static_cast<int>(I.kind)},
1296  {"range", I.range},
1297  {"selectionRange", I.selectionRange},
1298  {"uri", I.uri}};
1299  if (!I.tags.empty())
1300  Result["tags"] = I.tags;
1301  if (!I.detail.empty())
1302  Result["detail"] = I.detail;
1303  if (!I.data.empty())
1304  Result["data"] = I.data;
1305  return std::move(Result);
1306 }
1307 
1309  llvm::json::Path P) {
1310  llvm::json::ObjectMapper O(Params, P);
1311 
1312  // Populate the required fields only. We don't care about the
1313  // optional fields `Tags` and `Detail` for the purpose of
1314  // client --> server communication.
1315  return O && O.map("name", I.name) && O.map("kind", I.kind) &&
1316  O.map("uri", I.uri) && O.map("range", I.range) &&
1317  O.map("selectionRange", I.selectionRange) &&
1318  mapOptOrNull(Params, "data", I.data, P);
1319 }
1320 
1321 bool fromJSON(const llvm::json::Value &Params,
1323  llvm::json::ObjectMapper O(Params, P);
1324  return O.map("item", C.item);
1325 }
1326 
1328  return llvm::json::Object{{"from", C.from}, {"fromRanges", C.fromRanges}};
1329 }
1330 
1331 bool fromJSON(const llvm::json::Value &Params,
1333  llvm::json::ObjectMapper O(Params, P);
1334  return O.map("item", C.item);
1335 }
1336 
1338  return llvm::json::Object{{"to", C.to}, {"fromRanges", C.fromRanges}};
1339 }
1340 
1342  llvm::json::Path P) {
1343  llvm::json::ObjectMapper O(Params, P);
1344  return O && O.map("textDocument", R.textDocument) && O.map("range", R.range);
1345 }
1346 
1348  switch (Kind) {
1349  case InlayHintKind::Type:
1350  return 1;
1352  return 2;
1353  case InlayHintKind::Designator: // This is an extension, don't serialize.
1354  return nullptr;
1355  }
1356  llvm_unreachable("Unknown clang.clangd.InlayHintKind");
1357 }
1358 
1360  llvm::json::Object Result{{"position", H.position},
1361  {"label", H.label},
1362  {"paddingLeft", H.paddingLeft},
1363  {"paddingRight", H.paddingRight}};
1364  auto K = toJSON(H.kind);
1365  if (!K.getAsNull())
1366  Result["kind"] = std::move(K);
1367  return std::move(Result);
1368 }
1369 bool operator==(const InlayHint &A, const InlayHint &B) {
1370  return std::tie(A.position, A.range, A.kind, A.label) ==
1371  std::tie(B.position, B.range, B.kind, B.label);
1372 }
1373 bool operator<(const InlayHint &A, const InlayHint &B) {
1374  return std::tie(A.position, A.range, A.kind, A.label) <
1375  std::tie(B.position, B.range, B.kind, B.label);
1376 }
1377 
1378 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, InlayHintKind Kind) {
1379  auto ToString = [](InlayHintKind K) {
1380  switch (K) {
1382  return "parameter";
1383  case InlayHintKind::Type:
1384  return "type";
1386  return "designator";
1387  }
1388  llvm_unreachable("Unknown clang.clangd.InlayHintKind");
1389  };
1390  return OS << ToString(Kind);
1391 }
1392 
1393 static const char *toString(OffsetEncoding OE) {
1394  switch (OE) {
1395  case OffsetEncoding::UTF8:
1396  return "utf-8";
1397  case OffsetEncoding::UTF16:
1398  return "utf-16";
1399  case OffsetEncoding::UTF32:
1400  return "utf-32";
1402  return "unknown";
1403  }
1404  llvm_unreachable("Unknown clang.clangd.OffsetEncoding");
1405 }
1408  llvm::json::Path P) {
1409  auto Str = V.getAsString();
1410  if (!Str)
1411  return false;
1412  OE = llvm::StringSwitch<OffsetEncoding>(*Str)
1413  .Case("utf-8", OffsetEncoding::UTF8)
1414  .Case("utf-16", OffsetEncoding::UTF16)
1415  .Case("utf-32", OffsetEncoding::UTF32)
1417  return true;
1418 }
1419 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, OffsetEncoding Enc) {
1420  return OS << toString(Enc);
1421 }
1422 
1424  llvm::json::Path P) {
1425  llvm::json::ObjectMapper O(Params, P);
1426  return O && O.map("textDocument", S.textDocument) &&
1427  O.map("positions", S.positions);
1428 }
1429 
1431  if (Out.parent) {
1432  return llvm::json::Object{{"range", Out.range},
1433  {"parent", toJSON(*Out.parent)}};
1434  }
1435  return llvm::json::Object{{"range", Out.range}};
1436 }
1437 
1439  llvm::json::Path P) {
1440  llvm::json::ObjectMapper O(Params, P);
1441  return O && O.map("textDocument", R.textDocument);
1442 }
1443 
1445  return llvm::json::Object{
1446  {"range", DocumentLink.range},
1447  {"target", DocumentLink.target},
1448  };
1449 }
1450 
1452  llvm::json::Path P) {
1453  llvm::json::ObjectMapper O(Params, P);
1454  return O && O.map("textDocument", R.textDocument);
1455 }
1456 
1457 const llvm::StringLiteral FoldingRange::REGION_KIND = "region";
1458 const llvm::StringLiteral FoldingRange::COMMENT_KIND = "comment";
1459 const llvm::StringLiteral FoldingRange::IMPORT_KIND = "import";
1460 
1462  llvm::json::Object Result{
1463  {"startLine", Range.startLine},
1464  {"endLine", Range.endLine},
1465  };
1466  if (Range.startCharacter)
1467  Result["startCharacter"] = Range.startCharacter;
1468  if (Range.endCharacter)
1469  Result["endCharacter"] = Range.endCharacter;
1470  if (!Range.kind.empty())
1471  Result["kind"] = Range.kind;
1472  return Result;
1473 }
1474 
1476  llvm::json::Object Out;
1477  int64_t Total = MT.self();
1478  Out["_self"] = Total;
1479  for (const auto &Entry : MT.children()) {
1480  auto Child = toJSON(Entry.getSecond());
1481  Total += *Child.getAsObject()->getInteger("_total");
1482  Out[Entry.first] = std::move(Child);
1483  }
1484  Out["_total"] = Total;
1485  return Out;
1486 }
1487 
1488 bool fromJSON(const llvm::json::Value &Params, ASTParams &R,
1489  llvm::json::Path P) {
1490  llvm::json::ObjectMapper O(Params, P);
1491  return O && O.map("textDocument", R.textDocument) && O.map("range", R.range);
1492 }
1493 
1495  llvm::json::Object Result{
1496  {"role", N.role},
1497  {"kind", N.kind},
1498  };
1499  if (!N.children.empty())
1500  Result["children"] = N.children;
1501  if (!N.detail.empty())
1502  Result["detail"] = N.detail;
1503  if (!N.arcana.empty())
1504  Result["arcana"] = N.arcana;
1505  if (N.range)
1506  Result["range"] = *N.range;
1507  return Result;
1508 }
1509 
1510 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const ASTNode &Root) {
1511  std::function<void(const ASTNode &, unsigned)> Print = [&](const ASTNode &N,
1512  unsigned Level) {
1513  OS.indent(2 * Level) << N.role << ": " << N.kind;
1514  if (!N.detail.empty())
1515  OS << " - " << N.detail;
1516  OS << "\n";
1517  for (const ASTNode &C : N.children)
1518  Print(C, Level + 1);
1519  };
1520  Print(Root, 0);
1521  return OS;
1522 }
1523 
1525  auto Str = E.getAsString();
1526  if (!Str) {
1527  P.report("expected a string");
1528  return false;
1529  }
1530  auto ID = SymbolID::fromStr(*Str);
1531  if (!ID) {
1532  elog("Malformed symbolid: {0}", ID.takeError());
1533  P.report("malformed symbolid");
1534  return false;
1535  }
1536  S = *ID;
1537  return true;
1538 }
1539 llvm::json::Value toJSON(const SymbolID &S) { return S.str(); }
1540 
1541 } // namespace clangd
1542 } // namespace clang
clang::clangd::TraceLevel::Messages
@ Messages
clang::clangd::ReferenceContext::includeDeclaration
bool includeDeclaration
Include the declaration of the current symbol.
Definition: Protocol.h:1633
clang::clangd::CallHierarchyItem::selectionRange
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition: Protocol.h:1500
clang::clangd::DocumentHighlight
A document highlight is a range inside a text document which deserves special attention.
Definition: Protocol.h:1362
Total
unsigned Total
Definition: FunctionCognitiveComplexityCheck.cpp:145
clang::clangd::TypeHierarchyItem::selectionRange
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition: Protocol.h:1422
clang::clangd::WorkspaceEdit
Definition: Protocol.h:955
clang::clangd::DocumentSymbol::range
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else like co...
Definition: Protocol.h:1052
clang::clangd::InlayHintKind::Designator
@ Designator
A hint before an element of an aggregate braced initializer list, indicating what it is initializing.
clang::clangd::SymbolKind::Field
@ Field
clang::clangd::TypeHierarchyPrepareParams::direction
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
Definition: Protocol.h:1398
clang::clangd::DidOpenTextDocumentParams::textDocument
TextDocumentItem textDocument
The document that was opened.
Definition: Protocol.h:690
Base
std::unique_ptr< GlobalCompilationDatabase > Base
Definition: GlobalCompilationDatabaseTests.cpp:85
clang::clangd::Diagnostic::source
std::string source
A human-readable string describing the source of this diagnostic, e.g.
Definition: Protocol.h:871
clang::clangd::DocumentOnTypeFormattingParams::ch
std::string ch
The character that has been typed.
Definition: Protocol.h:804
clang::clangd::SymbolKindMin
constexpr auto SymbolKindMin
Definition: Protocol.h:365
clang::clangd::TextDocumentIdentifier::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:133
clang::clangd::ClangdCompileCommand
Clangd extension that's used in the 'compilationDatabaseChanges' in workspace/didChangeConfiguration ...
Definition: Protocol.h:512
clang::clangd::ReferenceContext
Definition: Protocol.h:1631
clang::clangd::ClangdCompileCommand::workingDirectory
std::string workingDirectory
Definition: Protocol.h:513
clang::clangd::MarkupKind::PlainText
@ PlainText
clang::clangd::ClientCapabilities::DiagnosticFixes
bool DiagnosticFixes
Whether the client accepts diagnostics with codeActions attached inline.
Definition: Protocol.h:412
clang::clangd::MarkupKind::Markdown
@ Markdown
clang::clangd::DidChangeTextDocumentParams::wantDiagnostics
llvm::Optional< bool > wantDiagnostics
Forces diagnostics to be generated, or to not be generated, for this version of the file.
Definition: Protocol.h:735
clang::clangd::SemanticTokensDeltaParams::previousResultId
std::string previousResultId
The previous result id.
Definition: Protocol.h:1698
clang::clangd::SemanticToken::tokenModifiers
unsigned tokenModifiers
each set bit will be looked up in SemanticTokensLegend.tokenModifiers
Definition: Protocol.h:1667
clang::clangd::Edit
A set of edits generated for a single file.
Definition: SourceCode.h:184
clang::clangd::SemanticTokensParams
Body of textDocument/semanticTokens/full request.
Definition: Protocol.h:1685
E
const Expr * E
Definition: AvoidBindCheck.cpp:88
clang::clangd::Location::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:213
clang::clangd::SymbolTag
SymbolTag
Definition: Protocol.h:1469
clang::clangd::PublishDiagnosticsParams::diagnostics
std::vector< Diagnostic > diagnostics
An array of diagnostic information items.
Definition: Protocol.h:920
clang::clangd::FileEvent::uri
URIForFile uri
The file's URI.
Definition: Protocol.h:759
clang::clangd::TraceLevel
TraceLevel
Definition: Protocol.h:265
clang::clangd::ClientCapabilities::DiagnosticCategory
bool DiagnosticCategory
Whether the client accepts diagnostics with category attached to it using the "category" extension.
Definition: Protocol.h:421
clang::clangd::SemanticTokensOrDelta::resultId
std::string resultId
Definition: Protocol.h:1717
clang::clangd::CompletionItemKind::Class
@ Class
clang::clangd::FileEvent
Definition: Protocol.h:757
clang::clangd::CallHierarchyItem::uri
URIForFile uri
The resource identifier of this item.
Definition: Protocol.h:1491
clang::clangd::ShowMessageParams::type
MessageType type
The message type.
Definition: Protocol.h:682
clang::clangd::ResolveTypeHierarchyItemParams::resolve
int resolve
The hierarchy levels to resolve. 0 indicates no level.
Definition: Protocol.h:1461
clang::clangd::SemanticTokensParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1687
clang::clangd::CallHierarchyItem::detail
std::string detail
More detaill for this item, e.g. the signature of a function.
Definition: Protocol.h:1488
clang::clangd::CodeAction
A code action represents a change that can be performed in code, e.g.
Definition: Protocol.h:1001
clang::clangd::Diagnostic::category
llvm::Optional< std::string > category
The diagnostic's category.
Definition: Protocol.h:887
clang::clangd::SemanticTokensDeltaParams
Body of textDocument/semanticTokens/full/delta request.
Definition: Protocol.h:1694
clang::clangd::MarkupContent::kind
MarkupKind kind
Definition: Protocol.h:1179
clang::clangd::Location
Definition: Protocol.h:211
clang::clangd::ClientCapabilities::CompletionItemKinds
llvm::Optional< CompletionItemKindBitset > CompletionItemKinds
The supported set of CompletionItemKinds for textDocument/completion.
Definition: Protocol.h:457
clang::clangd::SemanticTokenEncodingSize
constexpr unsigned SemanticTokenEncodingSize
Definition: Protocol.cpp:1102
clang::clangd::DocumentOnTypeFormattingParams::textDocument
TextDocumentIdentifier textDocument
The document to format.
Definition: Protocol.h:798
clang::clangd::WorkDoneProgressEnd::message
llvm::Optional< std::string > message
Optional, a final message indicating to for example indicate the outcome of the operation.
Definition: Protocol.h:662
clang::clangd::TypeHierarchyItem::ResolveParams::parents
llvm::Optional< std::vector< ResolveParams > > parents
None means parents aren't resolved and empty is no parents.
Definition: Protocol.h:1428
clang::clangd::DocumentRangeFormattingParams::textDocument
TextDocumentIdentifier textDocument
The document to format.
Definition: Protocol.h:788
clang::clangd::InitializeParams::processId
llvm::Optional< int > processId
The process Id of the parent process that started the server.
Definition: Protocol.h:554
clang::clangd::ASTNode::detail
std::string detail
Brief additional information, such as "||" for the particular operator.
Definition: Protocol.h:1850
clang::clangd::SymbolDetails::definitionRange
llvm::Optional< Location > definitionRange
Definition: Protocol.h:1108
clang::clangd::CompletionList
Represents a collection of completion items to be presented in the editor.
Definition: Protocol.h:1280
clang::clangd::ClientCapabilities::CompletionFixes
bool CompletionFixes
Client supports completions with additionalTextEdit near the cursor.
Definition: Protocol.h:430
Diagnostics
WantDiagnostics Diagnostics
Definition: TUScheduler.cpp:661
clang::clangd::Context::get
const Type * get(const Key< Type > &Key) const
Get data stored for a typed Key.
Definition: Context.h:98
clang::clangd::CodeActionContext::only
std::vector< std::string > only
Requested kind of actions to return.
Definition: Protocol.h:939
clang::clangd::DiagnosticTag
DiagnosticTag
Definition: Protocol.h:834
clang::clangd::ClientCapabilities
Definition: Protocol.h:405
clang::clangd::SemanticTokensEdit
Describes a replacement of a contiguous range of semanticTokens.
Definition: Protocol.h:1704
clang::clangd::SemanticTokensOrDelta
This models LSP SemanticTokensDelta | SemanticTokens, which is the result of textDocument/semanticTok...
Definition: Protocol.h:1716
clang::clangd::DocumentRangeFormattingParams::range
Range range
The range to format.
Definition: Protocol.h:791
clang::clangd::Hover
Definition: Protocol.h:1184
clang::clangd::ClientCapabilities::WorkspaceSymbolKinds
llvm::Optional< SymbolKindBitset > WorkspaceSymbolKinds
The supported set of SymbolKinds for workspace/symbol.
Definition: Protocol.h:408
clang::clangd::SelectionRangeParams::positions
std::vector< Position > positions
The positions inside the text document.
Definition: Protocol.h:1730
clang::clangd::DidCloseTextDocumentParams
Definition: Protocol.h:695
clang::clangd::DocumentOnTypeFormattingParams::position
Position position
The position at which this request was sent.
Definition: Protocol.h:801
clang::clangd::SignatureInformation::documentation
MarkupContent documentation
The documentation of this signature. Optional.
Definition: Protocol.h:1314
CI
std::unique_ptr< CompilerInvocation > CI
Definition: TUScheduler.cpp:549
clang::clangd::CodeAction::isPreferred
bool isPreferred
Marks this as a preferred action.
Definition: Protocol.h:1020
clang::clangd::ApplyWorkspaceEditResponse::applied
bool applied
Definition: Protocol.h:1133
clang::clangd::OffsetEncoding::UTF32
@ UTF32
Root
ASTNode Root
Definition: DumpAST.cpp:332
clang::clangd::SymbolInformation
Represents information about programming constructs like variables, classes, interfaces etc.
Definition: Protocol.h:1066
clang::clangd::DidChangeConfigurationParams::settings
ConfigurationSettings settings
Definition: Protocol.h:773
Kind
BindArgumentKind Kind
Definition: AvoidBindCheck.cpp:59
clang::clangd::CompletionItem::label
std::string label
The label of this completion item.
Definition: Protocol.h:1215
clang::clangd::ClientCapabilities::HierarchicalDocumentSymbol
bool HierarchicalDocumentSymbol
Client supports hierarchical document symbols.
Definition: Protocol.h:434
clang::clangd::Range::start
Position start
The range's start position.
Definition: Protocol.h:187
clang::clangd::URI::resolvePath
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...
Definition: URI.cpp:253
clang::clangd::CompletionItemKind::Folder
@ Folder
clang::clangd::DidChangeTextDocumentParams::forceRebuild
bool forceRebuild
Force a complete rebuild of the file, ignoring all cached state.
Definition: Protocol.h:741
clang::clangd::SymbolInformation::name
std::string name
The name of this symbol.
Definition: Protocol.h:1068
clang::clangd::ClientCapabilities::CompletionDocumentationFormat
MarkupKind CompletionDocumentationFormat
The documentation format that should be used for textDocument/completion.
Definition: Protocol.h:461
clang::clangd::FileChangeType::Created
@ Created
The file got created.
clang::clangd::CallHierarchyItem::tags
std::vector< SymbolTag > tags
Tags for this item.
Definition: Protocol.h:1485
clang::clangd::ParameterInformation::documentation
std::string documentation
The documentation of this parameter. Optional.
Definition: Protocol.h:1303
clang::clangd::TypeHierarchyItem::kind
SymbolKind kind
The kind of this item.
Definition: Protocol.h:1408
clang::clangd::FoldingRangeParams
Definition: Protocol.h:1784
clang::clangd::ClientCapabilities::CompletionSnippets
bool CompletionSnippets
Client supports snippets as insert text.
Definition: Protocol.h:425
clang::clangd::Location::range
Range range
Definition: Protocol.h:214
clang::clangd::SemanticToken::deltaLine
unsigned deltaLine
token line number, relative to the previous token
Definition: Protocol.h:1658
clang::clangd::InitializeParams
Definition: Protocol.h:549
clang::clangd::DocumentHighlight::range
Range range
The range this highlight applies to.
Definition: Protocol.h:1364
clang::clangd::URIForFile::fromURI
static llvm::Expected< URIForFile > fromURI(const URI &U, llvm::StringRef HintPath)
Definition: Protocol.cpp:58
clang::clangd::CompletionItemKind::Text
@ Text
clang::clangd::FoldingRange::COMMENT_KIND
const static llvm::StringLiteral COMMENT_KIND
Definition: Protocol.h:1798
clang::clangd::CodeActionParams::textDocument
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Definition: Protocol.h:945
clang::clangd::SymbolKind::Class
@ Class
clang::clangd::CodeActionParams::context
CodeActionContext context
Context carrying additional information.
Definition: Protocol.h:951
clang::clangd::TextDocumentItem
Definition: Protocol.h:247
clang::clangd::ApplyWorkspaceEditResponse::failureReason
llvm::Optional< std::string > failureReason
Definition: Protocol.h:1134
clang::clangd::ASTNode::kind
std::string kind
The specific kind of node this is, such as "BinaryOperator".
Definition: Protocol.h:1847
clang::clangd::ASTParams::range
llvm::Optional< Range > range
The position of the node to be dumped.
Definition: Protocol.h:1834
clang::clangd::ParameterInformation::labelOffsets
llvm::Optional< std::pair< unsigned, unsigned > > labelOffsets
Inclusive start and exclusive end offsets withing the containing signature label.
Definition: Protocol.h:1300
clang::clangd::CallHierarchyIncomingCall
Represents an incoming call, e.g. a caller of a method or constructor.
Definition: Protocol.h:1517
clang::clangd::URI::parse
static llvm::Expected< URI > parse(llvm::StringRef Uri)
Parse a URI string "<scheme>:[//<authority>/]<path>".
Definition: URI.cpp:177
clang::clangd::InitializeParams::rawCapabilities
llvm::json::Object rawCapabilities
The same data as capabilities, but not parsed (to expose to modules).
Definition: Protocol.h:573
clang::clangd::WorkspaceSymbolParams::limit
llvm::Optional< int > limit
Max results to return, overriding global default.
Definition: Protocol.h:1122
clang::clangd::DocumentSymbol::children
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Definition: Protocol.h:1059
clang::clangd::SymbolKindBitset
std::bitset< SymbolKindMax+1 > SymbolKindBitset
Definition: Protocol.h:367
clang::clangd::CompletionItem
Definition: Protocol.h:1212
clang::clangd::SymbolDetails::containerName
std::string containerName
Definition: Protocol.h:1095
clang::clangd::DocumentFormattingParams
Definition: Protocol.h:809
clang::clangd::TypeHierarchyItem::range
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else,...
Definition: Protocol.h:1418
clang::clangd::TextDocumentItem::version
llvm::Optional< int64_t > version
The version number of this document (it will strictly increase after each change, including undo/redo...
Definition: Protocol.h:258
clang::clangd::SymbolKind
SymbolKind
A symbol kind.
Definition: Protocol.h:336
clang::clangd::WorkDoneProgressBegin::cancellable
bool cancellable
Controls if a cancel button should show to allow the user to cancel the long-running operation.
Definition: Protocol.h:611
clang::clangd::RenameParams::position
Position position
The position at which this request was sent.
Definition: Protocol.h:1349
clang::clangd::Diagnostic::range
Range range
The range at which the message applies.
Definition: Protocol.h:857
clang::clangd::MarkupContent::value
std::string value
Definition: Protocol.h:1180
clang::clangd::WorkDoneProgressReport::cancellable
llvm::Optional< bool > cancellable
Controls enablement state of a cancel button.
Definition: Protocol.h:639
clang::clangd::DocumentSymbolParams
Definition: Protocol.h:816
clang::clangd::ASTNode::range
llvm::Optional< Range > range
The range of the original source file covered by this node.
Definition: Protocol.h:1858
clang::clangd::OffsetEncoding::UTF8
@ UTF8
clang::clangd::CompletionItemKindBitset
std::bitset< CompletionItemKindMax+1 > CompletionItemKindBitset
Definition: Protocol.h:328
clang::clangd::Position::line
int line
Line position in a document (zero-based).
Definition: Protocol.h:158
clang::clangd::CodeAction::kind
llvm::Optional< std::string > kind
The kind of the code action.
Definition: Protocol.h:1007
clang::clangd::SelectionRangeParams
Definition: Protocol.h:1725
clang::clangd::WorkDoneProgressBegin
To start progress reporting a $/progress notification with the following payload must be sent.
Definition: Protocol.h:601
clang::clangd::SymbolKind::TypeParameter
@ TypeParameter
clang::clangd::DiagnosticRelatedInformation::location
Location location
The location of this related diagnostic information.
Definition: Protocol.h:828
clang::clangd::CompletionItemKind::Enum
@ Enum
clang::clangd::CodeAction::title
std::string title
A short, human-readable, title for this code action.
Definition: Protocol.h:1003
clang::clangd::DocumentHighlight::kind
DocumentHighlightKind kind
The highlight kind, default is DocumentHighlightKind.Text.
Definition: Protocol.h:1367
clang::clangd::SymbolDetails::name
std::string name
Definition: Protocol.h:1093
Protocol.h
clang::clangd::InlayHint
Inlay hint information.
Definition: Protocol.h:1591
clang::clangd::toTextKind
static llvm::StringRef toTextKind(MarkupKind Kind)
Definition: Protocol.cpp:897
clang::clangd::WorkspaceEdit::changes
std::map< std::string, std::vector< TextEdit > > changes
Holds changes to existing resources.
Definition: Protocol.h:957
clang::clangd::TypeHierarchyDirection::Both
@ Both
clang::clangd::SignatureInformation::parameters
std::vector< ParameterInformation > parameters
The parameters of this signature.
Definition: Protocol.h:1317
clang::clangd::URI::resolve
static llvm::Expected< std::string > resolve(const URI &U, llvm::StringRef HintPath="")
Resolves the absolute path of U.
Definition: URI.cpp:245
clang::clangd::Diagnostic
Definition: Protocol.h:855
clang::clangd::TextDocumentItem::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:249
clang::clangd::WorkDoneProgressEnd
Signals the end of progress reporting.
Definition: Protocol.h:659
clang::clangd::ClientCapabilities::offsetEncoding
llvm::Optional< std::vector< OffsetEncoding > > offsetEncoding
Supported encodings for LSP character offsets. (clangd extension).
Definition: Protocol.h:478
clang::clangd::ClientCapabilities::OffsetsInSignatureHelp
bool OffsetsInSignatureHelp
Client supports processing label offsets instead of a simple label string.
Definition: Protocol.h:448
ns1::ns2::A
@ A
Definition: CategoricalFeature.h:3
clang::clangd::CompletionContext::triggerCharacter
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
Definition: Protocol.h:1165
clang::clangd::Position
Definition: Protocol.h:156
clang::clangd::FoldingRange::REGION_KIND
const static llvm::StringLiteral REGION_KIND
Definition: Protocol.h:1797
clang::clangd::CodeAction::edit
llvm::Optional< WorkspaceEdit > edit
The workspace edit this code action performs.
Definition: Protocol.h:1023
clang::clangd::InitializeParams::capabilities
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool)
Definition: Protocol.h:571
clang::clangd::SymbolDetails::ID
SymbolID ID
Definition: Protocol.h:1104
ns1::ns2::D
@ D
Definition: CategoricalFeature.h:3
clang::clangd::SymbolKind::Method
@ Method
clang::clangd::SymbolKind::Function
@ Function
clang::clangd::ExecuteCommandParams::argument
llvm::json::Value argument
Definition: Protocol.h:986
clang::clangd::FileStatus::state
std::string state
The human-readable string presents the current state of the file, can be shown in the UI (e....
Definition: Protocol.h:1648
clang::clangd::ClientCapabilities::RenamePrepareSupport
bool RenamePrepareSupport
The client supports testing for validity of rename operations before execution.
Definition: Protocol.h:486
clang::clangd::Unknown
@ Unknown
Definition: FuzzyMatch.h:56
clang::clangd::ClientCapabilities::HoverContentFormat
MarkupKind HoverContentFormat
The content format that should be used for Hover requests.
Definition: Protocol.h:482
clang::clangd::TweakArgs
Arguments for the 'applyTweak' command.
Definition: Protocol.h:969
clang::clangd::TypeHierarchyDirection::Children
@ Children
clang::clangd::ClientCapabilities::SignatureHelpDocumentationFormat
MarkupKind SignatureHelpDocumentationFormat
The documentation format that should be used for textDocument/signatureHelp.
Definition: Protocol.h:453
clang::clangd::SemanticToken
Specifies a single semantic token in the document.
Definition: Protocol.h:1656
clang::clangd::MemoryTree
A tree that can be used to represent memory usage of nested components while preserving the hierarchy...
Definition: MemoryTree.h:30
clang::clangd::ClientCapabilities::LineFoldingOnly
bool LineFoldingOnly
Client signals that it only supports folding complete lines.
Definition: Protocol.h:444
clang::clangd::SignatureInformation::label
std::string label
The label of this signature. Mandatory.
Definition: Protocol.h:1311
clang::clangd::SemanticTokensOrDelta::edits
llvm::Optional< std::vector< SemanticTokensEdit > > edits
Set if we computed edits relative to a previous set of tokens.
Definition: Protocol.h:1719
clang::clangd::SignatureHelp::signatures
std::vector< SignatureInformation > signatures
The resulting signatures.
Definition: Protocol.h:1327
clang::clangd::DocumentSymbolParams::textDocument
TextDocumentIdentifier textDocument
Definition: Protocol.h:818
clang::clangd::DidChangeWatchedFilesParams
Definition: Protocol.h:765
clang::clangd::ASTNode::role
std::string role
The general kind of node, such as "expression" Corresponds to the base AST node type such as Expr.
Definition: Protocol.h:1843
clang::clangd::PublishDiagnosticsParams::uri
URIForFile uri
The URI for which diagnostic information is reported.
Definition: Protocol.h:918
clang::clangd::Diag
A top-level diagnostic that may have Notes and Fixes.
Definition: Diagnostics.h:94
clang::clangd::toJSON
llvm::json::Value toJSON(const FuzzyFindRequest &Request)
Definition: Index.cpp:45
Logger.h
clang::clangd::WorkDoneProgressReport::message
llvm::Optional< std::string > message
Optional, more detailed associated progress message.
Definition: Protocol.h:646
clang::clangd::SemanticToken::deltaStart
unsigned deltaStart
token start character, relative to the previous token (relative to 0 or the previous token's start if...
Definition: Protocol.h:1661
Args
llvm::json::Object Args
Definition: Trace.cpp:138
clang::clangd::SymbolKind::Interface
@ Interface
clang::clangd::OffsetEncoding::UTF16
@ UTF16
clang::clangd::TypeHierarchyItem::name
std::string name
The name of this item.
Definition: Protocol.h:1405
clang::clangd::Symbol
The class presents a C++ symbol, e.g.
Definition: Symbol.h:36
clang::clangd::SemanticToken::tokenType
unsigned tokenType
will be looked up in SemanticTokensLegend.tokenTypes
Definition: Protocol.h:1665
clang::clangd::FileChangeType::Deleted
@ Deleted
The file got deleted.
clang::clangd::CallHierarchyOutgoingCall
Represents an outgoing call, e.g.
Definition: Protocol.h:1536
clang::clangd::fromJSON
bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request, llvm::json::Path P)
Definition: Index.cpp:30
clang::clangd::TextDocumentIdentifier
Definition: Protocol.h:131
clang::clangd::DocumentSymbol::detail
std::string detail
More detail for this symbol, e.g the signature of a function.
Definition: Protocol.h:1040
clang::clangd::DocumentRangeFormattingParams
Definition: Protocol.h:786
clang::clangd::WorkDoneProgressCreateParams::token
llvm::json::Value token
The token to be used to report progress.
Definition: Protocol.h:585
clang::clangd::FileStatus::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:1645
clang::clangd::CallHierarchyItem::data
std::string data
An optional 'data' field, which can be used to identify a call hierarchy item in an incomingCalls or ...
Definition: Protocol.h:1504
clang::clangd::ExecuteCommandParams::command
std::string command
The identifier of the actual command handler.
Definition: Protocol.h:982
clang::clangd::FoldingRangeParams::textDocument
TextDocumentIdentifier textDocument
Definition: Protocol.h:1785
clang::clangd::indexSymbolKindToSymbolKind
SymbolKind indexSymbolKindToSymbolKind(index::SymbolKind Kind)
Definition: Protocol.cpp:250
clang::clangd::Diagnostic::data
llvm::json::Object data
A data entry field that is preserved between a textDocument/publishDiagnostics notification and textD...
Definition: Protocol.h:899
clang::clangd::TypeHierarchyItem::ResolveParams::symbolID
SymbolID symbolID
Definition: Protocol.h:1426
clang::clangd::DocumentSymbol::selectionRange
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition: Protocol.h:1056
clang::clangd::CodeDescription
Structure to capture a description for an error code.
Definition: Protocol.h:848
clang::clangd::TextDocumentItem::languageId
std::string languageId
The text document's language identifier.
Definition: Protocol.h:252
clang::clangd::CompletionItem::sortText
std::string sortText
A string that should be used when comparing this item with other items.
Definition: Protocol.h:1230
clang::clangd::InsertTextFormat::Missing
@ Missing
clang::clangd::toString
static const char * toString(OffsetEncoding OE)
Definition: Protocol.cpp:1393
clang::clangd::Position::character
int character
Character offset on a line in a document (zero-based).
Definition: Protocol.h:163
clang::clangd::ReferenceParams::context
ReferenceContext context
Definition: Protocol.h:1637
clang::clangd::CompletionContext::triggerKind
CompletionTriggerKind triggerKind
How the completion was triggered.
Definition: Protocol.h:1162
clang::clangd::CompletionItemKind::Struct
@ Struct
clang::clangd::TextDocumentPositionParams::position
Position position
The position inside the text document.
Definition: Protocol.h:1144
clang::clangd::Range::end
Position end
The range's end position.
Definition: Protocol.h:190
clang::clangd::SymbolID::str
std::string str() const
Definition: SymbolID.cpp:34
clang::clangd::DocumentSymbol
Represents programming constructs like variables, classes, interfaces etc.
Definition: Protocol.h:1035
clang::clangd::SemanticTokensOrDelta::tokens
llvm::Optional< std::vector< SemanticToken > > tokens
Set if we computed a fresh set of tokens.
Definition: Protocol.h:1721
clang::clangd::URIForFile
Definition: Protocol.h:84
clang::clangd::SemanticToken::length
unsigned length
the length of the token. A token cannot be multiline
Definition: Protocol.h:1663
clang::clangd::URIForFile::uri
std::string uri() const
Definition: Protocol.h:107
clang::clangd::DidChangeConfigurationParams
Definition: Protocol.h:772
clang::clangd::SymbolKind::Enum
@ Enum
clang::clangd::DidChangeWatchedFilesParams::changes
std::vector< FileEvent > changes
The actual file events.
Definition: Protocol.h:767
clang::clangd::TypeHierarchyItem::children
llvm::Optional< std::vector< TypeHierarchyItem > > children
If this type hierarchy item is resolved, it contains the direct children of the current item.
Definition: Protocol.h:1447
clang::clangd::SelectionRange
Definition: Protocol.h:1735
clang::clangd::SymbolDetails::declarationRange
llvm::Optional< Location > declarationRange
Definition: Protocol.h:1106
clang::clangd::MemoryTree::children
const llvm::DenseMap< llvm::StringRef, MemoryTree > & children() const
Returns edges to direct children of this node.
Definition: MemoryTree.cpp:42
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:2217
clang::clangd::CodeAction::command
llvm::Optional< Command > command
A command this code action executes.
Definition: Protocol.h:1027
clang::clangd::DocumentFormattingParams::textDocument
TextDocumentIdentifier textDocument
The document to format.
Definition: Protocol.h:811
clang::clangd::CompletionItemKind
CompletionItemKind
The kind of a completion entry.
Definition: Protocol.h:294
clang::clangd::TypeHierarchyItem::uri
URIForFile uri
The resource identifier of this item.
Definition: Protocol.h:1414
clang::clangd::DocumentHighlightKind::Write
@ Write
clang::clangd::SymbolDetails
Represents information about identifier.
Definition: Protocol.h:1092
clang::clangd::ConfigurationSettings
Clangd extension: parameters configurable at any time, via the workspace/didChangeConfiguration notif...
Definition: Protocol.h:522
clang::clangd::DocumentLinkParams
Parameters for the document link request.
Definition: Protocol.h:1749
clang::clangd::ClientCapabilities::DiagnosticRelatedInformation
bool DiagnosticRelatedInformation
Whether the client accepts diagnostics with related locations.
Definition: Protocol.h:416
clang::clangd::SymbolDetails::USR
std::string USR
Unified Symbol Resolution identifier This is an opaque string uniquely identifying a symbol.
Definition: Protocol.h:1102
clang::clangd::ExecuteCommandParams
Definition: Protocol.h:980
clang::clangd::SymbolKind::Module
@ Module
SymbolKind
clang::find_all_symbols::SymbolInfo::SymbolKind SymbolKind
Definition: SymbolInfo.cpp:19
clang::clangd::SignatureHelp::activeSignature
int activeSignature
The active signature.
Definition: Protocol.h:1330
clang::clangd::TextDocumentItem::text
std::string text
The content of the opened text document.
Definition: Protocol.h:261
clang::clangd::InitializeParams::initializationOptions
InitializationOptions initializationOptions
User-provided initialization options.
Definition: Protocol.h:579
clang::clangd::encodeTokens
static llvm::json::Value encodeTokens(llvm::ArrayRef< SemanticToken > Toks)
Definition: Protocol.cpp:1103
clang::clangd::SymbolInformation::score
llvm::Optional< float > score
The score that clangd calculates to rank the returned symbols.
Definition: Protocol.h:1085
clang::clangd::CallHierarchyIncomingCallsParams
The parameter of a callHierarchy/incomingCalls request.
Definition: Protocol.h:1510
Entry
Definition: Modularize.cpp:427
clang::clangd::CompletionItemKind::File
@ File
clang::clangd::CodeActionContext::diagnostics
std::vector< Diagnostic > diagnostics
An array of diagnostics known on the client side overlapping the range provided to the textDocument/c...
Definition: Protocol.h:933
clang::clangd::SelectionRangeParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1727
clang::clangd::WorkDoneProgressReport
Reporting progress is done using the following payload.
Definition: Protocol.h:627
clang::clangd::PublishDiagnosticsParams
Definition: Protocol.h:916
clang::clangd::MemoryTree::self
size_t self() const
Returns total number of bytes used by this node only.
Definition: MemoryTree.h:65
clang::clangd::ClientCapabilities::WorkDoneProgress
bool WorkDoneProgress
The client supports progress notifications.
Definition: Protocol.h:490
clang::clangd::MarkupKind
MarkupKind
Definition: Protocol.h:395
clang::clangd::CodeAction::diagnostics
llvm::Optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
Definition: Protocol.h:1013
clang::clangd::MessageType
MessageType
Definition: Protocol.h:666
clang::clangd::TypeHierarchyDirection
TypeHierarchyDirection
Definition: Protocol.h:1384
clang::clangd::SymbolKind::Variable
@ Variable
clang::clangd::TypeHierarchyItem
Definition: Protocol.h:1403
clang::clangd::DidChangeTextDocumentParams
Definition: Protocol.h:722
clang::clangd::CompletionTriggerKind
CompletionTriggerKind
Definition: Protocol.h:1149
clang::clangd::InlayHintKind::Type
@ Type
An inlay hint that for a type annotation.
clang::clangd::ConfigurationSettings::compilationDatabaseChanges
std::map< std::string, ClangdCompileCommand > compilationDatabaseChanges
Definition: Protocol.h:525
clang::clangd::TypeHierarchyItem::detail
llvm::Optional< std::string > detail
More detail for this item, e.g. the signature of a function.
Definition: Protocol.h:1411
clang::clangd::TypeHierarchyItem::deprecated
bool deprecated
true if the hierarchy item is deprecated.
Definition: Protocol.h:1438
clang::clangd::SignatureInformation
Represents the signature of something callable.
Definition: Protocol.h:1308
clang::clangd::ClientCapabilities::SemanticTokenRefreshSupport
bool SemanticTokenRefreshSupport
Whether the client implementation supports a refresh request sent from the server to the client.
Definition: Protocol.h:504
clang::clangd::ClientCapabilities::CodeActionStructure
bool CodeActionStructure
Client supports CodeAction return value for textDocument/codeAction.
Definition: Protocol.h:465
clang::clangd::ASTParams
Payload for textDocument/ast request.
Definition: Protocol.h:1827
Info
FunctionInfo Info
Definition: FunctionSizeCheck.cpp:121
clang::clangd::DocumentSymbol::kind
SymbolKind kind
The kind of this symbol.
Definition: Protocol.h:1043
ID
static char ID
Definition: Logger.cpp:74
clang::clangd::CompletionItemKind::EnumMember
@ EnumMember
clang::clangd::WorkDoneProgressBegin::percentage
bool percentage
Optional progress percentage to display (value 100 is considered 100%).
Definition: Protocol.h:622
clang::clangd::InlayHintsParams::range
llvm::Optional< Range > range
The visible document range for which inlay hints should be computed.
Definition: Protocol.h:1555
clang::clangd::DidChangeTextDocumentParams::contentChanges
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
Definition: Protocol.h:729
clang::clangd::DidChangeTextDocumentParams::textDocument
VersionedTextDocumentIdentifier textDocument
The document that did change.
Definition: Protocol.h:726
clang::clangd::TypeHierarchyPrepareParams
The type hierarchy params is an extension of the TextDocumentPositionsParams with optional properties...
Definition: Protocol.h:1391
clang::clangd::TextDocumentPositionParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1141
clang::clangd::DidSaveTextDocumentParams::textDocument
TextDocumentIdentifier textDocument
The document that was saved.
Definition: Protocol.h:704
clang::clangd::WorkspaceSymbolParams
The parameters of a Workspace Symbol Request.
Definition: Protocol.h:1115
clang::clangd::CompletionParams
Definition: Protocol.h:1169
clang::clangd::FoldingRange::IMPORT_KIND
const static llvm::StringLiteral IMPORT_KIND
Definition: Protocol.h:1799
clang::clangd::ClangdCompileCommand::compilationCommand
std::vector< std::string > compilationCommand
Definition: Protocol.h:514
clang::clangd::Range
Definition: Protocol.h:185
clang::clangd::FileEvent::type
FileChangeType type
The change type.
Definition: Protocol.h:761
clang::clangd::SignatureHelp
Represents the signature of a callable.
Definition: Protocol.h:1324
clang::clangd::FileChangeType
FileChangeType
Definition: Protocol.h:746
clang::clangd::SemanticTokens
A versioned set of tokens.
Definition: Protocol.h:1672
clang::clangd::VersionedTextDocumentIdentifier::version
llvm::Optional< std::int64_t > version
The version number of this document.
Definition: Protocol.h:150
C
const Criteria C
Definition: FunctionCognitiveComplexityCheck.cpp:93
clang::clangd::ShowMessageParams::message
std::string message
The actual message.
Definition: Protocol.h:684
clang::clangd::Diagnostic::message
std::string message
The diagnostic's message.
Definition: Protocol.h:874
clang::clangd::URIForFile::URIForFile
URIForFile()=default
clang::clangd::SymbolID::fromStr
static llvm::Expected< SymbolID > fromStr(llvm::StringRef)
Definition: SymbolID.cpp:36
clang::clangd::URIForFile::canonicalize
static URIForFile canonicalize(llvm::StringRef AbsPath, llvm::StringRef TUPath)
Canonicalizes AbsPath via URI.
Definition: Protocol.cpp:45
clang::clangd::ApplyWorkspaceEditResponse
Definition: Protocol.h:1132
clang::clangd::TypeHierarchyItem::ResolveParams
Used to resolve a client provided item back.
Definition: Protocol.h:1425
if
if(CLANG_PLUGIN_SUPPORT) export_executable_symbols_for_plugins(clang-tidy) endif() install(PROGRAMS clang-tidy-diff.py DESTINATION "$
Definition: clang-tidy/tool/CMakeLists.txt:59
clang::clangd::Diagnostic::severity
int severity
The diagnostic's severity.
Definition: Protocol.h:861
clang::clangd::ParameterInformation::labelString
std::string labelString
The label of this parameter. Ignored when labelOffsets is set.
Definition: Protocol.h:1294
clang::clangd::InitializeParams::trace
llvm::Optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
Definition: Protocol.h:576
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::clangd::PublishDiagnosticsParams::version
llvm::Optional< int64_t > version
The version number of the document the diagnostics are published for.
Definition: Protocol.h:922
clang::clangd::WorkDoneProgressReport::percentage
llvm::Optional< unsigned > percentage
Optional progress percentage to display (value 100 is considered 100%).
Definition: Protocol.h:654
OS
llvm::raw_string_ostream OS
Definition: TraceTests.cpp:160
clang::clangd::FoldingRange
Stores information about a region of code that can be folded.
Definition: Protocol.h:1791
clang::clangd::CodeAction::REFACTOR_KIND
const static llvm::StringLiteral REFACTOR_KIND
Definition: Protocol.h:1009
clang::clangd::DidSaveTextDocumentParams
Definition: Protocol.h:702
clang::clangd::TypeHierarchyItem::parents
llvm::Optional< std::vector< TypeHierarchyItem > > parents
This is a clangd exntesion.
Definition: Protocol.h:1441
clang::clangd::CallHierarchyItem::range
Range range
The range enclosing this symbol not including leading / trailing whitespace but everything else,...
Definition: Protocol.h:1495
clang::clangd::OffsetEncoding
OffsetEncoding
Definition: Protocol.h:379
clang::clangd::TextDocumentContentChangeEvent::range
llvm::Optional< Range > range
The range of the document that changed.
Definition: Protocol.h:711
clang::clangd::FileStatus
Clangd extension: indicates the current state of the file in clangd, sent from server via the textDoc...
Definition: Protocol.h:1643
clang::clangd::TextDocumentContentChangeEvent
Definition: Protocol.h:709
clang::clangd::WorkspaceSymbolParams::query
std::string query
A query string to filter symbols by.
Definition: Protocol.h:1118
clang::clangd::DocumentSymbol::deprecated
bool deprecated
Indicates if this symbol is deprecated.
Definition: Protocol.h:1046
clang::clangd::ClientCapabilities::TheiaSemanticHighlighting
bool TheiaSemanticHighlighting
Client supports Theia semantic highlighting extension.
Definition: Protocol.h:475
clang::clangd::CodeActionParams
Definition: Protocol.h:943
clang::clangd::operator<
bool operator<(const Ref &L, const Ref &R)
Definition: Ref.h:95
clang::clangd::TextDocumentPositionParams
Definition: Protocol.h:1139
clang::clangd::InitializeParams::rootPath
llvm::Optional< std::string > rootPath
The rootPath of the workspace.
Definition: Protocol.h:560
clang::clangd::InitializationOptions
Clangd extension: parameters configurable at initialize time.
Definition: Protocol.h:532
clang::clangd::DidCloseTextDocumentParams::textDocument
TextDocumentIdentifier textDocument
The document that was closed.
Definition: Protocol.h:697
clang::clangd::CallHierarchyItem
Represents programming constructs like functions or constructors in the context of call hierarchy.
Definition: Protocol.h:1477
clang::clangd::Diagnostic::code
std::string code
The diagnostic's code. Can be omitted.
Definition: Protocol.h:864
clang::clangd::SymbolKind::EnumMember
@ EnumMember
clang::clangd::RenameParams::textDocument
TextDocumentIdentifier textDocument
The document that was opened.
Definition: Protocol.h:1346
clang::clangd::DocumentOnTypeFormattingParams
Definition: Protocol.h:796
clang::clangd::TextEdit
Definition: Protocol.h:231
clang::clangd::SignatureHelp::activeParameter
int activeParameter
The active parameter of the active signature.
Definition: Protocol.h:1333
clang::clangd::OffsetEncoding::UnsupportedEncoding
@ UnsupportedEncoding
clang::clangd::SymbolInformation::containerName
std::string containerName
The name of the symbol containing this symbol.
Definition: Protocol.h:1077
clang::clangd::RenameParams
Definition: Protocol.h:1344
clang::clangd::ApplyWorkspaceEditParams
Definition: Protocol.h:1127
clang::clangd::CompletionParams::limit
llvm::Optional< int > limit
Max results to return, overriding global default.
Definition: Protocol.h:1174
clang::clangd::TraceLevel::Off
@ Off
clang::clangd::SymbolKind::Namespace
@ Namespace
clang::clangd::operator==
bool operator==(const Inclusion &LHS, const Inclusion &RHS)
Definition: Headers.cpp:362
clang::clangd::ClientCapabilities::ImplicitProgressCreation
bool ImplicitProgressCreation
The client supports implicit $/progress work-done progress streams, without a preceding window/workDo...
Definition: Protocol.h:496
clang::clangd::DidOpenTextDocumentParams
Definition: Protocol.h:688
clang::clangd::TraceLevel::Verbose
@ Verbose
clang::clangd::DocumentSymbol::name
std::string name
The name of this symbol.
Definition: Protocol.h:1037
clang::clangd::CompletionItemKind::Missing
@ Missing
clang::clangd::DocumentHighlightKind::Read
@ Read
clang::clangd::CompletionParams::context
CompletionContext context
Definition: Protocol.h:1170
clang::clangd::ClientCapabilities::SemanticTokens
bool SemanticTokens
Client advertises support for the semanticTokens feature.
Definition: Protocol.h:470
clang::clangd::ReferenceParams
Definition: Protocol.h:1636
clang::clangd::InlayHintKind
InlayHintKind
Inlay hint kinds.
Definition: Protocol.h:1560
URI.h
clang::clangd::SymbolKind::File
@ File
clang::clangd::ASTNode::arcana
std::string arcana
A one-line dump of detailed information about the node.
Definition: Protocol.h:1855
clang::clangd::ParameterInformation
A single parameter of a particular signature.
Definition: Protocol.h:1291
clang::clangd::DocumentLinkParams::textDocument
TextDocumentIdentifier textDocument
The document to provide document links for.
Definition: Protocol.h:1751
clang::clangd::LSPError::ID
static char ID
Definition: Protocol.h:67
clang::clangd::InlayHintsParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1549
clang::clangd::TextEdit::newText
std::string newText
The string to be inserted.
Definition: Protocol.h:238
Field
const FieldDecl * Field
Definition: MemberwiseConstructor.cpp:260
ns1::ns2::B
@ B
Definition: CategoricalFeature.h:3
clang::clangd::SymbolInformation::location
Location location
The location of this symbol.
Definition: Protocol.h:1074
Out
CompiledFragmentImpl & Out
Definition: ConfigCompile.cpp:99
clang::clangd::ClientCapabilities::CancelsStaleRequests
bool CancelsStaleRequests
Whether the client claims to cancel stale requests.
Definition: Protocol.h:500
clang::clangd::SemanticTokensDeltaParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1696
clang::clangd::elog
void elog(const char *Fmt, Ts &&... Vals)
Definition: Logger.h:61
clang::clangd::MarkupContent
Definition: Protocol.h:1178
clang::clangd::ASTNode::children
std::vector< ASTNode > children
Nodes nested within this one, such as the operands of a BinaryOperator.
Definition: Protocol.h:1860
clang::clangd::SymbolID
Definition: SymbolID.h:32
clang::clangd::InitializeParams::rootUri
llvm::Optional< URIForFile > rootUri
The rootUri of the workspace.
Definition: Protocol.h:565
clang::clangd::DiagnosticRelatedInformation
Represents a related message and source code location for a diagnostic.
Definition: Protocol.h:826
clang::clangd::TypeHierarchyItem::data
ResolveParams data
A data entry field that is preserved between a type hierarchy prepare and supertypes or subtypes requ...
Definition: Protocol.h:1434
clang::clangd::ResolveTypeHierarchyItemParams::direction
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
Definition: Protocol.h:1464
clang::clangd::CompletionContext
Definition: Protocol.h:1160
clang::clangd::TextDocumentContentChangeEvent::text
std::string text
The new text of the range/document.
Definition: Protocol.h:717
clang::clangd::ASTParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1829
Tag
HTMLTag Tag
Definition: HTMLGenerator.cpp:91
clang::clangd::TypeHierarchyPrepareParams::resolve
int resolve
The hierarchy levels to resolve.
Definition: Protocol.h:1394
clang::clangd::CallHierarchyOutgoingCallsParams
The parameter of a callHierarchy/outgoingCalls request.
Definition: Protocol.h:1528
clang::clangd::CompletionItemKind::TypeParameter
@ TypeParameter
clang::clangd::ASTNode
Simplified description of a clang AST node.
Definition: Protocol.h:1840
clang::clangd::CompletionItemKindMin
constexpr auto CompletionItemKindMin
Definition: Protocol.h:324
clang::clangd::ResolveTypeHierarchyItemParams::item
TypeHierarchyItem item
The item to resolve.
Definition: Protocol.h:1458
clang::clangd::ApplyWorkspaceEditParams::edit
WorkspaceEdit edit
Definition: Protocol.h:1128
clang::clangd::TextEdit::range
Range range
The range of the text document to be manipulated.
Definition: Protocol.h:234
clang::clangd::Context
A context is an immutable container for per-request data that must be propagated through layers that ...
Definition: Context.h:69
clang::clangd::ShowMessageParams
The show message notification is sent from a server to a client to ask the client to display a partic...
Definition: Protocol.h:680
clang::clangd::CodeAction::INFO_KIND
const static llvm::StringLiteral INFO_KIND
Definition: Protocol.h:1010
clang::clangd::SymbolKind::Constructor
@ Constructor
clang::clangd::CodeActionContext
Definition: Protocol.h:926
clang::clangd::URI
A URI describes the location of a source file.
Definition: URI.h:28
K
Kind K
Definition: Rename.cpp:454
clang::clangd::SymbolInformation::kind
SymbolKind kind
The kind of this symbol.
Definition: Protocol.h:1071
clang::clangd::ClientCapabilities::HasSignatureHelp
bool HasSignatureHelp
Client supports signature help.
Definition: Protocol.h:438
clang::clangd::VersionedTextDocumentIdentifier
Definition: Protocol.h:139
clang::clangd::WorkDoneProgressBegin::title
std::string title
Mandatory title of the progress operation.
Definition: Protocol.h:606
clang::clangd::CodeActionParams::range
Range range
The range for which the command was invoked.
Definition: Protocol.h:948
clang::clangd::SymbolKind::String
@ String
clang::clangd::DiagnosticRelatedInformation::message
std::string message
The message of this related diagnostic information.
Definition: Protocol.h:830
Value
static constexpr bool Value
Definition: SuspiciousCallArgumentCheck.cpp:72
clang::clangd::CallHierarchyItem::name
std::string name
The name of this item.
Definition: Protocol.h:1479
clang::clangd::RenameParams::newName
std::string newName
The new name of the symbol.
Definition: Protocol.h:1352
clang::clangd::SymbolKind::Property
@ Property
clang::clangd::SymbolKind::Struct
@ Struct
Path
std::vector< HeaderHandle > Path
Definition: PreprocessorTracker.cpp:525
clang::clangd::InlayHintsParams
A parameter literal used in inlay hint requests.
Definition: Protocol.h:1547
clang::clangd::adjustKindToCapability
SymbolKind adjustKindToCapability(SymbolKind Kind, SymbolKindBitset &SupportedSymbolKinds)
Definition: Protocol.cpp:232
clang::clangd::TextDocumentContentChangeEvent::rangeLength
llvm::Optional< int > rangeLength
The length of the range that got replaced.
Definition: Protocol.h:714
clang::clangd::CallHierarchyItem::kind
SymbolKind kind
The kind of this item.
Definition: Protocol.h:1482
clang::clangd::CodeAction::QUICKFIX_KIND
const static llvm::StringLiteral QUICKFIX_KIND
Definition: Protocol.h:1008
clang::clangd::ResolveTypeHierarchyItemParams
Parameters for the typeHierarchy/resolve request.
Definition: Protocol.h:1456
clang::clangd::InlayHintKind::Parameter
@ Parameter
An inlay hint that is for a parameter.
clang::clangd::WorkDoneProgressCreateParams
Definition: Protocol.h:583