LLVM 22.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
26#include "llvm/Support/JSON.h"
30#include <bitset>
31#include <optional>
32#include <string>
33#include <utility>
34
35// This file is using the LSP syntax for identifier names which is different
36// from the LLVM coding standard. To avoid the clang-tidy warnings, we're
37// disabling one check here.
38// NOLINTBEGIN(readability-identifier-naming)
39
40namespace llvm {
41namespace lsp {
42
43enum class ErrorCode {
44 // Defined by JSON RPC.
45 ParseError = -32700,
48 InvalidParams = -32602,
49 InternalError = -32603,
50
53
54 // Defined by the protocol.
57 RequestFailed = -32803,
58};
59
60/// Defines how the host (editor) should sync document changes to the language
61/// server.
63 /// Documents should not be synced at all.
64 None = 0,
65
66 /// Documents are synced by always sending the full content of the document.
67 Full = 1,
68
69 /// Documents are synced by sending the full content on open. After that only
70 /// incremental updates to the document are sent.
72};
73
74//===----------------------------------------------------------------------===//
75// LSPError
76//===----------------------------------------------------------------------===//
77
78/// This class models an LSP error as an llvm::Error.
79class LSPError : public llvm::ErrorInfo<LSPError> {
80public:
81 std::string message;
83 static char ID;
84
87
88 void log(raw_ostream &os) const override {
89 os << int(code) << ": " << message;
90 }
91 std::error_code convertToErrorCode() const override {
93 }
94};
95
96//===----------------------------------------------------------------------===//
97// URIForFile
98//===----------------------------------------------------------------------===//
99
100/// URI in "file" scheme for a file.
102public:
103 URIForFile() = default;
104
105 /// Try to build a URIForFile from the given URI string.
107
108 /// Try to build a URIForFile from the given absolute file path and optional
109 /// scheme.
110 static llvm::Expected<URIForFile> fromFile(StringRef absoluteFilepath,
111 StringRef scheme = "file");
112
113 /// Returns the absolute path to the file.
114 StringRef file() const { return filePath; }
115
116 /// Returns the original uri of the file.
117 StringRef uri() const { return uriStr; }
118
119 /// Return the scheme of the uri.
120 StringRef scheme() const;
121
122 explicit operator bool() const { return !filePath.empty(); }
123
124 friend bool operator==(const URIForFile &lhs, const URIForFile &rhs) {
125 return lhs.filePath == rhs.filePath;
126 }
127 friend bool operator!=(const URIForFile &lhs, const URIForFile &rhs) {
128 return !(lhs == rhs);
129 }
130 friend bool operator<(const URIForFile &lhs, const URIForFile &rhs) {
131 return lhs.filePath < rhs.filePath;
132 }
133
134 /// Register a supported URI scheme. The protocol supports `file` by default,
135 /// so this is only necessary for any additional schemes that a server wants
136 /// to support.
138
139private:
140 explicit URIForFile(std::string &&filePath, std::string &&uriStr)
141 : filePath(std::move(filePath)), uriStr(uriStr) {}
142
143 std::string filePath;
144 std::string uriStr;
145};
146
147/// Add support for JSON serialization.
148llvm::json::Value toJSON(const URIForFile &value);
149bool fromJSON(const llvm::json::Value &value, URIForFile &result,
150 llvm::json::Path path);
151raw_ostream &operator<<(raw_ostream &os, const URIForFile &value);
152
153//===----------------------------------------------------------------------===//
154// ClientCapabilities
155//===----------------------------------------------------------------------===//
156
158 /// Client supports hierarchical document symbols.
159 /// textDocument.documentSymbol.hierarchicalDocumentSymbolSupport
161
162 /// Client supports CodeAction return value for textDocument/codeAction.
163 /// textDocument.codeAction.codeActionLiteralSupport.
165
166 /// Client supports server-initiated progress via the
167 /// window/workDoneProgress/create method.
168 ///
169 /// window.workDoneProgress
170 bool workDoneProgress = false;
171};
172
173/// Add support for JSON serialization.
174bool fromJSON(const llvm::json::Value &value, ClientCapabilities &result,
176
177//===----------------------------------------------------------------------===//
178// ClientInfo
179//===----------------------------------------------------------------------===//
180
182 /// The name of the client as defined by the client.
183 std::string name;
184
185 /// The client's version as defined by the client.
186 std::optional<std::string> version;
187};
188
189/// Add support for JSON serialization.
190bool fromJSON(const llvm::json::Value &value, ClientInfo &result,
192
193//===----------------------------------------------------------------------===//
194// InitializeParams
195//===----------------------------------------------------------------------===//
196
197enum class TraceLevel {
198 Off = 0,
201};
202
203/// Add support for JSON serialization.
204bool fromJSON(const llvm::json::Value &value, TraceLevel &result,
206
208 /// The capabilities provided by the client (editor or tool).
210
211 /// Information about the client.
212 std::optional<ClientInfo> clientInfo;
213
214 /// The initial trace setting. If omitted trace is disabled ('off').
215 std::optional<TraceLevel> trace;
216};
217
218/// Add support for JSON serialization.
219bool fromJSON(const llvm::json::Value &value, InitializeParams &result,
221
222//===----------------------------------------------------------------------===//
223// InitializedParams
224//===----------------------------------------------------------------------===//
225
226struct NoParams {};
228 return true;
229}
231
232//===----------------------------------------------------------------------===//
233// TextDocumentItem
234//===----------------------------------------------------------------------===//
235
237 /// The text document's URI.
239
240 /// The text document's language identifier.
241 std::string languageId;
242
243 /// The content of the opened text document.
244 std::string text;
245
246 /// The version number of this document.
247 int64_t version;
248};
249
250/// Add support for JSON serialization.
251bool fromJSON(const llvm::json::Value &value, TextDocumentItem &result,
253
254//===----------------------------------------------------------------------===//
255// TextDocumentIdentifier
256//===----------------------------------------------------------------------===//
257
259 /// The text document's URI.
261};
262
263/// Add support for JSON serialization.
265bool fromJSON(const llvm::json::Value &value, TextDocumentIdentifier &result,
267
268//===----------------------------------------------------------------------===//
269// VersionedTextDocumentIdentifier
270//===----------------------------------------------------------------------===//
271
273 /// The text document's URI.
275 /// The version number of this document.
276 int64_t version;
277};
278
279/// Add support for JSON serialization.
281bool fromJSON(const llvm::json::Value &value,
283
284//===----------------------------------------------------------------------===//
285// Position
286//===----------------------------------------------------------------------===//
287
288struct Position {
289 Position(int line = 0, int character = 0)
291
292 /// Construct a position from the given source location.
294 std::pair<unsigned, unsigned> lineAndCol = mgr.getLineAndColumn(loc);
295 line = lineAndCol.first - 1;
296 character = lineAndCol.second - 1;
297 }
298
299 /// Line position in a document (zero-based).
300 int line = 0;
301
302 /// Character offset on a line in a document (zero-based).
303 int character = 0;
304
305 friend bool operator==(const Position &lhs, const Position &rhs) {
306 return std::tie(lhs.line, lhs.character) ==
307 std::tie(rhs.line, rhs.character);
308 }
309 friend bool operator!=(const Position &lhs, const Position &rhs) {
310 return !(lhs == rhs);
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 std::tie(lhs.line, lhs.character) <=
318 std::tie(rhs.line, rhs.character);
319 }
320
321 /// Convert this position into a source location in the main file of the given
322 /// source manager.
324 return mgr.FindLocForLineAndColumn(mgr.getMainFileID(), line + 1,
325 character + 1);
326 }
327};
328
329/// Add support for JSON serialization.
330bool fromJSON(const llvm::json::Value &value, Position &result,
332llvm::json::Value toJSON(const Position &value);
333raw_ostream &operator<<(raw_ostream &os, const Position &value);
334
335//===----------------------------------------------------------------------===//
336// Range
337//===----------------------------------------------------------------------===//
338
339struct Range {
340 Range() = default;
342 Range(Position loc) : Range(loc, loc) {}
343
344 /// Construct a range from the given source range.
346 : Range(Position(mgr, range.Start), Position(mgr, range.End)) {}
347
348 /// The range's start position.
350
351 /// The range's end position.
353
354 friend bool operator==(const Range &lhs, const Range &rhs) {
355 return std::tie(lhs.start, lhs.end) == std::tie(rhs.start, rhs.end);
356 }
357 friend bool operator!=(const Range &lhs, const Range &rhs) {
358 return !(lhs == rhs);
359 }
360 friend bool operator<(const Range &lhs, const Range &rhs) {
361 return std::tie(lhs.start, lhs.end) < std::tie(rhs.start, rhs.end);
362 }
363
364 bool contains(Position pos) const { return start <= pos && pos < end; }
365 bool contains(Range range) const {
366 return start <= range.start && range.end <= end;
367 }
368
369 /// Convert this range into a source range in the main file of the given
370 /// source manager.
372 SMLoc startLoc = start.getAsSMLoc(mgr);
373 SMLoc endLoc = end.getAsSMLoc(mgr);
374 // Check that the start and end locations are valid.
375 if (!startLoc.isValid() || !endLoc.isValid() ||
376 startLoc.getPointer() > endLoc.getPointer())
377 return SMRange();
378 return SMRange(startLoc, endLoc);
379 }
380};
381
382/// Add support for JSON serialization.
383bool fromJSON(const llvm::json::Value &value, Range &result,
385llvm::json::Value toJSON(const Range &value);
386raw_ostream &operator<<(raw_ostream &os, const Range &value);
387
388//===----------------------------------------------------------------------===//
389// Location
390//===----------------------------------------------------------------------===//
391
392struct Location {
393 Location() = default;
395
396 /// Construct a Location from the given source range.
399
400 /// The text document's URI.
403
404 friend bool operator==(const Location &lhs, const Location &rhs) {
405 return lhs.uri == rhs.uri && lhs.range == rhs.range;
406 }
407
408 friend bool operator!=(const Location &lhs, const Location &rhs) {
409 return !(lhs == rhs);
410 }
411
412 friend bool operator<(const Location &lhs, const Location &rhs) {
413 return std::tie(lhs.uri, lhs.range) < std::tie(rhs.uri, rhs.range);
414 }
415};
416
417/// Add support for JSON serialization.
418bool fromJSON(const llvm::json::Value &value, Location &result,
420llvm::json::Value toJSON(const Location &value);
421raw_ostream &operator<<(raw_ostream &os, const Location &value);
422
423//===----------------------------------------------------------------------===//
424// TextDocumentPositionParams
425//===----------------------------------------------------------------------===//
426
428 /// The text document.
430
431 /// The position inside the text document.
433};
434
435/// Add support for JSON serialization.
436bool fromJSON(const llvm::json::Value &value,
438
439//===----------------------------------------------------------------------===//
440// ReferenceParams
441//===----------------------------------------------------------------------===//
442
444 /// Include the declaration of the current symbol.
445 bool includeDeclaration = false;
446};
447
448/// Add support for JSON serialization.
449bool fromJSON(const llvm::json::Value &value, ReferenceContext &result,
451
455
456/// Add support for JSON serialization.
457bool fromJSON(const llvm::json::Value &value, ReferenceParams &result,
459
460//===----------------------------------------------------------------------===//
461// DidOpenTextDocumentParams
462//===----------------------------------------------------------------------===//
463
465 /// The document that was opened.
467};
468
469/// Add support for JSON serialization.
470bool fromJSON(const llvm::json::Value &value, DidOpenTextDocumentParams &result,
472
473//===----------------------------------------------------------------------===//
474// DidCloseTextDocumentParams
475//===----------------------------------------------------------------------===//
476
478 /// The document that was closed.
480};
481
482/// Add support for JSON serialization.
483bool fromJSON(const llvm::json::Value &value,
485
486//===----------------------------------------------------------------------===//
487// DidChangeTextDocumentParams
488//===----------------------------------------------------------------------===//
489
491 /// Try to apply this change to the given contents string.
492 LogicalResult applyTo(std::string &contents) const;
493 /// Try to apply a set of changes to the given contents string.
495 std::string &contents);
496
497 /// The range of the document that changed.
498 std::optional<Range> range;
499
500 /// The length of the range that got replaced.
501 std::optional<int> rangeLength;
502
503 /// The new text of the range/document.
504 std::string text;
505};
506
507/// Add support for JSON serialization.
508bool fromJSON(const llvm::json::Value &value,
510
512 /// The document that changed.
514
515 /// The actual content changes.
516 std::vector<TextDocumentContentChangeEvent> contentChanges;
517};
518
519/// Add support for JSON serialization.
520bool fromJSON(const llvm::json::Value &value,
522
523//===----------------------------------------------------------------------===//
524// MarkupContent
525//===----------------------------------------------------------------------===//
526
527/// Describes the content type that a client supports in various result literals
528/// like `Hover`.
533raw_ostream &operator<<(raw_ostream &os, MarkupKind kind);
534
539
540/// Add support for JSON serialization.
542
543//===----------------------------------------------------------------------===//
544// Hover
545//===----------------------------------------------------------------------===//
546
547struct Hover {
548 /// Construct a default hover with the given range that uses Markdown content.
550
551 /// The hover's content.
553
554 /// An optional range is a range inside a text document that is used to
555 /// visualize a hover, e.g. by changing the background color.
556 std::optional<Range> range;
557};
558
559/// Add support for JSON serialization.
560llvm::json::Value toJSON(const Hover &hover);
561
562//===----------------------------------------------------------------------===//
563// SymbolKind
564//===----------------------------------------------------------------------===//
565
594
595//===----------------------------------------------------------------------===//
596// DocumentSymbol
597//===----------------------------------------------------------------------===//
598
599/// Represents programming constructs like variables, classes, interfaces etc.
600/// that appear in a document. Document symbols can be hierarchical and they
601/// have two ranges: one that encloses its definition and one that points to its
602/// most interesting range, e.g. the range of an identifier.
604 DocumentSymbol() = default;
610
611 /// The name of this symbol.
612 std::string name;
613
614 /// More detail for this symbol, e.g the signature of a function.
615 std::string detail;
616
617 /// The kind of this symbol.
619
620 /// The range enclosing this symbol not including leading/trailing whitespace
621 /// but everything else like comments. This information is typically used to
622 /// determine if the clients cursor is inside the symbol to reveal in the
623 /// symbol in the UI.
625
626 /// The range that should be selected and revealed when this symbol is being
627 /// picked, e.g the name of a function. Must be contained by the `range`.
629
630 /// Children of this symbol, e.g. properties of a class.
631 std::vector<DocumentSymbol> children;
632};
633
634/// Add support for JSON serialization.
636
637//===----------------------------------------------------------------------===//
638// DocumentSymbolParams
639//===----------------------------------------------------------------------===//
640
642 // The text document to find symbols in.
644};
645
646/// Add support for JSON serialization.
647bool fromJSON(const llvm::json::Value &value, DocumentSymbolParams &result,
649
650//===----------------------------------------------------------------------===//
651// DiagnosticRelatedInformation
652//===----------------------------------------------------------------------===//
653
654/// Represents a related message and source code location for a diagnostic.
655/// This should be used to point to code locations that cause or related to a
656/// diagnostics, e.g. when duplicating a symbol in a scope.
661
662 /// The location of this related diagnostic information.
664 /// The message of this related diagnostic information.
665 std::string message;
666};
667
668/// Add support for JSON serialization.
669bool fromJSON(const llvm::json::Value &value,
672
673//===----------------------------------------------------------------------===//
674// Diagnostic
675//===----------------------------------------------------------------------===//
676
678 /// It is up to the client to interpret diagnostics as error, warning, info or
679 /// hint.
681 Error = 1,
685};
686
687enum class DiagnosticTag {
690};
691
692/// Add support for JSON serialization.
694bool fromJSON(const llvm::json::Value &value, DiagnosticTag &result,
696
698 /// The source range where the message applies.
700
701 /// The diagnostic's severity. Can be omitted. If omitted it is up to the
702 /// client to interpret diagnostics as error, warning, info or hint.
704
705 /// A human-readable string describing the source of this diagnostic, e.g.
706 /// 'typescript' or 'super lint'.
707 std::string source;
708
709 /// The diagnostic's message.
710 std::string message;
711
712 /// An array of related diagnostic information, e.g. when symbol-names within
713 /// a scope collide all definitions can be marked via this property.
714 std::optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
715
716 /// Additional metadata about the diagnostic.
717 std::vector<DiagnosticTag> tags;
718
719 /// The diagnostic's category. Can be omitted.
720 /// An LSP extension that's used to send the name of the category over to the
721 /// client. The category typically describes the compilation stage during
722 /// which the issue was produced, e.g. "Semantic Issue" or "Parse Issue".
723 std::optional<std::string> category;
724};
725
726/// Add support for JSON serialization.
728bool fromJSON(const llvm::json::Value &value, Diagnostic &result,
730
731//===----------------------------------------------------------------------===//
732// PublishDiagnosticsParams
733//===----------------------------------------------------------------------===//
734
738
739 /// The URI for which diagnostic information is reported.
741 /// The list of reported diagnostics.
742 std::vector<Diagnostic> diagnostics;
743 /// The version number of the document the diagnostics are published for.
744 int64_t version;
745};
746
747/// Add support for JSON serialization.
749
750//===----------------------------------------------------------------------===//
751// TextEdit
752//===----------------------------------------------------------------------===//
753
754struct TextEdit {
755 /// The range of the text document to be manipulated. To insert
756 /// text into a document create a range where start === end.
758
759 /// The string to be inserted. For delete operations use an
760 /// empty string.
761 std::string newText;
762};
763
764inline bool operator==(const TextEdit &lhs, const TextEdit &rhs) {
765 return std::tie(lhs.newText, lhs.range) == std::tie(rhs.newText, rhs.range);
766}
767
768bool fromJSON(const llvm::json::Value &value, TextEdit &result,
770llvm::json::Value toJSON(const TextEdit &value);
771raw_ostream &operator<<(raw_ostream &os, const TextEdit &value);
772
773//===----------------------------------------------------------------------===//
774// CompletionItemKind
775//===----------------------------------------------------------------------===//
776
777/// The kind of a completion entry.
806bool fromJSON(const llvm::json::Value &value, CompletionItemKind &result,
808
810 static_cast<size_t>(CompletionItemKind::Text);
812 static_cast<size_t>(CompletionItemKind::TypeParameter);
813using CompletionItemKindBitset = std::bitset<kCompletionItemKindMax + 1>;
814bool fromJSON(const llvm::json::Value &value, CompletionItemKindBitset &result,
816
819 CompletionItemKindBitset &supportedCompletionItemKinds);
820
821//===----------------------------------------------------------------------===//
822// CompletionItem
823//===----------------------------------------------------------------------===//
824
825/// Defines whether the insert text in a completion item should be interpreted
826/// as plain text or a snippet.
829 /// The primary text to be inserted is treated as a plain string.
831 /// The primary text to be inserted is treated as a snippet.
832 ///
833 /// A snippet can define tab stops and placeholders with `$1`, `$2`
834 /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end
835 /// of the snippet. Placeholders with equal identifiers are linked, that is
836 /// typing in one will update others too.
837 ///
838 /// See also:
839 /// https//github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
841};
842
844 CompletionItem() = default;
849
850 /// The label of this completion item. By default also the text that is
851 /// inserted when selecting this completion.
852 std::string label;
853
854 /// The kind of this completion item. Based of the kind an icon is chosen by
855 /// the editor.
857
858 /// A human-readable string with additional information about this item, like
859 /// type or symbol information.
860 std::string detail;
861
862 /// A human-readable string that represents a doc-comment.
863 std::optional<MarkupContent> documentation;
864
865 /// A string that should be used when comparing this item with other items.
866 /// When `falsy` the label is used.
867 std::string sortText;
868
869 /// A string that should be used when filtering a set of completion items.
870 /// When `falsy` the label is used.
871 std::string filterText;
872
873 /// A string that should be inserted to a document when selecting this
874 /// completion. When `falsy` the label is used.
875 std::string insertText;
876
877 /// The format of the insert text. The format applies to both the `insertText`
878 /// property and the `newText` property of a provided `textEdit`.
880
881 /// An edit which is applied to a document when selecting this completion.
882 /// When an edit is provided `insertText` is ignored.
883 ///
884 /// Note: The range of the edit must be a single line range and it must
885 /// contain the position at which completion has been requested.
886 std::optional<TextEdit> textEdit;
887
888 /// An optional array of additional text edits that are applied when selecting
889 /// this completion. Edits must not overlap with the main edit nor with
890 /// themselves.
891 std::vector<TextEdit> additionalTextEdits;
892
893 /// Indicates if this item is deprecated.
894 bool deprecated = false;
895};
896
897/// Add support for JSON serialization.
900bool operator<(const CompletionItem &lhs, const CompletionItem &rhs);
901
902//===----------------------------------------------------------------------===//
903// CompletionList
904//===----------------------------------------------------------------------===//
905
906/// Represents a collection of completion items to be presented in the editor.
908 /// The list is not complete. Further typing should result in recomputing the
909 /// list.
910 bool isIncomplete = false;
911
912 /// The completion items.
913 std::vector<CompletionItem> items;
914};
915
916/// Add support for JSON serialization.
918
919//===----------------------------------------------------------------------===//
920// CompletionContext
921//===----------------------------------------------------------------------===//
922
924 /// Completion was triggered by typing an identifier (24x7 code
925 /// complete), manual invocation (e.g Ctrl+Space) or via API.
927
928 /// Completion was triggered by a trigger character specified by
929 /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
931
932 /// Completion was re-triggered as the current completion list is incomplete.
934};
935
937 /// How the completion was triggered.
939
940 /// The trigger character (a single character) that has trigger code complete.
941 /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
942 std::string triggerCharacter;
943};
944
945/// Add support for JSON serialization.
946bool fromJSON(const llvm::json::Value &value, CompletionContext &result,
948
949//===----------------------------------------------------------------------===//
950// CompletionParams
951//===----------------------------------------------------------------------===//
952
956
957/// Add support for JSON serialization.
958bool fromJSON(const llvm::json::Value &value, CompletionParams &result,
960
961//===----------------------------------------------------------------------===//
962// ParameterInformation
963//===----------------------------------------------------------------------===//
964
965/// A single parameter of a particular signature.
967 /// The label of this parameter. Ignored when labelOffsets is set.
968 std::string labelString;
969
970 /// Inclusive start and exclusive end offsets withing the containing signature
971 /// label.
972 std::optional<std::pair<unsigned, unsigned>> labelOffsets;
973
974 /// The documentation of this parameter. Optional.
975 std::string documentation;
976};
977
978/// Add support for JSON serialization.
980
981//===----------------------------------------------------------------------===//
982// SignatureInformation
983//===----------------------------------------------------------------------===//
984
985/// Represents the signature of something callable.
987 /// The label of this signature. Mandatory.
988 std::string label;
989
990 /// The documentation of this signature. Optional.
991 std::string documentation;
992
993 /// The parameters of this signature.
994 std::vector<ParameterInformation> parameters;
995};
996
997/// Add support for JSON serialization.
1000
1001//===----------------------------------------------------------------------===//
1002// SignatureHelp
1003//===----------------------------------------------------------------------===//
1004
1005/// Represents the signature of a callable.
1007 /// The resulting signatures.
1008 std::vector<SignatureInformation> signatures;
1009
1010 /// The active signature.
1012
1013 /// The active parameter of the active signature.
1015};
1016
1017/// Add support for JSON serialization.
1019
1020//===----------------------------------------------------------------------===//
1021// DocumentLinkParams
1022//===----------------------------------------------------------------------===//
1023
1024/// Parameters for the document link request.
1026 /// The document to provide document links for.
1028};
1029
1030/// Add support for JSON serialization.
1031bool fromJSON(const llvm::json::Value &value, DocumentLinkParams &result,
1033
1034//===----------------------------------------------------------------------===//
1035// DocumentLink
1036//===----------------------------------------------------------------------===//
1037
1038/// A range in a text document that links to an internal or external resource,
1039/// like another text document or a web site.
1041 DocumentLink() = default;
1044
1045 /// The range this link applies to.
1047
1048 /// The uri this link points to. If missing a resolve request is sent later.
1050
1051 // TODO: The following optional fields defined by the language server protocol
1052 // are unsupported:
1053 //
1054 // data?: any - A data entry field that is preserved on a document link
1055 // between a DocumentLinkRequest and a
1056 // DocumentLinkResolveRequest.
1057
1058 friend bool operator==(const DocumentLink &lhs, const DocumentLink &rhs) {
1059 return lhs.range == rhs.range && lhs.target == rhs.target;
1060 }
1061
1062 friend bool operator!=(const DocumentLink &lhs, const DocumentLink &rhs) {
1063 return !(lhs == rhs);
1064 }
1065};
1066
1067/// Add support for JSON serialization.
1068llvm::json::Value toJSON(const DocumentLink &value);
1069
1070//===----------------------------------------------------------------------===//
1071// InlayHintsParams
1072//===----------------------------------------------------------------------===//
1073
1074/// A parameter literal used in inlay hint requests.
1076 /// The text document.
1078
1079 /// The visible document range for which inlay hints should be computed.
1081};
1082
1083/// Add support for JSON serialization.
1084bool fromJSON(const llvm::json::Value &value, InlayHintsParams &result,
1086
1087//===----------------------------------------------------------------------===//
1088// InlayHintKind
1089//===----------------------------------------------------------------------===//
1090
1091/// Inlay hint kinds.
1092enum class InlayHintKind {
1093 /// An inlay hint that for a type annotation.
1094 ///
1095 /// An example of a type hint is a hint in this position:
1096 /// auto var ^ = expr;
1097 /// which shows the deduced type of the variable.
1098 Type = 1,
1099
1100 /// An inlay hint that is for a parameter.
1101 ///
1102 /// An example of a parameter hint is a hint in this position:
1103 /// func(^arg);
1104 /// which shows the name of the corresponding parameter.
1106};
1107
1108//===----------------------------------------------------------------------===//
1109// InlayHint
1110//===----------------------------------------------------------------------===//
1111
1112/// Inlay hint information.
1115
1116 /// The position of this hint.
1118
1119 /// The label of this hint. A human readable string or an array of
1120 /// InlayHintLabelPart label parts.
1121 ///
1122 /// *Note* that neither the string nor the label part can be empty.
1123 std::string label;
1124
1125 /// The kind of this hint. Can be omitted in which case the client should fall
1126 /// back to a reasonable default.
1128
1129 /// Render padding before the hint.
1130 ///
1131 /// Note: Padding should use the editor's background color, not the
1132 /// background color of the hint itself. That means padding can be used
1133 /// to visually align/separate an inlay hint.
1134 bool paddingLeft = false;
1135
1136 /// Render padding after the hint.
1137 ///
1138 /// Note: Padding should use the editor's background color, not the
1139 /// background color of the hint itself. That means padding can be used
1140 /// to visually align/separate an inlay hint.
1141 bool paddingRight = false;
1142};
1143
1144/// Add support for JSON serialization.
1146bool operator==(const InlayHint &lhs, const InlayHint &rhs);
1147bool operator<(const InlayHint &lhs, const InlayHint &rhs);
1149
1150//===----------------------------------------------------------------------===//
1151// CodeActionContext
1152//===----------------------------------------------------------------------===//
1153
1155 /// An array of diagnostics known on the client side overlapping the range
1156 /// provided to the `textDocument/codeAction` request. They are provided so
1157 /// that the server knows which errors are currently presented to the user for
1158 /// the given range. There is no guarantee that these accurately reflect the
1159 /// error state of the resource. The primary parameter to compute code actions
1160 /// is the provided range.
1161 std::vector<Diagnostic> diagnostics;
1162
1163 /// Requested kind of actions to return.
1164 ///
1165 /// Actions not of this kind are filtered out by the client before being
1166 /// shown. So servers can omit computing them.
1167 std::vector<std::string> only;
1168};
1169
1170/// Add support for JSON serialization.
1171bool fromJSON(const llvm::json::Value &value, CodeActionContext &result,
1173
1174//===----------------------------------------------------------------------===//
1175// CodeActionParams
1176//===----------------------------------------------------------------------===//
1177
1179 /// The document in which the command was invoked.
1181
1182 /// The range for which the command was invoked.
1184
1185 /// Context carrying additional information.
1187};
1188
1189/// Add support for JSON serialization.
1190bool fromJSON(const llvm::json::Value &value, CodeActionParams &result,
1192
1193//===----------------------------------------------------------------------===//
1194// WorkspaceEdit
1195//===----------------------------------------------------------------------===//
1196
1198 /// Holds changes to existing resources.
1199 std::map<std::string, std::vector<TextEdit>> changes;
1200
1201 /// Note: "documentChanges" is not currently used because currently there is
1202 /// no support for versioned edits.
1203};
1204
1205/// Add support for JSON serialization.
1206bool fromJSON(const llvm::json::Value &value, WorkspaceEdit &result,
1209
1210//===----------------------------------------------------------------------===//
1211// CodeAction
1212//===----------------------------------------------------------------------===//
1213
1214/// A code action represents a change that can be performed in code, e.g. to fix
1215/// a problem or to refactor code.
1216///
1217/// A CodeAction must set either `edit` and/or a `command`. If both are
1218/// supplied, the `edit` is applied first, then the `command` is executed.
1220 /// A short, human-readable, title for this code action.
1221 std::string title;
1222
1223 /// The kind of the code action.
1224 /// Used to filter code actions.
1225 std::optional<std::string> kind;
1229
1230 /// The diagnostics that this code action resolves.
1231 std::optional<std::vector<Diagnostic>> diagnostics;
1232
1233 /// Marks this as a preferred action. Preferred actions are used by the
1234 /// `auto fix` command and can be targeted by keybindings.
1235 /// A quick fix should be marked preferred if it properly addresses the
1236 /// underlying error. A refactoring should be marked preferred if it is the
1237 /// most reasonable choice of actions to take.
1238 bool isPreferred = false;
1239
1240 /// The workspace edit this code action performs.
1241 std::optional<WorkspaceEdit> edit;
1242};
1243
1244/// Add support for JSON serialization.
1246
1247} // namespace lsp
1248} // namespace llvm
1249
1250namespace llvm {
1251template <> struct format_provider<llvm::lsp::Position> {
1252 static void format(const llvm::lsp::Position &pos, raw_ostream &os,
1253 StringRef style) {
1254 assert(style.empty() && "style modifiers for this type are not supported");
1255 os << pos;
1256 }
1257};
1258} // namespace llvm
1259
1260#endif
1261
1262// NOLINTEND(readability-identifier-naming)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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:41
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:23
constexpr const char * getPointer() const
Definition SMLoc.h:34
constexpr bool isValid() const
Definition SMLoc.h:29
Represents a range in source code.
Definition SMLoc.h:48
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:32
unsigned getMainFileID() const
Definition SourceMgr.h:133
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:862
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:151
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:666
A Value is an JSON value of unknown type.
Definition JSON.h:290
static char ID
Definition Protocol.h:83
void log(raw_ostream &os) const override
Print an error message to an output stream.
Definition Protocol.h:88
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
Definition Protocol.h:91
std::string message
Definition Protocol.h:81
LSPError(std::string message, ErrorCode code)
Definition Protocol.h:85
URI in "file" scheme for a file.
Definition Protocol.h:101
friend bool operator==(const URIForFile &lhs, const URIForFile &rhs)
Definition Protocol.h:124
static void registerSupportedScheme(StringRef scheme)
Register a supported URI scheme.
Definition Protocol.cpp:238
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:227
static llvm::Expected< URIForFile > fromURI(StringRef uri)
Try to build a URIForFile from the given URI string.
Definition Protocol.cpp:220
StringRef scheme() const
Return the scheme of the uri.
Definition Protocol.cpp:236
friend bool operator!=(const URIForFile &lhs, const URIForFile &rhs)
Definition Protocol.h:127
StringRef uri() const
Returns the original uri of the file.
Definition Protocol.h:117
friend bool operator<(const URIForFile &lhs, const URIForFile &rhs)
Definition Protocol.h:130
StringRef file() const
Returns the absolute path to the file.
Definition Protocol.h:114
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:809
MarkupKind
Describes the content type that a client supports in various result literals like Hover.
Definition Protocol.h:529
llvm::json::Value toJSON(const URIForFile &value)
Add support for JSON serialization.
Definition Protocol.cpp:257
CompletionTriggerKind
Definition Protocol.h:923
@ Invoked
Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e....
Definition Protocol.h:926
@ TriggerTriggerForIncompleteCompletions
Completion was re-triggered as the current completion list is incomplete.
Definition Protocol.h:933
@ TriggerCharacter
Completion was triggered by a trigger character specified by the triggerCharacters properties of the ...
Definition Protocol.h:930
TextDocumentSyncKind
Defines how the host (editor) should sync document changes to the language server.
Definition Protocol.h:62
@ Incremental
Documents are synced by sending the full content on open.
Definition Protocol.h:71
@ None
Documents should not be synced at all.
Definition Protocol.h:64
@ Full
Documents are synced by always sending the full content of the document.
Definition Protocol.h:67
bool operator<(const CompletionItem &lhs, const CompletionItem &rhs)
Definition Protocol.cpp:821
bool operator==(const TextEdit &lhs, const TextEdit &rhs)
Definition Protocol.h:764
NoParams InitializedParams
Definition Protocol.h:230
raw_ostream & operator<<(raw_ostream &os, const URIForFile &value)
Definition Protocol.cpp:261
CompletionItemKind adjustKindToCapability(CompletionItemKind kind, CompletionItemKindBitset &supportedCompletionItemKinds)
Definition Protocol.cpp:748
InlayHintKind
Inlay hint kinds.
Definition Protocol.h:1092
@ Parameter
An inlay hint that is for a parameter.
Definition Protocol.h:1105
@ Type
An inlay hint that for a type annotation.
Definition Protocol.h:1098
DiagnosticSeverity
Definition Protocol.h:677
@ Undetermined
It is up to the client to interpret diagnostics as error, warning, info or hint.
Definition Protocol.h:680
InsertTextFormat
Defines whether the insert text in a completion item should be interpreted as plain text or a snippet...
Definition Protocol.h:827
std::bitset< kCompletionItemKindMax+1 > CompletionItemKindBitset
Definition Protocol.h:813
constexpr auto kCompletionItemKindMax
Definition Protocol.h:811
CompletionItemKind
The kind of a completion entry.
Definition Protocol.h:778
bool fromJSON(const llvm::json::Value &value, URIForFile &result, llvm::json::Path path)
Definition Protocol.cpp:242
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:98
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:1849
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851
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:1252
bool hierarchicalDocumentSymbol
Client supports hierarchical document symbols.
Definition Protocol.h:160
bool workDoneProgress
Client supports server-initiated progress via the window/workDoneProgress/create method.
Definition Protocol.h:170
bool codeActionStructure
Client supports CodeAction return value for textDocument/codeAction.
Definition Protocol.h:164
std::string name
The name of the client as defined by the client.
Definition Protocol.h:183
std::optional< std::string > version
The client's version as defined by the client.
Definition Protocol.h:186
std::vector< Diagnostic > diagnostics
An array of diagnostics known on the client side overlapping the range provided to the textDocument/c...
Definition Protocol.h:1161
std::vector< std::string > only
Requested kind of actions to return.
Definition Protocol.h:1167
CodeActionContext context
Context carrying additional information.
Definition Protocol.h:1186
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Definition Protocol.h:1180
Range range
The range for which the command was invoked.
Definition Protocol.h:1183
A code action represents a change that can be performed in code, e.g.
Definition Protocol.h:1219
std::optional< std::string > kind
The kind of the code action.
Definition Protocol.h:1225
static const llvm::StringLiteral kRefactor
Definition Protocol.h:1227
static const llvm::StringLiteral kInfo
Definition Protocol.h:1228
bool isPreferred
Marks this as a preferred action.
Definition Protocol.h:1238
static const llvm::StringLiteral kQuickFix
Definition Protocol.h:1226
std::optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
Definition Protocol.h:1231
std::optional< WorkspaceEdit > edit
The workspace edit this code action performs.
Definition Protocol.h:1241
std::string title
A short, human-readable, title for this code action.
Definition Protocol.h:1221
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
Definition Protocol.h:942
CompletionTriggerKind triggerKind
How the completion was triggered.
Definition Protocol.h:938
CompletionItem(const Twine &label, CompletionItemKind kind, StringRef sortText="")
Definition Protocol.h:845
std::string filterText
A string that should be used when filtering a set of completion items.
Definition Protocol.h:871
std::string insertText
A string that should be inserted to a document when selecting this completion.
Definition Protocol.h:875
bool deprecated
Indicates if this item is deprecated.
Definition Protocol.h:894
std::optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
Definition Protocol.h:886
std::vector< TextEdit > additionalTextEdits
An optional array of additional text edits that are applied when selecting this completion.
Definition Protocol.h:891
CompletionItemKind kind
The kind of this completion item.
Definition Protocol.h:856
InsertTextFormat insertTextFormat
The format of the insert text.
Definition Protocol.h:879
std::string label
The label of this completion item.
Definition Protocol.h:852
std::optional< MarkupContent > documentation
A human-readable string that represents a doc-comment.
Definition Protocol.h:863
std::string sortText
A string that should be used when comparing this item with other items.
Definition Protocol.h:867
Represents a collection of completion items to be presented in the editor.
Definition Protocol.h:907
bool isIncomplete
The list is not complete.
Definition Protocol.h:910
std::vector< CompletionItem > items
The completion items.
Definition Protocol.h:913
CompletionContext context
Definition Protocol.h:954
Represents a related message and source code location for a diagnostic.
Definition Protocol.h:657
DiagnosticRelatedInformation(Location location, std::string message)
Definition Protocol.h:659
std::string message
The message of this related diagnostic information.
Definition Protocol.h:665
Location location
The location of this related diagnostic information.
Definition Protocol.h:663
std::vector< DiagnosticTag > tags
Additional metadata about the diagnostic.
Definition Protocol.h:717
std::string message
The diagnostic's message.
Definition Protocol.h:710
Range range
The source range where the message applies.
Definition Protocol.h:699
std::optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
An array of related diagnostic information, e.g.
Definition Protocol.h:714
std::string source
A human-readable string describing the source of this diagnostic, e.g.
Definition Protocol.h:707
DiagnosticSeverity severity
The diagnostic's severity.
Definition Protocol.h:703
std::optional< std::string > category
The diagnostic's category.
Definition Protocol.h:723
VersionedTextDocumentIdentifier textDocument
The document that changed.
Definition Protocol.h:513
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
Definition Protocol.h:516
TextDocumentIdentifier textDocument
The document that was closed.
Definition Protocol.h:479
TextDocumentItem textDocument
The document that was opened.
Definition Protocol.h:466
Parameters for the document link request.
Definition Protocol.h:1025
TextDocumentIdentifier textDocument
The document to provide document links for.
Definition Protocol.h:1027
TextDocumentIdentifier textDocument
Definition Protocol.h:643
Represents programming constructs like variables, classes, interfaces etc.
Definition Protocol.h:603
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else like co...
Definition Protocol.h:624
SymbolKind kind
The kind of this symbol.
Definition Protocol.h:618
DocumentSymbol(const Twine &name, SymbolKind kind, Range range, Range selectionRange)
Definition Protocol.h:606
std::string name
The name of this symbol.
Definition Protocol.h:612
DocumentSymbol(DocumentSymbol &&)=default
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Definition Protocol.h:631
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition Protocol.h:628
std::optional< Range > range
An optional range is a range inside a text document that is used to visualize a hover,...
Definition Protocol.h:556
Hover(Range range)
Construct a default hover with the given range that uses Markdown content.
Definition Protocol.h:549
MarkupContent contents
The hover's content.
Definition Protocol.h:552
std::optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
Definition Protocol.h:215
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool).
Definition Protocol.h:209
std::optional< ClientInfo > clientInfo
Information about the client.
Definition Protocol.h:212
Inlay hint information.
Definition Protocol.h:1113
bool paddingRight
Render padding after the hint.
Definition Protocol.h:1141
InlayHint(InlayHintKind kind, Position pos)
Definition Protocol.h:1114
bool paddingLeft
Render padding before the hint.
Definition Protocol.h:1134
InlayHintKind kind
The kind of this hint.
Definition Protocol.h:1127
std::string label
The label of this hint.
Definition Protocol.h:1123
Position position
The position of this hint.
Definition Protocol.h:1117
A parameter literal used in inlay hint requests.
Definition Protocol.h:1075
Range range
The visible document range for which inlay hints should be computed.
Definition Protocol.h:1080
TextDocumentIdentifier textDocument
The text document.
Definition Protocol.h:1077
Location(const URIForFile &uri, Range range)
Definition Protocol.h:394
friend bool operator<(const Location &lhs, const Location &rhs)
Definition Protocol.h:412
friend bool operator!=(const Location &lhs, const Location &rhs)
Definition Protocol.h:408
URIForFile uri
The text document's URI.
Definition Protocol.h:401
Location(const URIForFile &uri, llvm::SourceMgr &mgr, SMRange range)
Construct a Location from the given source range.
Definition Protocol.h:397
friend bool operator==(const Location &lhs, const Location &rhs)
Definition Protocol.h:404
A single parameter of a particular signature.
Definition Protocol.h:966
std::optional< std::pair< unsigned, unsigned > > labelOffsets
Inclusive start and exclusive end offsets withing the containing signature label.
Definition Protocol.h:972
std::string documentation
The documentation of this parameter. Optional.
Definition Protocol.h:975
std::string labelString
The label of this parameter. Ignored when labelOffsets is set.
Definition Protocol.h:968
Position(llvm::SourceMgr &mgr, SMLoc loc)
Construct a position from the given source location.
Definition Protocol.h:293
int line
Line position in a document (zero-based).
Definition Protocol.h:300
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:323
friend bool operator==(const Position &lhs, const Position &rhs)
Definition Protocol.h:305
Position(int line=0, int character=0)
Definition Protocol.h:289
int character
Character offset on a line in a document (zero-based).
Definition Protocol.h:303
friend bool operator<(const Position &lhs, const Position &rhs)
Definition Protocol.h:312
friend bool operator<=(const Position &lhs, const Position &rhs)
Definition Protocol.h:316
friend bool operator!=(const Position &lhs, const Position &rhs)
Definition Protocol.h:309
URIForFile uri
The URI for which diagnostic information is reported.
Definition Protocol.h:740
PublishDiagnosticsParams(URIForFile uri, int64_t version)
Definition Protocol.h:736
int64_t version
The version number of the document the diagnostics are published for.
Definition Protocol.h:744
std::vector< Diagnostic > diagnostics
The list of reported diagnostics.
Definition Protocol.h:742
bool contains(Position pos) const
Definition Protocol.h:364
friend bool operator!=(const Range &lhs, const Range &rhs)
Definition Protocol.h:357
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:371
friend bool operator<(const Range &lhs, const Range &rhs)
Definition Protocol.h:360
bool contains(Range range) const
Definition Protocol.h:365
Position end
The range's end position.
Definition Protocol.h:352
Position start
The range's start position.
Definition Protocol.h:349
Range(llvm::SourceMgr &mgr, SMRange range)
Construct a range from the given source range.
Definition Protocol.h:345
Range(Position start, Position end)
Definition Protocol.h:341
friend bool operator==(const Range &lhs, const Range &rhs)
Definition Protocol.h:354
Range(Position loc)
Definition Protocol.h:342
bool includeDeclaration
Include the declaration of the current symbol.
Definition Protocol.h:445
ReferenceContext context
Definition Protocol.h:453
Represents the signature of a callable.
Definition Protocol.h:1006
std::vector< SignatureInformation > signatures
The resulting signatures.
Definition Protocol.h:1008
int activeParameter
The active parameter of the active signature.
Definition Protocol.h:1014
int activeSignature
The active signature.
Definition Protocol.h:1011
Represents the signature of something callable.
Definition Protocol.h:986
std::vector< ParameterInformation > parameters
The parameters of this signature.
Definition Protocol.h:994
std::string label
The label of this signature. Mandatory.
Definition Protocol.h:988
std::string documentation
The documentation of this signature. Optional.
Definition Protocol.h:991
std::optional< Range > range
The range of the document that changed.
Definition Protocol.h:498
std::optional< int > rangeLength
The length of the range that got replaced.
Definition Protocol.h:501
LogicalResult applyTo(std::string &contents) const
Try to apply this change to the given contents string.
Definition Protocol.cpp:514
std::string text
The new text of the range/document.
Definition Protocol.h:504
URIForFile uri
The text document's URI.
Definition Protocol.h:260
std::string languageId
The text document's language identifier.
Definition Protocol.h:241
URIForFile uri
The text document's URI.
Definition Protocol.h:238
int64_t version
The version number of this document.
Definition Protocol.h:247
std::string text
The content of the opened text document.
Definition Protocol.h:244
Position position
The position inside the text document.
Definition Protocol.h:432
TextDocumentIdentifier textDocument
The text document.
Definition Protocol.h:429
Range range
The range of the text document to be manipulated.
Definition Protocol.h:757
std::string newText
The string to be inserted.
Definition Protocol.h:761
URIForFile uri
The text document's URI.
Definition Protocol.h:274
int64_t version
The version number of this document.
Definition Protocol.h:276
std::map< std::string, std::vector< TextEdit > > changes
Holds changes to existing resources.
Definition Protocol.h:1199