LLVM 23.0.0git
Protocol.h
Go to the documentation of this file.
1//===--- Protocol.h - Language Server Protocol Implementation ---*- C++ -*-===//
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 structs based on the LSP specification at
10// https://microsoft.github.io/language-server-protocol/specification
11//
12// This is not meant to be a complete implementation, new interfaces are added
13// when they're needed.
14//
15// Each struct has a toJSON and fromJSON function, that converts between
16// the struct and a JSON representation. (See JSON.h)
17//
18// Some structs also have operator<< serialization. This is for debugging and
19// tests, and is not generally machine-readable.
20//
21//===----------------------------------------------------------------------===//
22
23#ifndef LLVM_SUPPORT_LSP_PROTOCOL_H
24#define LLVM_SUPPORT_LSP_PROTOCOL_H
25
27#include "llvm/Support/JSON.h"
31#include <bitset>
32#include <optional>
33#include <string>
34#include <utility>
35
36// This file is using the LSP syntax for identifier names which is different
37// from the LLVM coding standard. To avoid the clang-tidy warnings, we're
38// disabling one check here.
39// NOLINTBEGIN(readability-identifier-naming)
40
41namespace llvm {
42namespace lsp {
43
44enum class ErrorCode {
45 // Defined by JSON RPC.
46 ParseError = -32700,
49 InvalidParams = -32602,
50 InternalError = -32603,
51
54
55 // Defined by the protocol.
58 RequestFailed = -32803,
59};
60
61/// Defines how the host (editor) should sync document changes to the language
62/// server.
64 /// Documents should not be synced at all.
65 None = 0,
66
67 /// Documents are synced by always sending the full content of the document.
68 Full = 1,
69
70 /// Documents are synced by sending the full content on open. After that only
71 /// incremental updates to the document are sent.
73};
74
75//===----------------------------------------------------------------------===//
76// LSPError
77//===----------------------------------------------------------------------===//
78
79/// This class models an LSP error as an llvm::Error.
80class LSPError : public llvm::ErrorInfo<LSPError> {
81public:
82 std::string message;
84 LLVM_ABI_FOR_TEST static char ID;
85
88
89 void log(raw_ostream &os) const override {
90 os << int(code) << ": " << message;
91 }
92 std::error_code convertToErrorCode() const override {
94 }
95};
96
97//===----------------------------------------------------------------------===//
98// URIForFile
99//===----------------------------------------------------------------------===//
100
101/// URI in "file" scheme for a file.
103public:
104 URIForFile() = default;
105
106 /// Try to build a URIForFile from the given URI string.
108
109 /// Try to build a URIForFile from the given absolute file path and optional
110 /// scheme.
112 fromFile(StringRef absoluteFilepath, StringRef scheme = "file");
113
114 /// Returns the absolute path to the file.
115 StringRef file() const { return filePath; }
116
117 /// Returns the original uri of the file.
118 StringRef uri() const { return uriStr; }
119
120 /// Return the scheme of the uri.
121 LLVM_ABI StringRef scheme() const;
122
123 explicit operator bool() const { return !filePath.empty(); }
124
125 friend bool operator==(const URIForFile &lhs, const URIForFile &rhs) {
126 return lhs.filePath == rhs.filePath;
127 }
128 friend bool operator!=(const URIForFile &lhs, const URIForFile &rhs) {
129 return !(lhs == rhs);
130 }
131 friend bool operator<(const URIForFile &lhs, const URIForFile &rhs) {
132 return lhs.filePath < rhs.filePath;
133 }
134
135 /// Register a supported URI scheme. The protocol supports `file` by default,
136 /// so this is only necessary for any additional schemes that a server wants
137 /// to support.
139
140private:
141 explicit URIForFile(std::string &&filePath, std::string &&uriStr)
142 : filePath(std::move(filePath)), uriStr(uriStr) {}
143
144 std::string filePath;
145 std::string uriStr;
146};
147
148/// Add support for JSON serialization.
149LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const URIForFile &value);
151 URIForFile &result, llvm::json::Path path);
152LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const URIForFile &value);
153
154//===----------------------------------------------------------------------===//
155// ClientCapabilities
156//===----------------------------------------------------------------------===//
157
159 /// Client supports hierarchical document symbols.
160 /// textDocument.documentSymbol.hierarchicalDocumentSymbolSupport
162
163 /// Client supports CodeAction return value for textDocument/codeAction.
164 /// textDocument.codeAction.codeActionLiteralSupport.
166
167 /// Client supports server-initiated progress via the
168 /// window/workDoneProgress/create method.
169 ///
170 /// window.workDoneProgress
171 bool workDoneProgress = false;
172};
173
174/// Add support for JSON serialization.
176 ClientCapabilities &result,
178
179//===----------------------------------------------------------------------===//
180// ClientInfo
181//===----------------------------------------------------------------------===//
182
184 /// The name of the client as defined by the client.
185 std::string name;
186
187 /// The client's version as defined by the client.
188 std::optional<std::string> version;
189};
190
191/// Add support for JSON serialization.
194
195//===----------------------------------------------------------------------===//
196// InitializeParams
197//===----------------------------------------------------------------------===//
198
199enum class TraceLevel {
200 Off = 0,
203};
204
205/// Add support for JSON serialization.
208
210 /// The capabilities provided by the client (editor or tool).
212
213 /// Information about the client.
214 std::optional<ClientInfo> clientInfo;
215
216 /// The initial trace setting. If omitted trace is disabled ('off').
217 std::optional<TraceLevel> trace;
218
219 /// The root URI of the workspace. Is null if no folder is open.
220 std::optional<std::string> rootUri;
221
222 /// The root path of the workspace. Is null if no folder is open.
223 /// This is deprecated, use rootUri instead, but kept for more compatibility.
224 std::optional<std::string> rootPath;
225};
226
227/// Add support for JSON serialization.
229 InitializeParams &result,
231
232//===----------------------------------------------------------------------===//
233// InitializedParams
234//===----------------------------------------------------------------------===//
235
236struct NoParams {};
238 return true;
239}
241
242//===----------------------------------------------------------------------===//
243// TextDocumentItem
244//===----------------------------------------------------------------------===//
245
247 /// The text document's URI.
249
250 /// The text document's language identifier.
251 std::string languageId;
252
253 /// The content of the opened text document.
254 std::string text;
255
256 /// The version number of this document.
257 int64_t version;
258};
259
260/// Add support for JSON serialization.
262 TextDocumentItem &result,
264
265//===----------------------------------------------------------------------===//
266// TextDocumentIdentifier
267//===----------------------------------------------------------------------===//
268
270 /// The text document's URI.
272};
273
274/// Add support for JSON serialization.
279
280//===----------------------------------------------------------------------===//
281// VersionedTextDocumentIdentifier
282//===----------------------------------------------------------------------===//
283
285 /// The text document's URI.
287 /// The version number of this document.
288 int64_t version;
289};
290
291/// Add support for JSON serialization.
297
298//===----------------------------------------------------------------------===//
299// Position
300//===----------------------------------------------------------------------===//
301
302struct Position {
303 Position(int line = 0, int character = 0)
305
306 /// Construct a position from the given source location.
308 std::pair<unsigned, unsigned> lineAndCol = mgr.getLineAndColumn(loc);
309 line = lineAndCol.first - 1;
310 character = lineAndCol.second - 1;
311 }
312
313 /// Line position in a document (zero-based).
314 int line = 0;
315
316 /// Character offset on a line in a document (zero-based).
317 int character = 0;
318
319 friend bool operator==(const Position &lhs, const Position &rhs) {
320 return std::tie(lhs.line, lhs.character) ==
321 std::tie(rhs.line, rhs.character);
322 }
323 friend bool operator!=(const Position &lhs, const Position &rhs) {
324 return !(lhs == rhs);
325 }
326 friend bool operator<(const Position &lhs, const Position &rhs) {
327 return std::tie(lhs.line, lhs.character) <
328 std::tie(rhs.line, rhs.character);
329 }
330 friend bool operator<=(const Position &lhs, const Position &rhs) {
331 return std::tie(lhs.line, lhs.character) <=
332 std::tie(rhs.line, rhs.character);
333 }
334
335 /// Convert this position into a source location in the main file of the given
336 /// source manager.
338 return mgr.FindLocForLineAndColumn(mgr.getMainFileID(), line + 1,
339 character + 1);
340 }
341};
342
343/// Add support for JSON serialization.
345 Position &result, llvm::json::Path path);
346LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Position &value);
347LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const Position &value);
348
349//===----------------------------------------------------------------------===//
350// Range
351//===----------------------------------------------------------------------===//
352
353struct Range {
354 Range() = default;
356 Range(Position loc) : Range(loc, loc) {}
357
358 /// Construct a range from the given source range.
360 : Range(Position(mgr, range.Start), Position(mgr, range.End)) {}
361
362 /// The range's start position.
364
365 /// The range's end position.
367
368 friend bool operator==(const Range &lhs, const Range &rhs) {
369 return std::tie(lhs.start, lhs.end) == std::tie(rhs.start, rhs.end);
370 }
371 friend bool operator!=(const Range &lhs, const Range &rhs) {
372 return !(lhs == rhs);
373 }
374 friend bool operator<(const Range &lhs, const Range &rhs) {
375 return std::tie(lhs.start, lhs.end) < std::tie(rhs.start, rhs.end);
376 }
377
378 bool contains(Position pos) const { return start <= pos && pos < end; }
379 bool contains(Range range) const {
380 return start <= range.start && range.end <= end;
381 }
382
383 /// Convert this range into a source range in the main file of the given
384 /// source manager.
386 SMLoc startLoc = start.getAsSMLoc(mgr);
387 SMLoc endLoc = end.getAsSMLoc(mgr);
388 // Check that the start and end locations are valid.
389 if (!startLoc.isValid() || !endLoc.isValid() ||
390 startLoc.getPointer() > endLoc.getPointer())
391 return SMRange();
392 return SMRange(startLoc, endLoc);
393 }
394};
395
396/// Add support for JSON serialization.
397LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value, Range &result,
401
402//===----------------------------------------------------------------------===//
403// Location
404//===----------------------------------------------------------------------===//
405
406struct Location {
407 Location() = default;
409
410 /// Construct a Location from the given source range.
413
414 /// The text document's URI.
417
418 friend bool operator==(const Location &lhs, const Location &rhs) {
419 return lhs.uri == rhs.uri && lhs.range == rhs.range;
420 }
421
422 friend bool operator!=(const Location &lhs, const Location &rhs) {
423 return !(lhs == rhs);
424 }
425
426 friend bool operator<(const Location &lhs, const Location &rhs) {
427 return std::tie(lhs.uri, lhs.range) < std::tie(rhs.uri, rhs.range);
428 }
429};
430
431/// Add support for JSON serialization.
433 Location &result, llvm::json::Path path);
434LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Location &value);
435LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const Location &value);
436
437//===----------------------------------------------------------------------===//
438// TextDocumentPositionParams
439//===----------------------------------------------------------------------===//
440
442 /// The text document.
444
445 /// The position inside the text document.
447};
448
449/// Add support for JSON serialization.
453
454//===----------------------------------------------------------------------===//
455// ReferenceParams
456//===----------------------------------------------------------------------===//
457
459 /// Include the declaration of the current symbol.
460 bool includeDeclaration = false;
461};
462
463/// Add support for JSON serialization.
465 ReferenceContext &result,
467
471
472/// Add support for JSON serialization.
475
476//===----------------------------------------------------------------------===//
477// DidOpenTextDocumentParams
478//===----------------------------------------------------------------------===//
479
481 /// The document that was opened.
483};
484
485/// Add support for JSON serialization.
489
490//===----------------------------------------------------------------------===//
491// DidCloseTextDocumentParams
492//===----------------------------------------------------------------------===//
493
495 /// The document that was closed.
497};
498
499/// Add support for JSON serialization.
503
504//===----------------------------------------------------------------------===//
505// DidSaveTextDocumentParams
506//===----------------------------------------------------------------------===//
507
509 /// The document that was saved.
511};
512
515
516//===----------------------------------------------------------------------===//
517// DidChangeTextDocumentParams
518//===----------------------------------------------------------------------===//
519
521 /// Try to apply this change to the given contents string.
522 LLVM_ABI LogicalResult applyTo(std::string &contents) const;
523 /// Try to apply a set of changes to the given contents string.
526 std::string &contents);
527
528 /// The range of the document that changed.
529 std::optional<Range> range;
530
531 /// The length of the range that got replaced.
532 std::optional<int> rangeLength;
533
534 /// The new text of the range/document.
535 std::string text;
536};
537
538/// Add support for JSON serialization.
542
544 /// The document that changed.
546
547 /// The actual content changes.
548 std::vector<TextDocumentContentChangeEvent> contentChanges;
549};
550
551/// Add support for JSON serialization.
555
556//===----------------------------------------------------------------------===//
557// MarkupContent
558//===----------------------------------------------------------------------===//
559
560/// Describes the content type that a client supports in various result literals
561/// like `Hover`.
566LLVM_ABI raw_ostream &operator<<(raw_ostream &os, MarkupKind kind);
567
572
573/// Add support for JSON serialization.
575
576//===----------------------------------------------------------------------===//
577// Hover
578//===----------------------------------------------------------------------===//
579
580struct Hover {
581 /// Construct a default hover with the given range that uses Markdown content.
583
584 /// The hover's content.
586
587 /// An optional range is a range inside a text document that is used to
588 /// visualize a hover, e.g. by changing the background color.
589 std::optional<Range> range;
590};
591
592/// Add support for JSON serialization.
594
595//===----------------------------------------------------------------------===//
596// SymbolKind
597//===----------------------------------------------------------------------===//
598
627
628//===----------------------------------------------------------------------===//
629// DocumentSymbol
630//===----------------------------------------------------------------------===//
631
632/// Represents programming constructs like variables, classes, interfaces etc.
633/// that appear in a document. Document symbols can be hierarchical and they
634/// have two ranges: one that encloses its definition and one that points to its
635/// most interesting range, e.g. the range of an identifier.
637 DocumentSymbol() = default;
643
644 /// The name of this symbol.
645 std::string name;
646
647 /// More detail for this symbol, e.g the signature of a function.
648 std::string detail;
649
650 /// The kind of this symbol.
652
653 /// The range enclosing this symbol not including leading/trailing whitespace
654 /// but everything else like comments. This information is typically used to
655 /// determine if the clients cursor is inside the symbol to reveal in the
656 /// symbol in the UI.
658
659 /// The range that should be selected and revealed when this symbol is being
660 /// picked, e.g the name of a function. Must be contained by the `range`.
662
663 /// Children of this symbol, e.g. properties of a class.
664 std::vector<DocumentSymbol> children;
665};
666
667/// Add support for JSON serialization.
669
670//===----------------------------------------------------------------------===//
671// DocumentSymbolParams
672//===----------------------------------------------------------------------===//
673
675 // The text document to find symbols in.
677};
678
679/// Add support for JSON serialization.
681 DocumentSymbolParams &result,
683
684//===----------------------------------------------------------------------===//
685// DiagnosticRelatedInformation
686//===----------------------------------------------------------------------===//
687
688/// Represents a related message and source code location for a diagnostic.
689/// This should be used to point to code locations that cause or related to a
690/// diagnostics, e.g. when duplicating a symbol in a scope.
695
696 /// The location of this related diagnostic information.
698 /// The message of this related diagnostic information.
699 std::string message;
700};
701
702/// Add support for JSON serialization.
708
709//===----------------------------------------------------------------------===//
710// Diagnostic
711//===----------------------------------------------------------------------===//
712
714 /// It is up to the client to interpret diagnostics as error, warning, info or
715 /// hint.
717 Error = 1,
721};
722
723enum class DiagnosticTag {
726};
727
728/// Add support for JSON serialization.
732
734 /// The source range where the message applies.
736
737 /// The diagnostic's severity. Can be omitted. If omitted it is up to the
738 /// client to interpret diagnostics as error, warning, info or hint.
740
741 /// A human-readable string describing the source of this diagnostic, e.g.
742 /// 'typescript' or 'super lint'.
743 std::string source;
744
745 /// The diagnostic's message.
746 std::string message;
747
748 /// An array of related diagnostic information, e.g. when symbol-names within
749 /// a scope collide all definitions can be marked via this property.
750 std::optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
751
752 /// Additional metadata about the diagnostic.
753 std::vector<DiagnosticTag> tags;
754
755 /// The diagnostic's category. Can be omitted.
756 /// An LSP extension that's used to send the name of the category over to the
757 /// client. The category typically describes the compilation stage during
758 /// which the issue was produced, e.g. "Semantic Issue" or "Parse Issue".
759 std::optional<std::string> category;
760};
761
762/// Add support for JSON serialization.
766
767//===----------------------------------------------------------------------===//
768// PublishDiagnosticsParams
769//===----------------------------------------------------------------------===//
770
774
775 /// The URI for which diagnostic information is reported.
777 /// The list of reported diagnostics.
778 std::vector<Diagnostic> diagnostics;
779 /// The version number of the document the diagnostics are published for.
780 int64_t version;
781};
782
783/// Add support for JSON serialization.
785toJSON(const PublishDiagnosticsParams &params);
786
787//===----------------------------------------------------------------------===//
788// TextEdit
789//===----------------------------------------------------------------------===//
790
791struct TextEdit {
792 /// The range of the text document to be manipulated. To insert
793 /// text into a document create a range where start === end.
795
796 /// The string to be inserted. For delete operations use an
797 /// empty string.
798 std::string newText;
799};
800
801inline bool operator==(const TextEdit &lhs, const TextEdit &rhs) {
802 return std::tie(lhs.newText, lhs.range) == std::tie(rhs.newText, rhs.range);
803}
804
806 TextEdit &result, llvm::json::Path path);
807LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const TextEdit &value);
808LLVM_ABI raw_ostream &operator<<(raw_ostream &os, const TextEdit &value);
809
810//===----------------------------------------------------------------------===//
811// CompletionItemKind
812//===----------------------------------------------------------------------===//
813
814/// The kind of a completion entry.
844 CompletionItemKind &result,
846
848 static_cast<size_t>(CompletionItemKind::Text);
850 static_cast<size_t>(CompletionItemKind::TypeParameter);
851using CompletionItemKindBitset = std::bitset<kCompletionItemKindMax + 1>;
855
858 CompletionItemKindBitset &supportedCompletionItemKinds);
859
860//===----------------------------------------------------------------------===//
861// CompletionItem
862//===----------------------------------------------------------------------===//
863
864/// Defines whether the insert text in a completion item should be interpreted
865/// as plain text or a snippet.
868 /// The primary text to be inserted is treated as a plain string.
870 /// The primary text to be inserted is treated as a snippet.
871 ///
872 /// A snippet can define tab stops and placeholders with `$1`, `$2`
873 /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end
874 /// of the snippet. Placeholders with equal identifiers are linked, that is
875 /// typing in one will update others too.
876 ///
877 /// See also:
878 /// https//github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
880};
881
883 CompletionItem() = default;
888
889 /// The label of this completion item. By default also the text that is
890 /// inserted when selecting this completion.
891 std::string label;
892
893 /// The kind of this completion item. Based of the kind an icon is chosen by
894 /// the editor.
896
897 /// A human-readable string with additional information about this item, like
898 /// type or symbol information.
899 std::string detail;
900
901 /// A human-readable string that represents a doc-comment.
902 std::optional<MarkupContent> documentation;
903
904 /// A string that should be used when comparing this item with other items.
905 /// When `falsy` the label is used.
906 std::string sortText;
907
908 /// A string that should be used when filtering a set of completion items.
909 /// When `falsy` the label is used.
910 std::string filterText;
911
912 /// A string that should be inserted to a document when selecting this
913 /// completion. When `falsy` the label is used.
914 std::string insertText;
915
916 /// The format of the insert text. The format applies to both the `insertText`
917 /// property and the `newText` property of a provided `textEdit`.
919
920 /// An edit which is applied to a document when selecting this completion.
921 /// When an edit is provided `insertText` is ignored.
922 ///
923 /// Note: The range of the edit must be a single line range and it must
924 /// contain the position at which completion has been requested.
925 std::optional<TextEdit> textEdit;
926
927 /// An optional array of additional text edits that are applied when selecting
928 /// this completion. Edits must not overlap with the main edit nor with
929 /// themselves.
930 std::vector<TextEdit> additionalTextEdits;
931
932 /// Indicates if this item is deprecated.
933 bool deprecated = false;
934};
935
936/// Add support for JSON serialization.
939LLVM_ABI bool operator<(const CompletionItem &lhs, const CompletionItem &rhs);
940
941//===----------------------------------------------------------------------===//
942// CompletionList
943//===----------------------------------------------------------------------===//
944
945/// Represents a collection of completion items to be presented in the editor.
947 /// The list is not complete. Further typing should result in recomputing the
948 /// list.
949 bool isIncomplete = false;
950
951 /// The completion items.
952 std::vector<CompletionItem> items;
953};
954
955/// Add support for JSON serialization.
957
958//===----------------------------------------------------------------------===//
959// CompletionContext
960//===----------------------------------------------------------------------===//
961
963 /// Completion was triggered by typing an identifier (24x7 code
964 /// complete), manual invocation (e.g Ctrl+Space) or via API.
966
967 /// Completion was triggered by a trigger character specified by
968 /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
970
971 /// Completion was re-triggered as the current completion list is incomplete.
973};
974
976 /// How the completion was triggered.
978
979 /// The trigger character (a single character) that has trigger code complete.
980 /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
981 std::string triggerCharacter;
982};
983
984/// Add support for JSON serialization.
986 CompletionContext &result,
988
989//===----------------------------------------------------------------------===//
990// CompletionParams
991//===----------------------------------------------------------------------===//
992
996
997/// Add support for JSON serialization.
999 CompletionParams &result,
1001
1002//===----------------------------------------------------------------------===//
1003// ParameterInformation
1004//===----------------------------------------------------------------------===//
1005
1006/// A single parameter of a particular signature.
1008 /// The label of this parameter. Ignored when labelOffsets is set.
1009 std::string labelString;
1010
1011 /// Inclusive start and exclusive end offsets withing the containing signature
1012 /// label.
1013 std::optional<std::pair<unsigned, unsigned>> labelOffsets;
1014
1015 /// The documentation of this parameter. Optional.
1016 std::string documentation;
1017};
1018
1019/// Add support for JSON serialization.
1021
1022//===----------------------------------------------------------------------===//
1023// SignatureInformation
1024//===----------------------------------------------------------------------===//
1025
1026/// Represents the signature of something callable.
1028 /// The label of this signature. Mandatory.
1029 std::string label;
1030
1031 /// The documentation of this signature. Optional.
1032 std::string documentation;
1033
1034 /// The parameters of this signature.
1035 std::vector<ParameterInformation> parameters;
1036};
1037
1038/// Add support for JSON serialization.
1041 const SignatureInformation &value);
1042
1043//===----------------------------------------------------------------------===//
1044// SignatureHelp
1045//===----------------------------------------------------------------------===//
1046
1047/// Represents the signature of a callable.
1049 /// The resulting signatures.
1050 std::vector<SignatureInformation> signatures;
1051
1052 /// The active signature.
1054
1055 /// The active parameter of the active signature.
1057};
1058
1059/// Add support for JSON serialization.
1061
1062//===----------------------------------------------------------------------===//
1063// DocumentLinkParams
1064//===----------------------------------------------------------------------===//
1065
1066/// Parameters for the document link request.
1068 /// The document to provide document links for.
1070};
1071
1072/// Add support for JSON serialization.
1074 DocumentLinkParams &result,
1076
1077//===----------------------------------------------------------------------===//
1078// DocumentLink
1079//===----------------------------------------------------------------------===//
1080
1081/// A range in a text document that links to an internal or external resource,
1082/// like another text document or a web site.
1084 DocumentLink() = default;
1087
1088 /// The range this link applies to.
1090
1091 /// The uri this link points to. If missing a resolve request is sent later.
1093
1094 // TODO: The following optional fields defined by the language server protocol
1095 // are unsupported:
1096 //
1097 // data?: any - A data entry field that is preserved on a document link
1098 // between a DocumentLinkRequest and a
1099 // DocumentLinkResolveRequest.
1100
1101 friend bool operator==(const DocumentLink &lhs, const DocumentLink &rhs) {
1102 return lhs.range == rhs.range && lhs.target == rhs.target;
1103 }
1104
1105 friend bool operator!=(const DocumentLink &lhs, const DocumentLink &rhs) {
1106 return !(lhs == rhs);
1107 }
1108};
1109
1110/// Add support for JSON serialization.
1111LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const DocumentLink &value);
1112
1113//===----------------------------------------------------------------------===//
1114// InlayHintsParams
1115//===----------------------------------------------------------------------===//
1116
1117/// A parameter literal used in inlay hint requests.
1119 /// The text document.
1121
1122 /// The visible document range for which inlay hints should be computed.
1124};
1125
1126/// Add support for JSON serialization.
1128 InlayHintsParams &result,
1130
1131//===----------------------------------------------------------------------===//
1132// InlayHintKind
1133//===----------------------------------------------------------------------===//
1134
1135/// Inlay hint kinds.
1136enum class InlayHintKind {
1137 /// An inlay hint that for a type annotation.
1138 ///
1139 /// An example of a type hint is a hint in this position:
1140 /// auto var ^ = expr;
1141 /// which shows the deduced type of the variable.
1142 Type = 1,
1143
1144 /// An inlay hint that is for a parameter.
1145 ///
1146 /// An example of a parameter hint is a hint in this position:
1147 /// func(^arg);
1148 /// which shows the name of the corresponding parameter.
1150};
1151
1152//===----------------------------------------------------------------------===//
1153// InlayHint
1154//===----------------------------------------------------------------------===//
1155
1156/// Inlay hint information.
1159
1160 /// The position of this hint.
1162
1163 /// The label of this hint. A human readable string or an array of
1164 /// InlayHintLabelPart label parts.
1165 ///
1166 /// *Note* that neither the string nor the label part can be empty.
1167 std::string label;
1168
1169 /// The kind of this hint. Can be omitted in which case the client should fall
1170 /// back to a reasonable default.
1172
1173 /// Render padding before the hint.
1174 ///
1175 /// Note: Padding should use the editor's background color, not the
1176 /// background color of the hint itself. That means padding can be used
1177 /// to visually align/separate an inlay hint.
1178 bool paddingLeft = false;
1179
1180 /// Render padding after the hint.
1181 ///
1182 /// Note: Padding should use the editor's background color, not the
1183 /// background color of the hint itself. That means padding can be used
1184 /// to visually align/separate an inlay hint.
1185 bool paddingRight = false;
1186};
1187
1188/// Add support for JSON serialization.
1190LLVM_ABI bool operator==(const InlayHint &lhs, const InlayHint &rhs);
1191LLVM_ABI bool operator<(const InlayHint &lhs, const InlayHint &rhs);
1193 InlayHintKind value);
1194
1195//===----------------------------------------------------------------------===//
1196// CodeActionContext
1197//===----------------------------------------------------------------------===//
1198
1200 /// An array of diagnostics known on the client side overlapping the range
1201 /// provided to the `textDocument/codeAction` request. They are provided so
1202 /// that the server knows which errors are currently presented to the user for
1203 /// the given range. There is no guarantee that these accurately reflect the
1204 /// error state of the resource. The primary parameter to compute code actions
1205 /// is the provided range.
1206 std::vector<Diagnostic> diagnostics;
1207
1208 /// Requested kind of actions to return.
1209 ///
1210 /// Actions not of this kind are filtered out by the client before being
1211 /// shown. So servers can omit computing them.
1212 std::vector<std::string> only;
1213};
1214
1215/// Add support for JSON serialization.
1217 CodeActionContext &result,
1219
1220//===----------------------------------------------------------------------===//
1221// CodeActionParams
1222//===----------------------------------------------------------------------===//
1223
1225 /// The document in which the command was invoked.
1227
1228 /// The range for which the command was invoked.
1230
1231 /// Context carrying additional information.
1233};
1234
1235/// Add support for JSON serialization.
1237 CodeActionParams &result,
1239
1240//===----------------------------------------------------------------------===//
1241// WorkspaceEdit
1242//===----------------------------------------------------------------------===//
1243
1245 /// Holds changes to existing resources.
1246 std::map<std::string, std::vector<TextEdit>> changes;
1247
1248 /// Note: "documentChanges" is not currently used because currently there is
1249 /// no support for versioned edits.
1250};
1251
1252/// Add support for JSON serialization.
1256
1257//===----------------------------------------------------------------------===//
1258// CodeAction
1259//===----------------------------------------------------------------------===//
1260
1261/// A code action represents a change that can be performed in code, e.g. to fix
1262/// a problem or to refactor code.
1263///
1264/// A CodeAction must set either `edit` and/or a `command`. If both are
1265/// supplied, the `edit` is applied first, then the `command` is executed.
1267 /// A short, human-readable, title for this code action.
1268 std::string title;
1269
1270 /// The kind of the code action.
1271 /// Used to filter code actions.
1272 std::optional<std::string> kind;
1276
1277 /// The diagnostics that this code action resolves.
1278 std::optional<std::vector<Diagnostic>> diagnostics;
1279
1280 /// Marks this as a preferred action. Preferred actions are used by the
1281 /// `auto fix` command and can be targeted by keybindings.
1282 /// A quick fix should be marked preferred if it properly addresses the
1283 /// underlying error. A refactoring should be marked preferred if it is the
1284 /// most reasonable choice of actions to take.
1285 bool isPreferred = false;
1286
1287 /// The workspace edit this code action performs.
1288 std::optional<WorkspaceEdit> edit;
1289};
1290
1291/// Add support for JSON serialization.
1293
1294//===----------------------------------------------------------------------===//
1295// ShowMessageParams
1296//===----------------------------------------------------------------------===//
1297
1298enum class MessageType { Error = 1, Warning = 2, Info = 3, Log = 4, Debug = 5 };
1299
1301 /// A short title like 'Retry', 'Open Log' etc.
1302 std::string title;
1303};
1304
1306 ShowMessageParams(MessageType Type, std::string Message)
1307 : type(Type), message(Message) {}
1309 /// The actual message.
1310 std::string message;
1311 /// The message action items to present.
1312 std::optional<std::vector<MessageActionItem>> actions;
1313};
1314
1315/// Add support for JSON serialization.
1317
1318/// Add support for JSON serialization.
1320
1321} // namespace lsp
1322} // namespace llvm
1323
1324namespace llvm {
1325template <> struct format_provider<llvm::lsp::Position> {
1326 static void format(const llvm::lsp::Position &pos, raw_ostream &os,
1327 StringRef style) {
1328 assert(style.empty() && "style modifiers for this type are not supported");
1329 os << pos;
1330 }
1331};
1332} // namespace llvm
1333
1334#endif
1335
1336// NOLINTEND(readability-identifier-naming)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
#define LLVM_ABI_FOR_TEST
Definition Compiler.h:218
This file supports working with JSON data.
lazy value info
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Base class for user error types.
Definition Error.h:354
Tagged union holding either a T or a Error.
Definition Error.h:485
Represents a location in source code.
Definition SMLoc.h:22
constexpr const char * getPointer() const
Definition SMLoc.h:33
constexpr bool isValid() const
Definition SMLoc.h:28
Represents a range in source code.
Definition SMLoc.h:47
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:37
unsigned getMainFileID() const
Definition SourceMgr.h:151
LLVM_ABI std::pair< unsigned, unsigned > getLineAndColumn(SMLoc Loc, unsigned BufferID=0) const
Find the line and column number for the specified location in the specified file.
LLVM_ABI SMLoc FindLocForLineAndColumn(unsigned BufferID, unsigned LineNo, unsigned ColNo)
Given a line and column number in a mapped buffer, turn it into an SMLoc.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition StringRef.h:882
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
A "cursor" marking a position within a Value.
Definition JSON.h:652
A Value is an JSON value of unknown type.
Definition JSON.h:290
static LLVM_ABI_FOR_TEST char ID
Definition Protocol.h:84
void log(raw_ostream &os) const override
Print an error message to an output stream.
Definition Protocol.h:89
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
Definition Protocol.h:92
std::string message
Definition Protocol.h:82
LSPError(std::string message, ErrorCode code)
Definition Protocol.h:86
URI in "file" scheme for a file.
Definition Protocol.h:102
friend bool operator==(const URIForFile &lhs, const URIForFile &rhs)
Definition Protocol.h:125
static LLVM_ABI void registerSupportedScheme(StringRef scheme)
Register a supported URI scheme.
Definition Protocol.cpp:234
static LLVM_ABI llvm::Expected< URIForFile > fromFile(StringRef absoluteFilepath, StringRef scheme="file")
Try to build a URIForFile from the given absolute file path and optional scheme.
Definition Protocol.cpp:223
static LLVM_ABI llvm::Expected< URIForFile > fromURI(StringRef uri)
Try to build a URIForFile from the given URI string.
Definition Protocol.cpp:216
LLVM_ABI StringRef scheme() const
Return the scheme of the uri.
Definition Protocol.cpp:232
friend bool operator!=(const URIForFile &lhs, const URIForFile &rhs)
Definition Protocol.h:128
StringRef uri() const
Returns the original uri of the file.
Definition Protocol.h:118
friend bool operator<(const URIForFile &lhs, const URIForFile &rhs)
Definition Protocol.h:131
StringRef file() const
Returns the absolute path to the file.
Definition Protocol.h:115
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
constexpr auto kCompletionItemKindMin
Definition Protocol.h:847
MarkupKind
Describes the content type that a client supports in various result literals like Hover.
Definition Protocol.h:562
LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const URIForFile &value)
Add support for JSON serialization.
Definition Protocol.cpp:253
CompletionTriggerKind
Definition Protocol.h:962
@ Invoked
Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e....
Definition Protocol.h:965
@ TriggerTriggerForIncompleteCompletions
Completion was re-triggered as the current completion list is incomplete.
Definition Protocol.h:972
@ TriggerCharacter
Completion was triggered by a trigger character specified by the triggerCharacters properties of the ...
Definition Protocol.h:969
TextDocumentSyncKind
Defines how the host (editor) should sync document changes to the language server.
Definition Protocol.h:63
@ Incremental
Documents are synced by sending the full content on open.
Definition Protocol.h:72
@ None
Documents should not be synced at all.
Definition Protocol.h:65
@ Full
Documents are synced by always sending the full content of the document.
Definition Protocol.h:68
LLVM_ABI bool operator<(const CompletionItem &lhs, const CompletionItem &rhs)
Definition Protocol.cpp:829
bool operator==(const TextEdit &lhs, const TextEdit &rhs)
Definition Protocol.h:801
NoParams InitializedParams
Definition Protocol.h:240
LLVM_ABI raw_ostream & operator<<(raw_ostream &os, const URIForFile &value)
Definition Protocol.cpp:257
LLVM_ABI CompletionItemKind adjustKindToCapability(CompletionItemKind kind, CompletionItemKindBitset &supportedCompletionItemKinds)
Definition Protocol.cpp:756
InlayHintKind
Inlay hint kinds.
Definition Protocol.h:1136
@ Parameter
An inlay hint that is for a parameter.
Definition Protocol.h:1149
@ Type
An inlay hint that for a type annotation.
Definition Protocol.h:1142
DiagnosticSeverity
Definition Protocol.h:713
@ Undetermined
It is up to the client to interpret diagnostics as error, warning, info or hint.
Definition Protocol.h:716
InsertTextFormat
Defines whether the insert text in a completion item should be interpreted as plain text or a snippet...
Definition Protocol.h:866
std::bitset< kCompletionItemKindMax+1 > CompletionItemKindBitset
Definition Protocol.h:851
constexpr auto kCompletionItemKindMax
Definition Protocol.h:849
CompletionItemKind
The kind of a completion entry.
Definition Protocol.h:815
LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value, URIForFile &result, llvm::json::Path path)
Definition Protocol.cpp:238
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition Error.cpp:94
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1916
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:860
This class represents an efficient way to signal success or failure.
static void format(const llvm::lsp::Position &pos, raw_ostream &os, StringRef style)
Definition Protocol.h:1326
bool hierarchicalDocumentSymbol
Client supports hierarchical document symbols.
Definition Protocol.h:161
bool workDoneProgress
Client supports server-initiated progress via the window/workDoneProgress/create method.
Definition Protocol.h:171
bool codeActionStructure
Client supports CodeAction return value for textDocument/codeAction.
Definition Protocol.h:165
std::string name
The name of the client as defined by the client.
Definition Protocol.h:185
std::optional< std::string > version
The client's version as defined by the client.
Definition Protocol.h:188
std::vector< Diagnostic > diagnostics
An array of diagnostics known on the client side overlapping the range provided to the textDocument/c...
Definition Protocol.h:1206
std::vector< std::string > only
Requested kind of actions to return.
Definition Protocol.h:1212
CodeActionContext context
Context carrying additional information.
Definition Protocol.h:1232
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Definition Protocol.h:1226
Range range
The range for which the command was invoked.
Definition Protocol.h:1229
A code action represents a change that can be performed in code, e.g.
Definition Protocol.h:1266
std::optional< std::string > kind
The kind of the code action.
Definition Protocol.h:1272
LLVM_ABI static const llvm::StringLiteral kRefactor
Definition Protocol.h:1274
LLVM_ABI static const llvm::StringLiteral kInfo
Definition Protocol.h:1275
bool isPreferred
Marks this as a preferred action.
Definition Protocol.h:1285
LLVM_ABI static const llvm::StringLiteral kQuickFix
Definition Protocol.h:1273
std::optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
Definition Protocol.h:1278
std::optional< WorkspaceEdit > edit
The workspace edit this code action performs.
Definition Protocol.h:1288
std::string title
A short, human-readable, title for this code action.
Definition Protocol.h:1268
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
Definition Protocol.h:981
CompletionTriggerKind triggerKind
How the completion was triggered.
Definition Protocol.h:977
CompletionItem(const Twine &label, CompletionItemKind kind, StringRef sortText="")
Definition Protocol.h:884
std::string filterText
A string that should be used when filtering a set of completion items.
Definition Protocol.h:910
std::string insertText
A string that should be inserted to a document when selecting this completion.
Definition Protocol.h:914
bool deprecated
Indicates if this item is deprecated.
Definition Protocol.h:933
std::optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
Definition Protocol.h:925
std::vector< TextEdit > additionalTextEdits
An optional array of additional text edits that are applied when selecting this completion.
Definition Protocol.h:930
CompletionItemKind kind
The kind of this completion item.
Definition Protocol.h:895
InsertTextFormat insertTextFormat
The format of the insert text.
Definition Protocol.h:918
std::string label
The label of this completion item.
Definition Protocol.h:891
std::optional< MarkupContent > documentation
A human-readable string that represents a doc-comment.
Definition Protocol.h:902
std::string sortText
A string that should be used when comparing this item with other items.
Definition Protocol.h:906
Represents a collection of completion items to be presented in the editor.
Definition Protocol.h:946
bool isIncomplete
The list is not complete.
Definition Protocol.h:949
std::vector< CompletionItem > items
The completion items.
Definition Protocol.h:952
CompletionContext context
Definition Protocol.h:994
Represents a related message and source code location for a diagnostic.
Definition Protocol.h:691
DiagnosticRelatedInformation(Location location, std::string message)
Definition Protocol.h:693
std::string message
The message of this related diagnostic information.
Definition Protocol.h:699
Location location
The location of this related diagnostic information.
Definition Protocol.h:697
std::vector< DiagnosticTag > tags
Additional metadata about the diagnostic.
Definition Protocol.h:753
std::string message
The diagnostic's message.
Definition Protocol.h:746
Range range
The source range where the message applies.
Definition Protocol.h:735
std::optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
An array of related diagnostic information, e.g.
Definition Protocol.h:750
std::string source
A human-readable string describing the source of this diagnostic, e.g.
Definition Protocol.h:743
DiagnosticSeverity severity
The diagnostic's severity.
Definition Protocol.h:739
std::optional< std::string > category
The diagnostic's category.
Definition Protocol.h:759
VersionedTextDocumentIdentifier textDocument
The document that changed.
Definition Protocol.h:545
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
Definition Protocol.h:548
TextDocumentIdentifier textDocument
The document that was closed.
Definition Protocol.h:496
TextDocumentItem textDocument
The document that was opened.
Definition Protocol.h:482
TextDocumentIdentifier textDocument
The document that was saved.
Definition Protocol.h:510
Parameters for the document link request.
Definition Protocol.h:1067
TextDocumentIdentifier textDocument
The document to provide document links for.
Definition Protocol.h:1069
TextDocumentIdentifier textDocument
Definition Protocol.h:676
Represents programming constructs like variables, classes, interfaces etc.
Definition Protocol.h:636
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else like co...
Definition Protocol.h:657
SymbolKind kind
The kind of this symbol.
Definition Protocol.h:651
DocumentSymbol(const Twine &name, SymbolKind kind, Range range, Range selectionRange)
Definition Protocol.h:639
std::string name
The name of this symbol.
Definition Protocol.h:645
DocumentSymbol(DocumentSymbol &&)=default
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Definition Protocol.h:664
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition Protocol.h:661
std::optional< Range > range
An optional range is a range inside a text document that is used to visualize a hover,...
Definition Protocol.h:589
Hover(Range range)
Construct a default hover with the given range that uses Markdown content.
Definition Protocol.h:582
MarkupContent contents
The hover's content.
Definition Protocol.h:585
std::optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
Definition Protocol.h:217
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool).
Definition Protocol.h:211
std::optional< ClientInfo > clientInfo
Information about the client.
Definition Protocol.h:214
std::optional< std::string > rootUri
The root URI of the workspace. Is null if no folder is open.
Definition Protocol.h:220
std::optional< std::string > rootPath
The root path of the workspace.
Definition Protocol.h:224
Inlay hint information.
Definition Protocol.h:1157
bool paddingRight
Render padding after the hint.
Definition Protocol.h:1185
InlayHint(InlayHintKind kind, Position pos)
Definition Protocol.h:1158
bool paddingLeft
Render padding before the hint.
Definition Protocol.h:1178
InlayHintKind kind
The kind of this hint.
Definition Protocol.h:1171
std::string label
The label of this hint.
Definition Protocol.h:1167
Position position
The position of this hint.
Definition Protocol.h:1161
A parameter literal used in inlay hint requests.
Definition Protocol.h:1118
Range range
The visible document range for which inlay hints should be computed.
Definition Protocol.h:1123
TextDocumentIdentifier textDocument
The text document.
Definition Protocol.h:1120
Location(const URIForFile &uri, Range range)
Definition Protocol.h:408
friend bool operator<(const Location &lhs, const Location &rhs)
Definition Protocol.h:426
friend bool operator!=(const Location &lhs, const Location &rhs)
Definition Protocol.h:422
URIForFile uri
The text document's URI.
Definition Protocol.h:415
Location(const URIForFile &uri, llvm::SourceMgr &mgr, SMRange range)
Construct a Location from the given source range.
Definition Protocol.h:411
friend bool operator==(const Location &lhs, const Location &rhs)
Definition Protocol.h:418
std::string title
A short title like 'Retry', 'Open Log' etc.
Definition Protocol.h:1302
A single parameter of a particular signature.
Definition Protocol.h:1007
std::optional< std::pair< unsigned, unsigned > > labelOffsets
Inclusive start and exclusive end offsets withing the containing signature label.
Definition Protocol.h:1013
std::string documentation
The documentation of this parameter. Optional.
Definition Protocol.h:1016
std::string labelString
The label of this parameter. Ignored when labelOffsets is set.
Definition Protocol.h:1009
Position(llvm::SourceMgr &mgr, SMLoc loc)
Construct a position from the given source location.
Definition Protocol.h:307
int line
Line position in a document (zero-based).
Definition Protocol.h:314
SMLoc getAsSMLoc(llvm::SourceMgr &mgr) const
Convert this position into a source location in the main file of the given source manager.
Definition Protocol.h:337
friend bool operator==(const Position &lhs, const Position &rhs)
Definition Protocol.h:319
Position(int line=0, int character=0)
Definition Protocol.h:303
int character
Character offset on a line in a document (zero-based).
Definition Protocol.h:317
friend bool operator<(const Position &lhs, const Position &rhs)
Definition Protocol.h:326
friend bool operator<=(const Position &lhs, const Position &rhs)
Definition Protocol.h:330
friend bool operator!=(const Position &lhs, const Position &rhs)
Definition Protocol.h:323
URIForFile uri
The URI for which diagnostic information is reported.
Definition Protocol.h:776
PublishDiagnosticsParams(URIForFile uri, int64_t version)
Definition Protocol.h:772
int64_t version
The version number of the document the diagnostics are published for.
Definition Protocol.h:780
std::vector< Diagnostic > diagnostics
The list of reported diagnostics.
Definition Protocol.h:778
bool contains(Position pos) const
Definition Protocol.h:378
friend bool operator!=(const Range &lhs, const Range &rhs)
Definition Protocol.h:371
SMRange getAsSMRange(llvm::SourceMgr &mgr) const
Convert this range into a source range in the main file of the given source manager.
Definition Protocol.h:385
friend bool operator<(const Range &lhs, const Range &rhs)
Definition Protocol.h:374
bool contains(Range range) const
Definition Protocol.h:379
Position end
The range's end position.
Definition Protocol.h:366
Position start
The range's start position.
Definition Protocol.h:363
Range(llvm::SourceMgr &mgr, SMRange range)
Construct a range from the given source range.
Definition Protocol.h:359
Range(Position start, Position end)
Definition Protocol.h:355
friend bool operator==(const Range &lhs, const Range &rhs)
Definition Protocol.h:368
Range(Position loc)
Definition Protocol.h:356
bool includeDeclaration
Include the declaration of the current symbol.
Definition Protocol.h:460
ReferenceContext context
Definition Protocol.h:469
ShowMessageParams(MessageType Type, std::string Message)
Definition Protocol.h:1306
std::string message
The actual message.
Definition Protocol.h:1310
std::optional< std::vector< MessageActionItem > > actions
The message action items to present.
Definition Protocol.h:1312
Represents the signature of a callable.
Definition Protocol.h:1048
std::vector< SignatureInformation > signatures
The resulting signatures.
Definition Protocol.h:1050
int activeParameter
The active parameter of the active signature.
Definition Protocol.h:1056
int activeSignature
The active signature.
Definition Protocol.h:1053
Represents the signature of something callable.
Definition Protocol.h:1027
std::vector< ParameterInformation > parameters
The parameters of this signature.
Definition Protocol.h:1035
std::string label
The label of this signature. Mandatory.
Definition Protocol.h:1029
std::string documentation
The documentation of this signature. Optional.
Definition Protocol.h:1032
std::optional< Range > range
The range of the document that changed.
Definition Protocol.h:529
std::optional< int > rangeLength
The length of the range that got replaced.
Definition Protocol.h:532
LLVM_ABI LogicalResult applyTo(std::string &contents) const
Try to apply this change to the given contents string.
Definition Protocol.cpp:522
std::string text
The new text of the range/document.
Definition Protocol.h:535
URIForFile uri
The text document's URI.
Definition Protocol.h:271
std::string languageId
The text document's language identifier.
Definition Protocol.h:251
URIForFile uri
The text document's URI.
Definition Protocol.h:248
int64_t version
The version number of this document.
Definition Protocol.h:257
std::string text
The content of the opened text document.
Definition Protocol.h:254
Position position
The position inside the text document.
Definition Protocol.h:446
TextDocumentIdentifier textDocument
The text document.
Definition Protocol.h:443
Range range
The range of the text document to be manipulated.
Definition Protocol.h:794
std::string newText
The string to be inserted.
Definition Protocol.h:798
URIForFile uri
The text document's URI.
Definition Protocol.h:286
int64_t version
The version number of this document.
Definition Protocol.h:288
std::map< std::string, std::vector< TextEdit > > changes
Holds changes to existing resources.
Definition Protocol.h:1246