16#include <llvm/ADT/StringRef.h>
17#include <llvm/ADT/StringSwitch.h>
18#include <llvm/Support/ErrorHandling.h>
19#include <llvm/Support/JSON.h>
20#include <llvm/Support/Path.h>
21#include <llvm/Support/raw_ostream.h>
29 T &Out, llvm::json::Path P) {
30 auto *O =
Params.getAsObject();
32 auto *
V = O->get(
Prop);
34 if (!
V ||
V->getAsNull())
44 assert(llvm::sys::path::is_absolute(
AbsPath) &&
"the path is relative");
47 elog(
"URIForFile: failed to resolve path {0} with TU path {1}: "
48 "{2}.\nUsing unresolved path.",
64 if (
auto S = E.getAsString()) {
68 P.report(
"failed to parse URI");
71 if (
Parsed->scheme() !=
"file" &&
Parsed->scheme() !=
"test") {
72 P.report(
"clangd only supports 'file' URI scheme for workspace files");
78 P.report(
"unresolvable URI");
95 return llvm::json::Object{{
"uri", R.
uri}};
100 llvm::json::ObjectMapper O(
Params, P);
101 return O && O.map(
"uri", R.
uri);
112 llvm::json::ObjectMapper O(
Params, P);
118 llvm::json::Path P) {
119 llvm::json::ObjectMapper O(
Params, P);
120 return O && O.map(
"line", R.
line) && O.map(
"character", R.
character);
124 return llvm::json::Object{
135 llvm::json::ObjectMapper O(
Params, P);
136 return O && O.map(
"start", R.
start) && O.map(
"end", R.
end);
140 return llvm::json::Object{
151 return llvm::json::Object{
158 llvm::json::Path P) {
159 llvm::json::ObjectMapper O(
Params, P);
160 return O && O.map(
"uri", R.
uri) && O.map(
"range", R.
range);
164 return OS <<
L.range <<
'@' <<
L.uri;
168 llvm::json::Object
Result{
179 return OS <<
L.range <<
'@' <<
L.uri <<
" (container: " <<
L.containerName
184 llvm::json::Path P) {
185 llvm::json::ObjectMapper O(
Params, P);
186 return O && O.map(
"uri", R.
uri) && O.map(
"languageId", R.
languageId) &&
187 O.map(
"version", R.
version) && O.map(
"text", R.
text);
191 llvm::json::Path P) {
192 llvm::json::ObjectMapper O(
Params, P);
193 return O && O.map(
"range", R.
range) && O.map(
"newText", R.
newText) &&
198 llvm::json::Object
Result{
208 llvm::json::Path P) {
209 llvm::json::ObjectMapper O(
Params, P);
210 return O && O.map(
"label", R.
label) &&
215 llvm::json::Object
Result{{
"label",
CA.label}};
216 if (
CA.needsConfirmation)
217 Result[
"needsConfirmation"] = *
CA.needsConfirmation;
218 if (!
CA.description.empty())
219 Result[
"description"] =
CA.description;
224 llvm::json::Path P) {
225 llvm::json::ObjectMapper O(
Params, P);
235 OS <<
TE.range <<
" => \"";
236 llvm::printEscapedString(
TE.newText,
OS);
241 if (
auto S = E.getAsString()) {
246 if (*
S ==
"messages") {
250 if (*
S ==
"verbose") {
259 if (
auto T = E.getAsInteger()) {
270 llvm::json::Path P) {
271 if (
auto *
A = E.getAsArray()) {
272 for (
size_t I = 0;
I <
A->size(); ++
I) {
284 auto KindVal =
static_cast<size_t>(Kind);
301 llvm::json::Path P) {
302 const llvm::json::Object *O =
Params.getAsObject();
304 P.report(
"expected object");
307 if (
auto *TextDocument = O->getObject(
"textDocument")) {
309 TextDocument->getObject(
"semanticHighlightingCapabilities")) {
314 if (
auto *InactiveRegions =
315 TextDocument->getObject(
"inactiveRegionsCapabilities")) {
317 InactiveRegions->getBoolean(
"inactiveRegions")) {
321 if (TextDocument->getObject(
"semanticTokens"))
323 if (
auto *Diagnostics = TextDocument->getObject(
"publishDiagnostics")) {
326 if (
auto CodeActions = Diagnostics->getBoolean(
"codeActionsInline"))
328 if (
auto RelatedInfo = Diagnostics->getBoolean(
"relatedInformation"))
331 if (
auto *
References = TextDocument->getObject(
"references"))
334 if (
auto *
Completion = TextDocument->getObject(
"completion")) {
339 Item->getArray(
"documentationFormat")) {
350 P.field(
"textDocument")
352 .field(
"completionItemKind")
360 if (
auto *
CodeAction = TextDocument->getObject(
"codeAction")) {
361 if (
CodeAction->getObject(
"codeActionLiteralSupport"))
364 if (
auto *
DocumentSymbol = TextDocument->getObject(
"documentSymbol")) {
369 if (
auto *
Hover = TextDocument->getObject(
"hover")) {
377 if (
auto *
Help = TextDocument->getObject(
"signatureHelp")) {
379 if (
auto *
Info =
Help->getObject(
"signatureInformation")) {
380 if (
auto *
Parameter =
Info->getObject(
"parameterInformation")) {
385 Info->getArray(
"documentationFormat")) {
393 if (
auto *
Folding = TextDocument->getObject(
"foldingRange")) {
397 if (
auto *
Rename = TextDocument->getObject(
"rename")) {
402 if (
auto *
Workspace = O->getObject(
"workspace")) {
417 if (
auto WorkspaceConfiguration =
Workspace->getBoolean(
"configuration")) {
426 if (
auto DocumentChanges =
WorkspaceEdit->getBoolean(
"documentChanges"))
433 if (
auto *
Window = O->getObject(
"window")) {
434 if (
auto WorkDoneProgress =
Window->getBoolean(
"workDoneProgress"))
436 if (
auto Implicit =
Window->getBoolean(
"implicitWorkDoneProgressCreate"))
439 if (
auto *
General = O->getObject(
"general")) {
448 P.field(
"offsetEncoding")))
455 llvm::json::Path P) {
456 llvm::json::ObjectMapper O(
Params, P);
465 if (
auto *
RawCaps =
Params.getAsObject()->getObject(
"capabilities"))
467 O.map(
"trace", R.
trace);
473 return llvm::json::Object{{
"token", P.
token}};
477 llvm::json::Object
Result{
482 Result[
"cancellable"] =
true;
491 llvm::json::Object
Result{{
"kind",
"report"}};
503 llvm::json::Object
Result{{
"kind",
"end"}};
511 return static_cast<int64_t>(R);
515 return llvm::json::Object{{
"type", R.
type}, {
"message", R.
message}};
519 llvm::json::Path P) {
520 llvm::json::ObjectMapper O(
Params, P);
525 llvm::json::Path P) {
526 llvm::json::ObjectMapper O(
Params, P);
531 llvm::json::Path P) {
532 llvm::json::ObjectMapper O(
Params, P);
537 llvm::json::Path P) {
538 llvm::json::ObjectMapper O(
Params, P);
546 llvm::json::Path P) {
547 if (
auto T = E.getAsInteger()) {
558 llvm::json::Path P) {
559 llvm::json::ObjectMapper O(
Params, P);
560 return O && O.map(
"uri", R.
uri) && O.map(
"type", R.
type);
564 llvm::json::Path P) {
565 llvm::json::ObjectMapper O(
Params, P);
566 return O && O.map(
"changes", R.
changes);
571 llvm::json::ObjectMapper O(
Params, P);
572 return O && O.map(
"range", R.
range) && O.map(
"rangeLength", R.
rangeLength) &&
573 O.map(
"text", R.
text);
577 llvm::json::Path P) {
578 llvm::json::ObjectMapper O(
Params, P);
584 llvm::json::ObjectMapper O(
Params, P);
586 O.map(
"position", R.
position) && O.map(
"ch", R.
ch);
590 llvm::json::Path P) {
591 llvm::json::ObjectMapper O(
Params, P);
596 llvm::json::Path P) {
597 llvm::json::ObjectMapper O(
Params, P);
602 return llvm::json::Object{
603 {
"location",
DRI.location},
604 {
"message",
DRI.message},
611 return llvm::json::Object{{
"href", D.
href}};
615 llvm::json::Object
Diag{
633 Diag[
"data"] = llvm::json::Object(D.
data);
635 Diag[
"tags"] = llvm::json::Array{D.
tags};
641 llvm::json::Path P) {
642 llvm::json::ObjectMapper O(
Params, P);
645 if (
auto *
Data =
Params.getAsObject()->getObject(
"data"))
647 return O.map(
"range", R.
range) && O.map(
"message", R.
message) &&
655 llvm::json::Object
Result{
657 {
"diagnostics",
PDP.diagnostics},
665 llvm::json::Path P) {
666 llvm::json::ObjectMapper O(
Params, P);
669 O.map(
"only", R.
only);
696 llvm::json::Path P) {
697 llvm::json::ObjectMapper O(
Params, P);
703 llvm::json::Path P) {
704 llvm::json::ObjectMapper O(
Params, P);
705 return O && O.map(
"changes", R.
changes) &&
711 llvm::json::Path P) {
712 llvm::json::ObjectMapper O(
Params, P);
713 if (!O || !O.map(
"command", R.
command))
716 const auto *Args =
Params.getAsObject()->get(
"arguments");
719 const auto *
ArgsArray = Args->getAsArray();
721 P.field(
"arguments").report(
"expected array");
725 P.field(
"arguments").report(
"Command should have 0 or 1 argument");
735 llvm::json::Object O{
737 {
"kind",
static_cast<int>(P.
kind)},
742 O[
"score"] = *P.
score;
748 O <<
SI.containerName <<
"::" <<
SI.name <<
" - " <<
toJSON(
SI);
753 llvm::json::Path P) {
754 llvm::json::ObjectMapper O(
Params, P);
755 return O && O.map(
"query", R.
query) &&
760 auto Cmd = llvm::json::Object{{
"title",
C.title}, {
"command",
C.command}};
761 if (!
C.argument.getAsNull())
762 Cmd[
"arguments"] = llvm::json::Array{
C.argument};
775 CodeAction[
"diagnostics"] = llvm::json::Array(*
CA.diagnostics);
786 return O <<
S.name <<
" - " <<
toJSON(
S);
790 llvm::json::Object
Result{{
"name",
S.name},
791 {
"kind",
static_cast<int>(
S.kind)},
793 {
"selectionRange",
S.selectionRange}};
795 if (!
S.detail.empty())
797 if (!
S.children.empty())
798 Result[
"children"] =
S.children;
800 Result[
"deprecated"] =
true;
806 llvm::json::Object
Result;
813 if (
WE.documentChanges)
814 Result[
"documentChanges"] = *
WE.documentChanges;
815 if (!
WE.changeAnnotations.empty()) {
825 llvm::json::Path P) {
826 llvm::json::ObjectMapper O(
Params, P);
827 return O && O.map(
"file",
A.file) && O.map(
"selection",
A.selection) &&
828 O.map(
"tweakID",
A.tweakID);
832 return llvm::json::Object{
833 {
"tweakID",
A.tweakID}, {
"selection",
A.selection}, {
"file",
A.file}};
837 return llvm::json::Object{{
"edit",
Params.edit}};
841 llvm::json::Path P) {
842 llvm::json::ObjectMapper O(
Response, P);
843 return O && O.map(
"applied", R.
applied) &&
848 llvm::json::Path P) {
849 llvm::json::ObjectMapper O(
Params, P);
855 llvm::json::Path P) {
856 llvm::json::ObjectMapper O(
Params, P);
866 llvm::json::Path P) {
875static llvm::StringRef toTextKind(
MarkupKind Kind) {
885static MarkupKind fromTextKind(llvm::StringRef Kind) {
886 if (Kind ==
"plaintext")
888 if (Kind ==
"markdown")
894 auto Str =
V.getAsString();
896 P.report(
"expected string");
899 if (*
Str ==
"plaintext")
901 else if (*
Str ==
"markdown")
904 P.report(
"unknown markup kind");
911 return OS << toTextKind(
K);
915 if (
MC.value.empty())
918 return llvm::json::Object{
919 {
"kind", toTextKind(
MC.kind)},
925 llvm::json::Path P) {
926 llvm::json::ObjectMapper O(
Params, P);
930 return O.mapOptional(
"value", R.
value);
943 llvm::json::Path P) {
944 if (
auto T = E.getAsInteger()) {
957 auto KindVal =
static_cast<size_t>(Kind);
977 llvm::json::Path P) {
978 if (
auto *
A = E.getAsArray()) {
979 for (
size_t I = 0;
I <
A->size(); ++
I) {
990 assert(!
CI.label.empty() &&
"completion item label is required");
991 llvm::json::Object
Result{{
"label",
CI.label}};
993 Result[
"kind"] =
static_cast<int>(
CI.kind);
994 if (!
CI.detail.empty())
996 if (
CI.documentation)
997 Result[
"documentation"] =
CI.documentation;
998 if (!
CI.sortText.empty())
1000 if (!
CI.filterText.empty())
1001 Result[
"filterText"] =
CI.filterText;
1002 if (!
CI.insertText.empty())
1003 Result[
"insertText"] =
CI.insertText;
1005 Result[
"insertTextFormat"] =
static_cast<int>(
CI.insertTextFormat);
1008 if (!
CI.additionalTextEdits.empty())
1009 Result[
"additionalTextEdits"] = llvm::json::Array(
CI.additionalTextEdits);
1011 Result[
"deprecated"] =
CI.deprecated;
1018 llvm::json::Path P) {
1019 llvm::json::ObjectMapper O(
Params, P);
1021 if (!O.mapOptional(
"kind", Kind))
1025 if (!O.mapOptional(
"insertTextFormat", Kind))
1029 && O.map(
"label", R.
label)
1030 && O.mapOptional(
"detail", R.
detail)
1032 && O.mapOptional(
"sortText", R.
sortText)
1035 && O.mapOptional(
"textEdit", R.
textEdit)
1037 && O.mapOptional(
"data", R.
data)
1042 O <<
I.label <<
" - " <<
toJSON(
I);
1047 return (
L.sortText.empty() ?
L.label :
L.sortText) <
1052 return llvm::json::Object{
1053 {
"isIncomplete",
L.isIncomplete},
1054 {
"items", llvm::json::Array(
L.items)},
1059 assert((
PI.labelOffsets || !
PI.labelString.empty()) &&
1060 "parameter information label is required");
1061 llvm::json::Object
Result;
1062 if (
PI.labelOffsets)
1064 llvm::json::Array({
PI.labelOffsets->first,
PI.labelOffsets->second});
1067 if (!
PI.documentation.empty())
1068 Result[
"documentation"] =
PI.documentation;
1073 assert(!
SI.label.empty() &&
"signature information label is required");
1074 llvm::json::Object
Result{
1075 {
"label",
SI.label},
1076 {
"parameters", llvm::json::Array(
SI.parameters)},
1078 if (!
SI.documentation.value.empty())
1079 Result[
"documentation"] =
SI.documentation;
1085 O <<
I.label <<
" - " <<
toJSON(
I);
1091 "Unexpected negative value for number of active signatures.");
1093 "Unexpected negative value for active parameter index");
1094 return llvm::json::Object{
1095 {
"activeSignature",
SH.activeSignature},
1096 {
"activeParameter",
SH.activeParameter},
1097 {
"signatures", llvm::json::Array(
SH.signatures)},
1102 llvm::json::Path P) {
1103 llvm::json::ObjectMapper O(
Params, P);
1109 return llvm::json::Object{
1111 {
"kind",
static_cast<int>(
DH.kind)},
1116 return llvm::json::Object{
1123static llvm::json::Value encodeTokens(llvm::ArrayRef<SemanticToken>
Toks) {
1124 llvm::json::Array
Result;
1126 for (
const auto &Tok :
Toks) {
1127 Result.push_back(Tok.deltaLine);
1128 Result.push_back(Tok.deltaStart);
1129 Result.push_back(Tok.length);
1130 Result.push_back(Tok.tokenType);
1131 Result.push_back(Tok.tokenModifiers);
1138 return std::tie(
L.deltaLine,
L.deltaStart,
L.length,
L.tokenType,
1145 return llvm::json::Object{{
"resultId",
Tokens.resultId},
1146 {
"data", encodeTokens(
Tokens.tokens)}};
1150 return llvm::json::Object{
1153 {
"data", encodeTokens(
Edit.tokens)}};
1157 llvm::json::Object
Result{{
"resultId",
TE.resultId}};
1161 Result[
"data"] = encodeTokens(*
TE.tokens);
1166 llvm::json::Path P) {
1167 llvm::json::ObjectMapper O(
Params, P);
1172 llvm::json::Path P) {
1173 llvm::json::ObjectMapper O(
Params, P);
1179 return llvm::json::Object{
1196 llvm::json::ObjectMapper O(
Params, P);
1197 return O && O.map(
"settings",
CCP.settings);
1201 llvm::json::Path P) {
1202 llvm::json::ObjectMapper O(
Params, P);
1203 return O && O.map(
"workingDirectory",
CDbUpdate.workingDirectory) &&
1204 O.map(
"compilationCommand",
CDbUpdate.compilationCommand);
1208 llvm::json::Path P) {
1209 llvm::json::ObjectMapper O(
Params, P);
1213 S.compilationDatabaseChanges, P);
1217 llvm::json::Path P) {
1218 llvm::json::ObjectMapper O(
Params, P);
1223 O.map(
"compilationDatabasePath",
Opts.compilationDatabasePath) &&
1229 llvm::json::Path P) {
1230 auto T = E.getAsInteger();
1241 llvm::json::Path P) {
1242 llvm::json::ObjectMapper O(
Params, P);
1251 return O <<
I.name <<
" - " <<
toJSON(
I);
1255 llvm::json::Object
Result{};
1262 llvm::json::ObjectMapper O(
Params, P);
1267 llvm::json::Object
Result{
1268 {
"name",
I.name}, {
"kind",
static_cast<int>(
I.kind)},
1269 {
"range",
I.range}, {
"selectionRange",
I.selectionRange},
1270 {
"uri",
I.uri}, {
"data",
I.data},
1279 llvm::json::Path P) {
1280 llvm::json::ObjectMapper O(
Params, P);
1283 return O && O.map(
"name",
I.name) && O.map(
"kind",
I.kind) &&
1284 O.map(
"uri",
I.uri) && O.map(
"range",
I.range) &&
1285 O.map(
"selectionRange",
I.selectionRange) &&
1295 llvm::json::ObjectMapper O(
Params, P);
1296 return O && O.map(
"item", R.
item) &&
1302 llvm::json::Path P) {
1303 llvm::json::ObjectMapper O(
Params, P);
1308 llvm::json::Path P) {
1310 llvm::json::ObjectMapper O(
Params, P);
1315 return llvm::json::Value{
static_cast<int>(
Tag)};
1319 llvm::json::Object
Result{{
"name",
I.name},
1320 {
"kind",
static_cast<int>(
I.kind)},
1322 {
"selectionRange",
I.selectionRange},
1324 if (!
I.tags.empty())
1326 if (!
I.detail.empty())
1328 if (!
I.data.empty())
1334 llvm::json::Path P) {
1335 llvm::json::ObjectMapper O(
Params, P);
1340 return O && O.map(
"name",
I.name) && O.map(
"kind",
I.kind) &&
1341 O.map(
"uri",
I.uri) && O.map(
"range",
I.range) &&
1342 O.map(
"selectionRange",
I.selectionRange) &&
1348 llvm::json::ObjectMapper O(
Params, P);
1349 return O.map(
"item",
C.item);
1353 return llvm::json::Object{{
"from",
C.from}, {
"fromRanges",
C.fromRanges}};
1358 llvm::json::ObjectMapper O(
Params, P);
1359 return O.map(
"item",
C.item);
1363 return llvm::json::Object{{
"to",
C.to}, {
"fromRanges",
C.fromRanges}};
1367 llvm::json::Path P) {
1368 llvm::json::ObjectMapper O(
Params, P);
1385 llvm::json::Object
Result{{
"position",
H.position},
1387 {
"paddingLeft",
H.paddingLeft},
1388 {
"paddingRight",
H.paddingRight}};
1391 Result[
"kind"] = std::move(
K);
1395 return std::tie(
A.position,
A.range,
A.kind,
A.label) ==
1396 std::tie(
B.position,
B.range,
B.kind,
B.label);
1399 return std::tie(
A.position,
A.range,
A.kind,
A.label) <
1400 std::tie(
B.position,
B.range,
B.kind,
B.label);
1411 return "designator";
1433 llvm::json::Path P) {
1434 auto Str =
V.getAsString();
1437 OE = llvm::StringSwitch<OffsetEncoding>(*
Str)
1445 return OS << toString(
Enc);
1449 llvm::json::Path P) {
1450 llvm::json::ObjectMapper O(
Params, P);
1451 return O && O.map(
"textDocument",
S.textDocument) &&
1452 O.map(
"positions",
S.positions);
1457 return llvm::json::Object{{
"range", Out.
range},
1460 return llvm::json::Object{{
"range", Out.
range}};
1464 llvm::json::Path P) {
1465 llvm::json::ObjectMapper O(
Params, P);
1470 return llvm::json::Object{
1477 llvm::json::Path P) {
1478 llvm::json::ObjectMapper O(
Params, P);
1487 llvm::json::Object
Result{
1488 {
"startLine",
Range.startLine},
1489 {
"endLine",
Range.endLine},
1491 if (
Range.startCharacter)
1493 if (
Range.endCharacter)
1495 if (!
Range.kind.empty())
1501 llvm::json::Path P) {
1502 llvm::json::ObjectMapper O(
Params, P);
1507 llvm::json::Object
Result{
1511 if (!
N.children.empty())
1512 Result[
"children"] =
N.children;
1513 if (!
N.detail.empty())
1515 if (!
N.arcana.empty())
1525 OS.indent(2 * Level) <<
N.role <<
": " <<
N.kind;
1526 if (!
N.detail.empty())
1527 OS <<
" - " <<
N.detail;
1537 llvm::json::Object R;
1539 R[
"scopeUri"] =
N.scopeUri;
1541 R[
"section"] =
N.section;
1546 return llvm::json::Object{{
"items",
N.items}};
static llvm::Expected< std::string > resolve(const URI &U, llvm::StringRef HintPath="")
static llvm::Expected< URI > parse(llvm::StringRef Uri)
static llvm::Expected< std::string > resolvePath(llvm::StringRef AbsPath, llvm::StringRef HintPath="")
Whether current platform treats paths case insensitively.
std::bitset< SymbolKindMax+1 > SymbolKindBitset
@ Created
The file got created.
@ Deleted
The file got deleted.
@ Info
An information message.
bool fromJSON(const llvm::json::Value &, URIForFile &, llvm::json::Path)
constexpr auto CompletionItemKindMin
std::bitset< CompletionItemKindMax+1 > CompletionItemKindBitset
void elog(const char *Fmt, Ts &&...Vals)
llvm::json::Value toJSON(const URIForFile &U)
Serialize/deserialize URIForFile to/from a string URI.
llvm::raw_ostream & operator<<(llvm::raw_ostream &, const Position &)
CompletionItemKind
The kind of a completion entry.
CompletionItemKind adjustKindToCapability(CompletionItemKind Kind, CompletionItemKindBitset &SupportedCompletionItemKinds)
bool operator==(const TextEdit &L, const TextEdit &R)
InlayHintKind
Inlay hint kinds.
constexpr auto SymbolKindMin
constexpr unsigned SemanticTokenEncodingSize
bool operator<(const CompletionItem &, const CompletionItem &)
TextDocumentIdentifier textDocument
The text document.
std::optional< Range > range
std::optional< std::string > failureReason
Represents an incoming call, e.g. a caller of a method or constructor.
The parameter of a callHierarchy/incomingCalls request.
The parameter of a callHierarchy/outgoingCalls request.
std::optional< bool > needsConfirmation
MarkupKind SignatureHelpDocumentationFormat
bool ChangeAnnotation
The client supports change annotations on text edits,.
bool WorkspaceConfiguration
bool RenamePrepareSupport
bool DocumentChanges
The client supports versioned document changes for WorkspaceEdit.
std::optional< SymbolKindBitset > WorkspaceSymbolKinds
bool TheiaSemanticHighlighting
std::optional< CompletionItemKindBitset > CompletionItemKinds
bool HierarchicalDocumentSymbol
MarkupKind CompletionDocumentationFormat
bool CancelsStaleRequests
bool OffsetsInSignatureHelp
std::optional< std::vector< OffsetEncoding > > offsetEncoding
Supported encodings for LSP character offsets. (clangd extension).
bool ImplicitProgressCreation
bool SemanticTokenRefreshSupport
bool DiagnosticRelatedInformation
MarkupKind HoverContentFormat
std::vector< Diagnostic > diagnostics
std::vector< std::string > only
Range range
The range for which the command was invoked.
TextDocumentIdentifier textDocument
The document in which the command was invoked.
CodeActionContext context
Context carrying additional information.
std::string title
A short, human-readable, title for this code action.
std::optional< std::string > kind
static const llvm::StringLiteral REFACTOR_KIND
std::optional< Command > command
static const llvm::StringLiteral INFO_KIND
std::optional< WorkspaceEdit > edit
The workspace edit this code action performs.
static const llvm::StringLiteral QUICKFIX_KIND
Structure to capture a description for an error code.
std::string href
An URI to open with more information about the diagnostic error.
std::string triggerCharacter
CompletionTriggerKind triggerKind
How the completion was triggered.
std::optional< TextEdit > textEdit
InsertTextFormat insertTextFormat
std::optional< MarkupContent > documentation
A human-readable string that represents a doc-comment.
std::vector< TextEdit > additionalTextEdits
Represents a collection of completion items to be presented in the editor.
CompletionContext context
std::optional< int > limit
std::optional< std::string > category
std::optional< std::vector< CodeAction > > codeActions
llvm::SmallVector< DiagnosticTag, 1 > tags
Additional metadata about the diagnostic.
Range range
The range at which the message applies.
std::string message
The diagnostic's message.
std::optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
std::optional< CodeDescription > codeDescription
An optional property to describe the error code.
std::string code
The diagnostic's code. Can be omitted.
std::optional< bool > wantDiagnostics
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
VersionedTextDocumentIdentifier textDocument
std::vector< FileEvent > changes
The actual file events.
TextDocumentIdentifier textDocument
The document that was closed.
TextDocumentItem textDocument
The document that was opened.
TextDocumentIdentifier textDocument
The document that was saved.
Parameters for the document link request.
TextDocumentIdentifier textDocument
The document to provide document links for.
Range range
The range this link applies to.
URIForFile target
The uri this link points to. If missing a resolve request is sent later.
TextDocumentIdentifier textDocument
llvm::json::Value argument
std::string command
The identifier of the actual command handler.
URIForFile uri
The file's URI.
FileChangeType type
The change type.
TextDocumentIdentifier textDocument
Stores information about a region of code that can be folded.
static const llvm::StringLiteral IMPORT_KIND
static const llvm::StringLiteral COMMENT_KIND
static const llvm::StringLiteral REGION_KIND
TextDocumentIdentifier TextDocument
The textdocument these inactive regions belong to.
std::vector< Range > InactiveRegions
The inactive regions that should be sent.
std::optional< std::string > rootPath
llvm::json::Object rawCapabilities
The same data as capabilities, but not parsed (to expose to modules).
InitializationOptions initializationOptions
User-provided initialization options.
std::optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool)
std::optional< URIForFile > rootUri
std::optional< int > processId
A parameter literal used in inlay hint requests.
TextDocumentIdentifier textDocument
The text document.
std::optional< Range > range
URIForFile uri
The text document's URI.
int line
Line position in a document (zero-based).
Position start
The range's start position.
Position end
The range's end position.
bool includeDeclaration
Include the declaration of the current symbol.
std::optional< std::string > containerName
std::string newName
The new name of the symbol.
Position position
The position at which this request was sent.
TextDocumentIdentifier textDocument
The document that was opened.
Parameters for the typeHierarchy/resolve request.
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
TypeHierarchyItem item
The item to resolve.
int resolve
The hierarchy levels to resolve. 0 indicates no level.
std::unique_ptr< SelectionRange > parent
unsigned length
the length of the token. A token cannot be multiline
unsigned tokenType
will be looked up in SemanticTokensLegend.tokenTypes
unsigned deltaLine
token line number, relative to the previous token
unsigned tokenModifiers
each set bit will be looked up in SemanticTokensLegend.tokenModifiers
std::string previousResultId
The previous result id.
TextDocumentIdentifier textDocument
The text document.
Describes a replacement of a contiguous range of semanticTokens.
Body of textDocument/semanticTokens/full request.
TextDocumentIdentifier textDocument
The text document.
A versioned set of tokens.
MessageType type
The message type.
std::string message
The actual message.
Represents the signature of a callable.
std::string text
The new text of the range/document.
std::optional< Range > range
The range of the document that changed.
std::optional< int > rangeLength
The length of the range that got replaced.
std::vector< TextEdit > edits
VersionedTextDocumentIdentifier textDocument
The text document to change.
URIForFile uri
The text document's URI.
std::string languageId
The text document's language identifier.
std::optional< int64_t > version
std::string text
The content of the opened text document.
URIForFile uri
The text document's URI.
Position position
The position inside the text document.
TextDocumentIdentifier textDocument
The text document.
ChangeAnnotationIdentifier annotationId
Used to resolve a client provided item back.
TypeHierarchyDirection direction
static URIForFile canonicalize(llvm::StringRef AbsPath, llvm::StringRef TUPath)
static llvm::Expected< URIForFile > fromURI(const URI &U, llvm::StringRef HintPath)
std::optional< std::int64_t > version
llvm::json::Value token
The token to be used to report progress.
Signals the end of progress reporting.
std::optional< std::string > message
Reporting progress is done using the following payload.
std::optional< bool > cancellable
std::optional< std::string > message
std::optional< unsigned > percentage
std::optional< std::map< std::string, std::vector< TextEdit > > > changes
Holds changes to existing resources.
std::map< std::string, ChangeAnnotation > changeAnnotations
std::optional< std::vector< TextDocumentEdit > > documentChanges
The parameters of a Workspace Symbol Request.
std::optional< int > limit