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.
111 static llvm::Expected<URIForFile> fromFile(StringRef absoluteFilepath,
112 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 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);
152raw_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
220/// Add support for JSON serialization.
222 InitializeParams &result,
224
225//===----------------------------------------------------------------------===//
226// InitializedParams
227//===----------------------------------------------------------------------===//
228
229struct NoParams {};
231 return true;
232}
234
235//===----------------------------------------------------------------------===//
236// TextDocumentItem
237//===----------------------------------------------------------------------===//
238
240 /// The text document's URI.
242
243 /// The text document's language identifier.
244 std::string languageId;
245
246 /// The content of the opened text document.
247 std::string text;
248
249 /// The version number of this document.
250 int64_t version;
251};
252
253/// Add support for JSON serialization.
255 TextDocumentItem &result,
257
258//===----------------------------------------------------------------------===//
259// TextDocumentIdentifier
260//===----------------------------------------------------------------------===//
261
263 /// The text document's URI.
265};
266
267/// Add support for JSON serialization.
272
273//===----------------------------------------------------------------------===//
274// VersionedTextDocumentIdentifier
275//===----------------------------------------------------------------------===//
276
278 /// The text document's URI.
280 /// The version number of this document.
281 int64_t version;
282};
283
284/// Add support for JSON serialization.
290
291//===----------------------------------------------------------------------===//
292// Position
293//===----------------------------------------------------------------------===//
294
295struct Position {
296 Position(int line = 0, int character = 0)
298
299 /// Construct a position from the given source location.
301 std::pair<unsigned, unsigned> lineAndCol = mgr.getLineAndColumn(loc);
302 line = lineAndCol.first - 1;
303 character = lineAndCol.second - 1;
304 }
305
306 /// Line position in a document (zero-based).
307 int line = 0;
308
309 /// Character offset on a line in a document (zero-based).
310 int character = 0;
311
312 friend bool operator==(const Position &lhs, const Position &rhs) {
313 return std::tie(lhs.line, lhs.character) ==
314 std::tie(rhs.line, rhs.character);
315 }
316 friend bool operator!=(const Position &lhs, const Position &rhs) {
317 return !(lhs == rhs);
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 std::tie(lhs.line, lhs.character) <=
325 std::tie(rhs.line, rhs.character);
326 }
327
328 /// Convert this position into a source location in the main file of the given
329 /// source manager.
331 return mgr.FindLocForLineAndColumn(mgr.getMainFileID(), line + 1,
332 character + 1);
333 }
334};
335
336/// Add support for JSON serialization.
338 Position &result, llvm::json::Path path);
339LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Position &value);
340raw_ostream &operator<<(raw_ostream &os, const Position &value);
341
342//===----------------------------------------------------------------------===//
343// Range
344//===----------------------------------------------------------------------===//
345
346struct Range {
347 Range() = default;
349 Range(Position loc) : Range(loc, loc) {}
350
351 /// Construct a range from the given source range.
353 : Range(Position(mgr, range.Start), Position(mgr, range.End)) {}
354
355 /// The range's start position.
357
358 /// The range's end position.
360
361 friend bool operator==(const Range &lhs, const Range &rhs) {
362 return std::tie(lhs.start, lhs.end) == std::tie(rhs.start, rhs.end);
363 }
364 friend bool operator!=(const Range &lhs, const Range &rhs) {
365 return !(lhs == rhs);
366 }
367 friend bool operator<(const Range &lhs, const Range &rhs) {
368 return std::tie(lhs.start, lhs.end) < std::tie(rhs.start, rhs.end);
369 }
370
371 bool contains(Position pos) const { return start <= pos && pos < end; }
372 bool contains(Range range) const {
373 return start <= range.start && range.end <= end;
374 }
375
376 /// Convert this range into a source range in the main file of the given
377 /// source manager.
379 SMLoc startLoc = start.getAsSMLoc(mgr);
380 SMLoc endLoc = end.getAsSMLoc(mgr);
381 // Check that the start and end locations are valid.
382 if (!startLoc.isValid() || !endLoc.isValid() ||
383 startLoc.getPointer() > endLoc.getPointer())
384 return SMRange();
385 return SMRange(startLoc, endLoc);
386 }
387};
388
389/// Add support for JSON serialization.
390LLVM_ABI_FOR_TEST bool fromJSON(const llvm::json::Value &value, Range &result,
393raw_ostream &operator<<(raw_ostream &os, const Range &value);
394
395//===----------------------------------------------------------------------===//
396// Location
397//===----------------------------------------------------------------------===//
398
399struct Location {
400 Location() = default;
402
403 /// Construct a Location from the given source range.
406
407 /// The text document's URI.
410
411 friend bool operator==(const Location &lhs, const Location &rhs) {
412 return lhs.uri == rhs.uri && lhs.range == rhs.range;
413 }
414
415 friend bool operator!=(const Location &lhs, const Location &rhs) {
416 return !(lhs == rhs);
417 }
418
419 friend bool operator<(const Location &lhs, const Location &rhs) {
420 return std::tie(lhs.uri, lhs.range) < std::tie(rhs.uri, rhs.range);
421 }
422};
423
424/// Add support for JSON serialization.
426 Location &result, llvm::json::Path path);
427LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const Location &value);
428raw_ostream &operator<<(raw_ostream &os, const Location &value);
429
430//===----------------------------------------------------------------------===//
431// TextDocumentPositionParams
432//===----------------------------------------------------------------------===//
433
435 /// The text document.
437
438 /// The position inside the text document.
440};
441
442/// Add support for JSON serialization.
446
447//===----------------------------------------------------------------------===//
448// ReferenceParams
449//===----------------------------------------------------------------------===//
450
452 /// Include the declaration of the current symbol.
453 bool includeDeclaration = false;
454};
455
456/// Add support for JSON serialization.
458 ReferenceContext &result,
460
464
465/// Add support for JSON serialization.
468
469//===----------------------------------------------------------------------===//
470// DidOpenTextDocumentParams
471//===----------------------------------------------------------------------===//
472
474 /// The document that was opened.
476};
477
478/// Add support for JSON serialization.
482
483//===----------------------------------------------------------------------===//
484// DidCloseTextDocumentParams
485//===----------------------------------------------------------------------===//
486
488 /// The document that was closed.
490};
491
492/// Add support for JSON serialization.
496
497//===----------------------------------------------------------------------===//
498// DidSaveTextDocumentParams
499//===----------------------------------------------------------------------===//
500
502 /// The document that was saved.
504};
505
508
509//===----------------------------------------------------------------------===//
510// DidChangeTextDocumentParams
511//===----------------------------------------------------------------------===//
512
514 /// Try to apply this change to the given contents string.
515 LogicalResult applyTo(std::string &contents) const;
516 /// Try to apply a set of changes to the given contents string.
518 std::string &contents);
519
520 /// The range of the document that changed.
521 std::optional<Range> range;
522
523 /// The length of the range that got replaced.
524 std::optional<int> rangeLength;
525
526 /// The new text of the range/document.
527 std::string text;
528};
529
530/// Add support for JSON serialization.
534
536 /// The document that changed.
538
539 /// The actual content changes.
540 std::vector<TextDocumentContentChangeEvent> contentChanges;
541};
542
543/// Add support for JSON serialization.
547
548//===----------------------------------------------------------------------===//
549// MarkupContent
550//===----------------------------------------------------------------------===//
551
552/// Describes the content type that a client supports in various result literals
553/// like `Hover`.
558raw_ostream &operator<<(raw_ostream &os, MarkupKind kind);
559
564
565/// Add support for JSON serialization.
567
568//===----------------------------------------------------------------------===//
569// Hover
570//===----------------------------------------------------------------------===//
571
572struct Hover {
573 /// Construct a default hover with the given range that uses Markdown content.
575
576 /// The hover's content.
578
579 /// An optional range is a range inside a text document that is used to
580 /// visualize a hover, e.g. by changing the background color.
581 std::optional<Range> range;
582};
583
584/// Add support for JSON serialization.
586
587//===----------------------------------------------------------------------===//
588// SymbolKind
589//===----------------------------------------------------------------------===//
590
619
620//===----------------------------------------------------------------------===//
621// DocumentSymbol
622//===----------------------------------------------------------------------===//
623
624/// Represents programming constructs like variables, classes, interfaces etc.
625/// that appear in a document. Document symbols can be hierarchical and they
626/// have two ranges: one that encloses its definition and one that points to its
627/// most interesting range, e.g. the range of an identifier.
629 DocumentSymbol() = default;
635
636 /// The name of this symbol.
637 std::string name;
638
639 /// More detail for this symbol, e.g the signature of a function.
640 std::string detail;
641
642 /// The kind of this symbol.
644
645 /// The range enclosing this symbol not including leading/trailing whitespace
646 /// but everything else like comments. This information is typically used to
647 /// determine if the clients cursor is inside the symbol to reveal in the
648 /// symbol in the UI.
650
651 /// The range that should be selected and revealed when this symbol is being
652 /// picked, e.g the name of a function. Must be contained by the `range`.
654
655 /// Children of this symbol, e.g. properties of a class.
656 std::vector<DocumentSymbol> children;
657};
658
659/// Add support for JSON serialization.
661
662//===----------------------------------------------------------------------===//
663// DocumentSymbolParams
664//===----------------------------------------------------------------------===//
665
667 // The text document to find symbols in.
669};
670
671/// Add support for JSON serialization.
673 DocumentSymbolParams &result,
675
676//===----------------------------------------------------------------------===//
677// DiagnosticRelatedInformation
678//===----------------------------------------------------------------------===//
679
680/// Represents a related message and source code location for a diagnostic.
681/// This should be used to point to code locations that cause or related to a
682/// diagnostics, e.g. when duplicating a symbol in a scope.
687
688 /// The location of this related diagnostic information.
690 /// The message of this related diagnostic information.
691 std::string message;
692};
693
694/// Add support for JSON serialization.
700
701//===----------------------------------------------------------------------===//
702// Diagnostic
703//===----------------------------------------------------------------------===//
704
706 /// It is up to the client to interpret diagnostics as error, warning, info or
707 /// hint.
709 Error = 1,
713};
714
715enum class DiagnosticTag {
718};
719
720/// Add support for JSON serialization.
724
726 /// The source range where the message applies.
728
729 /// The diagnostic's severity. Can be omitted. If omitted it is up to the
730 /// client to interpret diagnostics as error, warning, info or hint.
732
733 /// A human-readable string describing the source of this diagnostic, e.g.
734 /// 'typescript' or 'super lint'.
735 std::string source;
736
737 /// The diagnostic's message.
738 std::string message;
739
740 /// An array of related diagnostic information, e.g. when symbol-names within
741 /// a scope collide all definitions can be marked via this property.
742 std::optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
743
744 /// Additional metadata about the diagnostic.
745 std::vector<DiagnosticTag> tags;
746
747 /// The diagnostic's category. Can be omitted.
748 /// An LSP extension that's used to send the name of the category over to the
749 /// client. The category typically describes the compilation stage during
750 /// which the issue was produced, e.g. "Semantic Issue" or "Parse Issue".
751 std::optional<std::string> category;
752};
753
754/// Add support for JSON serialization.
758
759//===----------------------------------------------------------------------===//
760// PublishDiagnosticsParams
761//===----------------------------------------------------------------------===//
762
766
767 /// The URI for which diagnostic information is reported.
769 /// The list of reported diagnostics.
770 std::vector<Diagnostic> diagnostics;
771 /// The version number of the document the diagnostics are published for.
772 int64_t version;
773};
774
775/// Add support for JSON serialization.
777toJSON(const PublishDiagnosticsParams &params);
778
779//===----------------------------------------------------------------------===//
780// TextEdit
781//===----------------------------------------------------------------------===//
782
783struct TextEdit {
784 /// The range of the text document to be manipulated. To insert
785 /// text into a document create a range where start === end.
787
788 /// The string to be inserted. For delete operations use an
789 /// empty string.
790 std::string newText;
791};
792
793inline bool operator==(const TextEdit &lhs, const TextEdit &rhs) {
794 return std::tie(lhs.newText, lhs.range) == std::tie(rhs.newText, rhs.range);
795}
796
798 TextEdit &result, llvm::json::Path path);
799LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const TextEdit &value);
800raw_ostream &operator<<(raw_ostream &os, const TextEdit &value);
801
802//===----------------------------------------------------------------------===//
803// CompletionItemKind
804//===----------------------------------------------------------------------===//
805
806/// The kind of a completion entry.
836 CompletionItemKind &result,
838
840 static_cast<size_t>(CompletionItemKind::Text);
842 static_cast<size_t>(CompletionItemKind::TypeParameter);
843using CompletionItemKindBitset = std::bitset<kCompletionItemKindMax + 1>;
847
850 CompletionItemKindBitset &supportedCompletionItemKinds);
851
852//===----------------------------------------------------------------------===//
853// CompletionItem
854//===----------------------------------------------------------------------===//
855
856/// Defines whether the insert text in a completion item should be interpreted
857/// as plain text or a snippet.
860 /// The primary text to be inserted is treated as a plain string.
862 /// The primary text to be inserted is treated as a snippet.
863 ///
864 /// A snippet can define tab stops and placeholders with `$1`, `$2`
865 /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end
866 /// of the snippet. Placeholders with equal identifiers are linked, that is
867 /// typing in one will update others too.
868 ///
869 /// See also:
870 /// https//github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
872};
873
875 CompletionItem() = default;
880
881 /// The label of this completion item. By default also the text that is
882 /// inserted when selecting this completion.
883 std::string label;
884
885 /// The kind of this completion item. Based of the kind an icon is chosen by
886 /// the editor.
888
889 /// A human-readable string with additional information about this item, like
890 /// type or symbol information.
891 std::string detail;
892
893 /// A human-readable string that represents a doc-comment.
894 std::optional<MarkupContent> documentation;
895
896 /// A string that should be used when comparing this item with other items.
897 /// When `falsy` the label is used.
898 std::string sortText;
899
900 /// A string that should be used when filtering a set of completion items.
901 /// When `falsy` the label is used.
902 std::string filterText;
903
904 /// A string that should be inserted to a document when selecting this
905 /// completion. When `falsy` the label is used.
906 std::string insertText;
907
908 /// The format of the insert text. The format applies to both the `insertText`
909 /// property and the `newText` property of a provided `textEdit`.
911
912 /// An edit which is applied to a document when selecting this completion.
913 /// When an edit is provided `insertText` is ignored.
914 ///
915 /// Note: The range of the edit must be a single line range and it must
916 /// contain the position at which completion has been requested.
917 std::optional<TextEdit> textEdit;
918
919 /// An optional array of additional text edits that are applied when selecting
920 /// this completion. Edits must not overlap with the main edit nor with
921 /// themselves.
922 std::vector<TextEdit> additionalTextEdits;
923
924 /// Indicates if this item is deprecated.
925 bool deprecated = false;
926};
927
928/// Add support for JSON serialization.
931bool operator<(const CompletionItem &lhs, const CompletionItem &rhs);
932
933//===----------------------------------------------------------------------===//
934// CompletionList
935//===----------------------------------------------------------------------===//
936
937/// Represents a collection of completion items to be presented in the editor.
939 /// The list is not complete. Further typing should result in recomputing the
940 /// list.
941 bool isIncomplete = false;
942
943 /// The completion items.
944 std::vector<CompletionItem> items;
945};
946
947/// Add support for JSON serialization.
949
950//===----------------------------------------------------------------------===//
951// CompletionContext
952//===----------------------------------------------------------------------===//
953
955 /// Completion was triggered by typing an identifier (24x7 code
956 /// complete), manual invocation (e.g Ctrl+Space) or via API.
958
959 /// Completion was triggered by a trigger character specified by
960 /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
962
963 /// Completion was re-triggered as the current completion list is incomplete.
965};
966
968 /// How the completion was triggered.
970
971 /// The trigger character (a single character) that has trigger code complete.
972 /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
973 std::string triggerCharacter;
974};
975
976/// Add support for JSON serialization.
978 CompletionContext &result,
980
981//===----------------------------------------------------------------------===//
982// CompletionParams
983//===----------------------------------------------------------------------===//
984
988
989/// Add support for JSON serialization.
991 CompletionParams &result,
993
994//===----------------------------------------------------------------------===//
995// ParameterInformation
996//===----------------------------------------------------------------------===//
997
998/// A single parameter of a particular signature.
1000 /// The label of this parameter. Ignored when labelOffsets is set.
1001 std::string labelString;
1002
1003 /// Inclusive start and exclusive end offsets withing the containing signature
1004 /// label.
1005 std::optional<std::pair<unsigned, unsigned>> labelOffsets;
1006
1007 /// The documentation of this parameter. Optional.
1008 std::string documentation;
1009};
1010
1011/// Add support for JSON serialization.
1013
1014//===----------------------------------------------------------------------===//
1015// SignatureInformation
1016//===----------------------------------------------------------------------===//
1017
1018/// Represents the signature of something callable.
1020 /// The label of this signature. Mandatory.
1021 std::string label;
1022
1023 /// The documentation of this signature. Optional.
1024 std::string documentation;
1025
1026 /// The parameters of this signature.
1027 std::vector<ParameterInformation> parameters;
1028};
1029
1030/// Add support for JSON serialization.
1033
1034//===----------------------------------------------------------------------===//
1035// SignatureHelp
1036//===----------------------------------------------------------------------===//
1037
1038/// Represents the signature of a callable.
1040 /// The resulting signatures.
1041 std::vector<SignatureInformation> signatures;
1042
1043 /// The active signature.
1045
1046 /// The active parameter of the active signature.
1048};
1049
1050/// Add support for JSON serialization.
1052
1053//===----------------------------------------------------------------------===//
1054// DocumentLinkParams
1055//===----------------------------------------------------------------------===//
1056
1057/// Parameters for the document link request.
1059 /// The document to provide document links for.
1061};
1062
1063/// Add support for JSON serialization.
1065 DocumentLinkParams &result,
1067
1068//===----------------------------------------------------------------------===//
1069// DocumentLink
1070//===----------------------------------------------------------------------===//
1071
1072/// A range in a text document that links to an internal or external resource,
1073/// like another text document or a web site.
1075 DocumentLink() = default;
1078
1079 /// The range this link applies to.
1081
1082 /// The uri this link points to. If missing a resolve request is sent later.
1084
1085 // TODO: The following optional fields defined by the language server protocol
1086 // are unsupported:
1087 //
1088 // data?: any - A data entry field that is preserved on a document link
1089 // between a DocumentLinkRequest and a
1090 // DocumentLinkResolveRequest.
1091
1092 friend bool operator==(const DocumentLink &lhs, const DocumentLink &rhs) {
1093 return lhs.range == rhs.range && lhs.target == rhs.target;
1094 }
1095
1096 friend bool operator!=(const DocumentLink &lhs, const DocumentLink &rhs) {
1097 return !(lhs == rhs);
1098 }
1099};
1100
1101/// Add support for JSON serialization.
1102LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const DocumentLink &value);
1103
1104//===----------------------------------------------------------------------===//
1105// InlayHintsParams
1106//===----------------------------------------------------------------------===//
1107
1108/// A parameter literal used in inlay hint requests.
1110 /// The text document.
1112
1113 /// The visible document range for which inlay hints should be computed.
1115};
1116
1117/// Add support for JSON serialization.
1119 InlayHintsParams &result,
1121
1122//===----------------------------------------------------------------------===//
1123// InlayHintKind
1124//===----------------------------------------------------------------------===//
1125
1126/// Inlay hint kinds.
1127enum class InlayHintKind {
1128 /// An inlay hint that for a type annotation.
1129 ///
1130 /// An example of a type hint is a hint in this position:
1131 /// auto var ^ = expr;
1132 /// which shows the deduced type of the variable.
1133 Type = 1,
1134
1135 /// An inlay hint that is for a parameter.
1136 ///
1137 /// An example of a parameter hint is a hint in this position:
1138 /// func(^arg);
1139 /// which shows the name of the corresponding parameter.
1141};
1142
1143//===----------------------------------------------------------------------===//
1144// InlayHint
1145//===----------------------------------------------------------------------===//
1146
1147/// Inlay hint information.
1150
1151 /// The position of this hint.
1153
1154 /// The label of this hint. A human readable string or an array of
1155 /// InlayHintLabelPart label parts.
1156 ///
1157 /// *Note* that neither the string nor the label part can be empty.
1158 std::string label;
1159
1160 /// The kind of this hint. Can be omitted in which case the client should fall
1161 /// back to a reasonable default.
1163
1164 /// Render padding before the hint.
1165 ///
1166 /// Note: Padding should use the editor's background color, not the
1167 /// background color of the hint itself. That means padding can be used
1168 /// to visually align/separate an inlay hint.
1169 bool paddingLeft = false;
1170
1171 /// Render padding after the hint.
1172 ///
1173 /// Note: Padding should use the editor's background color, not the
1174 /// background color of the hint itself. That means padding can be used
1175 /// to visually align/separate an inlay hint.
1176 bool paddingRight = false;
1177};
1178
1179/// Add support for JSON serialization.
1181bool operator==(const InlayHint &lhs, const InlayHint &rhs);
1182bool operator<(const InlayHint &lhs, const InlayHint &rhs);
1184
1185//===----------------------------------------------------------------------===//
1186// CodeActionContext
1187//===----------------------------------------------------------------------===//
1188
1190 /// An array of diagnostics known on the client side overlapping the range
1191 /// provided to the `textDocument/codeAction` request. They are provided so
1192 /// that the server knows which errors are currently presented to the user for
1193 /// the given range. There is no guarantee that these accurately reflect the
1194 /// error state of the resource. The primary parameter to compute code actions
1195 /// is the provided range.
1196 std::vector<Diagnostic> diagnostics;
1197
1198 /// Requested kind of actions to return.
1199 ///
1200 /// Actions not of this kind are filtered out by the client before being
1201 /// shown. So servers can omit computing them.
1202 std::vector<std::string> only;
1203};
1204
1205/// Add support for JSON serialization.
1207 CodeActionContext &result,
1209
1210//===----------------------------------------------------------------------===//
1211// CodeActionParams
1212//===----------------------------------------------------------------------===//
1213
1215 /// The document in which the command was invoked.
1217
1218 /// The range for which the command was invoked.
1220
1221 /// Context carrying additional information.
1223};
1224
1225/// Add support for JSON serialization.
1227 CodeActionParams &result,
1229
1230//===----------------------------------------------------------------------===//
1231// WorkspaceEdit
1232//===----------------------------------------------------------------------===//
1233
1235 /// Holds changes to existing resources.
1236 std::map<std::string, std::vector<TextEdit>> changes;
1237
1238 /// Note: "documentChanges" is not currently used because currently there is
1239 /// no support for versioned edits.
1240};
1241
1242/// Add support for JSON serialization.
1246
1247//===----------------------------------------------------------------------===//
1248// CodeAction
1249//===----------------------------------------------------------------------===//
1250
1251/// A code action represents a change that can be performed in code, e.g. to fix
1252/// a problem or to refactor code.
1253///
1254/// A CodeAction must set either `edit` and/or a `command`. If both are
1255/// supplied, the `edit` is applied first, then the `command` is executed.
1257 /// A short, human-readable, title for this code action.
1258 std::string title;
1259
1260 /// The kind of the code action.
1261 /// Used to filter code actions.
1262 std::optional<std::string> kind;
1266
1267 /// The diagnostics that this code action resolves.
1268 std::optional<std::vector<Diagnostic>> diagnostics;
1269
1270 /// Marks this as a preferred action. Preferred actions are used by the
1271 /// `auto fix` command and can be targeted by keybindings.
1272 /// A quick fix should be marked preferred if it properly addresses the
1273 /// underlying error. A refactoring should be marked preferred if it is the
1274 /// most reasonable choice of actions to take.
1275 bool isPreferred = false;
1276
1277 /// The workspace edit this code action performs.
1278 std::optional<WorkspaceEdit> edit;
1279};
1280
1281/// Add support for JSON serialization.
1283
1284//===----------------------------------------------------------------------===//
1285// ShowMessageParams
1286//===----------------------------------------------------------------------===//
1287
1288enum class MessageType { Error = 1, Warning = 2, Info = 3, Log = 4, Debug = 5 };
1289
1291 /// A short title like 'Retry', 'Open Log' etc.
1292 std::string title;
1293};
1294
1296 ShowMessageParams(MessageType Type, std::string Message)
1297 : type(Type), message(Message) {}
1299 /// The actual message.
1300 std::string message;
1301 /// The message action items to present.
1302 std::optional<std::vector<MessageActionItem>> actions;
1303};
1304
1305/// Add support for JSON serialization.
1307
1308/// Add support for JSON serialization.
1310
1311} // namespace lsp
1312} // namespace llvm
1313
1314namespace llvm {
1315template <> struct format_provider<llvm::lsp::Position> {
1316 static void format(const llvm::lsp::Position &pos, raw_ostream &os,
1317 StringRef style) {
1318 assert(style.empty() && "style modifiers for this type are not supported");
1319 os << pos;
1320 }
1321};
1322} // namespace llvm
1323
1324#endif
1325
1326// NOLINTEND(readability-identifier-naming)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#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))
ArrayRef - 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:148
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:864
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
constexpr bool empty() const
empty - Check if the string is empty.
Definition StringRef.h:143
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:665
A Value is an JSON value of unknown type.
Definition JSON.h:291
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 void registerSupportedScheme(StringRef scheme)
Register a supported URI scheme.
Definition Protocol.cpp:234
static 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::Expected< URIForFile > fromURI(StringRef uri)
Try to build a URIForFile from the given URI string.
Definition Protocol.cpp:216
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:839
MarkupKind
Describes the content type that a client supports in various result literals like Hover.
Definition Protocol.h:554
LLVM_ABI_FOR_TEST llvm::json::Value toJSON(const URIForFile &value)
Add support for JSON serialization.
Definition Protocol.cpp:253
CompletionTriggerKind
Definition Protocol.h:954
@ Invoked
Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e....
Definition Protocol.h:957
@ TriggerTriggerForIncompleteCompletions
Completion was re-triggered as the current completion list is incomplete.
Definition Protocol.h:964
@ TriggerCharacter
Completion was triggered by a trigger character specified by the triggerCharacters properties of the ...
Definition Protocol.h:961
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
bool operator<(const CompletionItem &lhs, const CompletionItem &rhs)
Definition Protocol.cpp:827
bool operator==(const TextEdit &lhs, const TextEdit &rhs)
Definition Protocol.h:793
NoParams InitializedParams
Definition Protocol.h:233
raw_ostream & operator<<(raw_ostream &os, const URIForFile &value)
Definition Protocol.cpp:257
CompletionItemKind adjustKindToCapability(CompletionItemKind kind, CompletionItemKindBitset &supportedCompletionItemKinds)
Definition Protocol.cpp:754
InlayHintKind
Inlay hint kinds.
Definition Protocol.h:1127
@ Parameter
An inlay hint that is for a parameter.
Definition Protocol.h:1140
@ Type
An inlay hint that for a type annotation.
Definition Protocol.h:1133
DiagnosticSeverity
Definition Protocol.h:705
@ Undetermined
It is up to the client to interpret diagnostics as error, warning, info or hint.
Definition Protocol.h:708
InsertTextFormat
Defines whether the insert text in a completion item should be interpreted as plain text or a snippet...
Definition Protocol.h:858
std::bitset< kCompletionItemKindMax+1 > CompletionItemKindBitset
Definition Protocol.h:843
constexpr auto kCompletionItemKindMax
Definition Protocol.h:841
CompletionItemKind
The kind of a completion entry.
Definition Protocol.h:807
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.
Definition Types.h:26
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:1915
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:870
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:1316
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:1196
std::vector< std::string > only
Requested kind of actions to return.
Definition Protocol.h:1202
CodeActionContext context
Context carrying additional information.
Definition Protocol.h:1222
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Definition Protocol.h:1216
Range range
The range for which the command was invoked.
Definition Protocol.h:1219
A code action represents a change that can be performed in code, e.g.
Definition Protocol.h:1256
std::optional< std::string > kind
The kind of the code action.
Definition Protocol.h:1262
static const llvm::StringLiteral kRefactor
Definition Protocol.h:1264
static const llvm::StringLiteral kInfo
Definition Protocol.h:1265
bool isPreferred
Marks this as a preferred action.
Definition Protocol.h:1275
static const llvm::StringLiteral kQuickFix
Definition Protocol.h:1263
std::optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
Definition Protocol.h:1268
std::optional< WorkspaceEdit > edit
The workspace edit this code action performs.
Definition Protocol.h:1278
std::string title
A short, human-readable, title for this code action.
Definition Protocol.h:1258
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
Definition Protocol.h:973
CompletionTriggerKind triggerKind
How the completion was triggered.
Definition Protocol.h:969
CompletionItem(const Twine &label, CompletionItemKind kind, StringRef sortText="")
Definition Protocol.h:876
std::string filterText
A string that should be used when filtering a set of completion items.
Definition Protocol.h:902
std::string insertText
A string that should be inserted to a document when selecting this completion.
Definition Protocol.h:906
bool deprecated
Indicates if this item is deprecated.
Definition Protocol.h:925
std::optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
Definition Protocol.h:917
std::vector< TextEdit > additionalTextEdits
An optional array of additional text edits that are applied when selecting this completion.
Definition Protocol.h:922
CompletionItemKind kind
The kind of this completion item.
Definition Protocol.h:887
InsertTextFormat insertTextFormat
The format of the insert text.
Definition Protocol.h:910
std::string label
The label of this completion item.
Definition Protocol.h:883
std::optional< MarkupContent > documentation
A human-readable string that represents a doc-comment.
Definition Protocol.h:894
std::string sortText
A string that should be used when comparing this item with other items.
Definition Protocol.h:898
Represents a collection of completion items to be presented in the editor.
Definition Protocol.h:938
bool isIncomplete
The list is not complete.
Definition Protocol.h:941
std::vector< CompletionItem > items
The completion items.
Definition Protocol.h:944
CompletionContext context
Definition Protocol.h:986
Represents a related message and source code location for a diagnostic.
Definition Protocol.h:683
DiagnosticRelatedInformation(Location location, std::string message)
Definition Protocol.h:685
std::string message
The message of this related diagnostic information.
Definition Protocol.h:691
Location location
The location of this related diagnostic information.
Definition Protocol.h:689
std::vector< DiagnosticTag > tags
Additional metadata about the diagnostic.
Definition Protocol.h:745
std::string message
The diagnostic's message.
Definition Protocol.h:738
Range range
The source range where the message applies.
Definition Protocol.h:727
std::optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
An array of related diagnostic information, e.g.
Definition Protocol.h:742
std::string source
A human-readable string describing the source of this diagnostic, e.g.
Definition Protocol.h:735
DiagnosticSeverity severity
The diagnostic's severity.
Definition Protocol.h:731
std::optional< std::string > category
The diagnostic's category.
Definition Protocol.h:751
VersionedTextDocumentIdentifier textDocument
The document that changed.
Definition Protocol.h:537
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
Definition Protocol.h:540
TextDocumentIdentifier textDocument
The document that was closed.
Definition Protocol.h:489
TextDocumentItem textDocument
The document that was opened.
Definition Protocol.h:475
TextDocumentIdentifier textDocument
The document that was saved.
Definition Protocol.h:503
Parameters for the document link request.
Definition Protocol.h:1058
TextDocumentIdentifier textDocument
The document to provide document links for.
Definition Protocol.h:1060
TextDocumentIdentifier textDocument
Definition Protocol.h:668
Represents programming constructs like variables, classes, interfaces etc.
Definition Protocol.h:628
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else like co...
Definition Protocol.h:649
SymbolKind kind
The kind of this symbol.
Definition Protocol.h:643
DocumentSymbol(const Twine &name, SymbolKind kind, Range range, Range selectionRange)
Definition Protocol.h:631
std::string name
The name of this symbol.
Definition Protocol.h:637
DocumentSymbol(DocumentSymbol &&)=default
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Definition Protocol.h:656
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition Protocol.h:653
std::optional< Range > range
An optional range is a range inside a text document that is used to visualize a hover,...
Definition Protocol.h:581
Hover(Range range)
Construct a default hover with the given range that uses Markdown content.
Definition Protocol.h:574
MarkupContent contents
The hover's content.
Definition Protocol.h:577
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
Inlay hint information.
Definition Protocol.h:1148
bool paddingRight
Render padding after the hint.
Definition Protocol.h:1176
InlayHint(InlayHintKind kind, Position pos)
Definition Protocol.h:1149
bool paddingLeft
Render padding before the hint.
Definition Protocol.h:1169
InlayHintKind kind
The kind of this hint.
Definition Protocol.h:1162
std::string label
The label of this hint.
Definition Protocol.h:1158
Position position
The position of this hint.
Definition Protocol.h:1152
A parameter literal used in inlay hint requests.
Definition Protocol.h:1109
Range range
The visible document range for which inlay hints should be computed.
Definition Protocol.h:1114
TextDocumentIdentifier textDocument
The text document.
Definition Protocol.h:1111
Location(const URIForFile &uri, Range range)
Definition Protocol.h:401
friend bool operator<(const Location &lhs, const Location &rhs)
Definition Protocol.h:419
friend bool operator!=(const Location &lhs, const Location &rhs)
Definition Protocol.h:415
URIForFile uri
The text document's URI.
Definition Protocol.h:408
Location(const URIForFile &uri, llvm::SourceMgr &mgr, SMRange range)
Construct a Location from the given source range.
Definition Protocol.h:404
friend bool operator==(const Location &lhs, const Location &rhs)
Definition Protocol.h:411
std::string title
A short title like 'Retry', 'Open Log' etc.
Definition Protocol.h:1292
A single parameter of a particular signature.
Definition Protocol.h:999
std::optional< std::pair< unsigned, unsigned > > labelOffsets
Inclusive start and exclusive end offsets withing the containing signature label.
Definition Protocol.h:1005
std::string documentation
The documentation of this parameter. Optional.
Definition Protocol.h:1008
std::string labelString
The label of this parameter. Ignored when labelOffsets is set.
Definition Protocol.h:1001
Position(llvm::SourceMgr &mgr, SMLoc loc)
Construct a position from the given source location.
Definition Protocol.h:300
int line
Line position in a document (zero-based).
Definition Protocol.h:307
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:330
friend bool operator==(const Position &lhs, const Position &rhs)
Definition Protocol.h:312
Position(int line=0, int character=0)
Definition Protocol.h:296
int character
Character offset on a line in a document (zero-based).
Definition Protocol.h:310
friend bool operator<(const Position &lhs, const Position &rhs)
Definition Protocol.h:319
friend bool operator<=(const Position &lhs, const Position &rhs)
Definition Protocol.h:323
friend bool operator!=(const Position &lhs, const Position &rhs)
Definition Protocol.h:316
URIForFile uri
The URI for which diagnostic information is reported.
Definition Protocol.h:768
PublishDiagnosticsParams(URIForFile uri, int64_t version)
Definition Protocol.h:764
int64_t version
The version number of the document the diagnostics are published for.
Definition Protocol.h:772
std::vector< Diagnostic > diagnostics
The list of reported diagnostics.
Definition Protocol.h:770
bool contains(Position pos) const
Definition Protocol.h:371
friend bool operator!=(const Range &lhs, const Range &rhs)
Definition Protocol.h:364
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:378
friend bool operator<(const Range &lhs, const Range &rhs)
Definition Protocol.h:367
bool contains(Range range) const
Definition Protocol.h:372
Position end
The range's end position.
Definition Protocol.h:359
Position start
The range's start position.
Definition Protocol.h:356
Range(llvm::SourceMgr &mgr, SMRange range)
Construct a range from the given source range.
Definition Protocol.h:352
Range(Position start, Position end)
Definition Protocol.h:348
friend bool operator==(const Range &lhs, const Range &rhs)
Definition Protocol.h:361
Range(Position loc)
Definition Protocol.h:349
bool includeDeclaration
Include the declaration of the current symbol.
Definition Protocol.h:453
ReferenceContext context
Definition Protocol.h:462
ShowMessageParams(MessageType Type, std::string Message)
Definition Protocol.h:1296
std::string message
The actual message.
Definition Protocol.h:1300
std::optional< std::vector< MessageActionItem > > actions
The message action items to present.
Definition Protocol.h:1302
Represents the signature of a callable.
Definition Protocol.h:1039
std::vector< SignatureInformation > signatures
The resulting signatures.
Definition Protocol.h:1041
int activeParameter
The active parameter of the active signature.
Definition Protocol.h:1047
int activeSignature
The active signature.
Definition Protocol.h:1044
Represents the signature of something callable.
Definition Protocol.h:1019
std::vector< ParameterInformation > parameters
The parameters of this signature.
Definition Protocol.h:1027
std::string label
The label of this signature. Mandatory.
Definition Protocol.h:1021
std::string documentation
The documentation of this signature. Optional.
Definition Protocol.h:1024
std::optional< Range > range
The range of the document that changed.
Definition Protocol.h:521
std::optional< int > rangeLength
The length of the range that got replaced.
Definition Protocol.h:524
LogicalResult applyTo(std::string &contents) const
Try to apply this change to the given contents string.
Definition Protocol.cpp:520
std::string text
The new text of the range/document.
Definition Protocol.h:527
URIForFile uri
The text document's URI.
Definition Protocol.h:264
std::string languageId
The text document's language identifier.
Definition Protocol.h:244
URIForFile uri
The text document's URI.
Definition Protocol.h:241
int64_t version
The version number of this document.
Definition Protocol.h:250
std::string text
The content of the opened text document.
Definition Protocol.h:247
Position position
The position inside the text document.
Definition Protocol.h:439
TextDocumentIdentifier textDocument
The text document.
Definition Protocol.h:436
Range range
The range of the text document to be manipulated.
Definition Protocol.h:786
std::string newText
The string to be inserted.
Definition Protocol.h:790
URIForFile uri
The text document's URI.
Definition Protocol.h:279
int64_t version
The version number of this document.
Definition Protocol.h:281
std::map< std::string, std::vector< TextEdit > > changes
Holds changes to existing resources.
Definition Protocol.h:1236