clang-tools  14.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://github.com/Microsoft/language-server-protocol/blob/main/protocol.md
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_CLANG_TOOLS_EXTRA_CLANGD_PROTOCOL_H
24 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROTOCOL_H
25 
26 #include "URI.h"
27 #include "index/SymbolID.h"
28 #include "support/MemoryTree.h"
29 #include "clang/Index/IndexSymbol.h"
30 #include "llvm/ADT/Optional.h"
31 #include "llvm/ADT/SmallVector.h"
32 #include "llvm/Support/JSON.h"
33 #include "llvm/Support/raw_ostream.h"
34 #include <bitset>
35 #include <memory>
36 #include <string>
37 #include <vector>
38 
39 // This file is using the LSP syntax for identifier names which is different
40 // from the LLVM coding standard. To avoid the clang-tidy warnings, we're
41 // disabling one check here.
42 // NOLINTBEGIN(readability-identifier-naming)
43 
44 namespace clang {
45 namespace clangd {
46 
47 enum class ErrorCode {
48  // Defined by JSON RPC.
49  ParseError = -32700,
50  InvalidRequest = -32600,
51  MethodNotFound = -32601,
52  InvalidParams = -32602,
53  InternalError = -32603,
54 
55  ServerNotInitialized = -32002,
56  UnknownErrorCode = -32001,
57 
58  // Defined by the protocol.
59  RequestCancelled = -32800,
60  ContentModified = -32801,
61 };
62 // Models an LSP error as an llvm::Error.
63 class LSPError : public llvm::ErrorInfo<LSPError> {
64 public:
65  std::string Message;
67  static char ID;
68 
70  : Message(std::move(Message)), Code(Code) {}
71 
72  void log(llvm::raw_ostream &OS) const override {
73  OS << int(Code) << ": " << Message;
74  }
75  std::error_code convertToErrorCode() const override {
76  return llvm::inconvertibleErrorCode();
77  }
78 };
79 
80 // URI in "file" scheme for a file.
81 struct URIForFile {
82  URIForFile() = default;
83 
84  /// Canonicalizes \p AbsPath via URI.
85  ///
86  /// File paths in URIForFile can come from index or local AST. Path from
87  /// index goes through URI transformation, and the final path is resolved by
88  /// URI scheme and could potentially be different from the original path.
89  /// Hence, we do the same transformation for all paths.
90  ///
91  /// Files can be referred to by several paths (e.g. in the presence of links).
92  /// Which one we prefer may depend on where we're coming from. \p TUPath is a
93  /// hint, and should usually be the main entrypoint file we're processing.
94  static URIForFile canonicalize(llvm::StringRef AbsPath,
95  llvm::StringRef TUPath);
96 
97  static llvm::Expected<URIForFile> fromURI(const URI &U,
98  llvm::StringRef HintPath);
99 
100  /// Retrieves absolute path to the file.
101  llvm::StringRef file() const { return File; }
102 
103  explicit operator bool() const { return !File.empty(); }
104  std::string uri() const { return URI::createFile(File).toString(); }
105 
106  friend bool operator==(const URIForFile &LHS, const URIForFile &RHS) {
107  return LHS.File == RHS.File;
108  }
109 
110  friend bool operator!=(const URIForFile &LHS, const URIForFile &RHS) {
111  return !(LHS == RHS);
112  }
113 
114  friend bool operator<(const URIForFile &LHS, const URIForFile &RHS) {
115  return LHS.File < RHS.File;
116  }
117 
118 private:
119  explicit URIForFile(std::string &&File) : File(std::move(File)) {}
120 
121  std::string File;
122 };
123 
124 /// Serialize/deserialize \p URIForFile to/from a string URI.
125 llvm::json::Value toJSON(const URIForFile &U);
126 bool fromJSON(const llvm::json::Value &, URIForFile &, llvm::json::Path);
127 
129  /// The text document's URI.
131 };
135 
137  /// The version number of this document. If a versioned text document
138  /// identifier is sent from the server to the client and the file is not open
139  /// in the editor (the server has not received an open notification before)
140  /// the server can send `null` to indicate that the version is known and the
141  /// content on disk is the master (as speced with document content ownership).
142  ///
143  /// The version number of a document will increase after each change,
144  /// including undo/redo. The number doesn't need to be consecutive.
145  ///
146  /// clangd extension: versions are optional, and synthesized if missing.
147  llvm::Optional<std::int64_t> version;
148 };
152 
153 struct Position {
154  /// Line position in a document (zero-based).
155  int line = 0;
156 
157  /// Character offset on a line in a document (zero-based).
158  /// WARNING: this is in UTF-16 codepoints, not bytes or characters!
159  /// Use the functions in SourceCode.h to construct/interpret Positions.
160  int character = 0;
161 
162  friend bool operator==(const Position &LHS, const Position &RHS) {
163  return std::tie(LHS.line, LHS.character) ==
164  std::tie(RHS.line, RHS.character);
165  }
166  friend bool operator!=(const Position &LHS, const Position &RHS) {
167  return !(LHS == RHS);
168  }
169  friend bool operator<(const Position &LHS, const Position &RHS) {
170  return std::tie(LHS.line, LHS.character) <
171  std::tie(RHS.line, RHS.character);
172  }
173  friend bool operator<=(const Position &LHS, const Position &RHS) {
174  return std::tie(LHS.line, LHS.character) <=
175  std::tie(RHS.line, RHS.character);
176  }
177 };
178 bool fromJSON(const llvm::json::Value &, Position &, llvm::json::Path);
179 llvm::json::Value toJSON(const Position &);
180 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Position &);
181 
182 struct Range {
183  /// The range's start position.
185 
186  /// The range's end position.
188 
189  friend bool operator==(const Range &LHS, const Range &RHS) {
190  return std::tie(LHS.start, LHS.end) == std::tie(RHS.start, RHS.end);
191  }
192  friend bool operator!=(const Range &LHS, const Range &RHS) {
193  return !(LHS == RHS);
194  }
195  friend bool operator<(const Range &LHS, const Range &RHS) {
196  return std::tie(LHS.start, LHS.end) < std::tie(RHS.start, RHS.end);
197  }
198 
199  bool contains(Position Pos) const { return start <= Pos && Pos < end; }
200  bool contains(Range Rng) const {
201  return start <= Rng.start && Rng.end <= end;
202  }
203 };
206 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Range &);
207 
208 struct Location {
209  /// The text document's URI.
212 
213  friend bool operator==(const Location &LHS, const Location &RHS) {
214  return LHS.uri == RHS.uri && LHS.range == RHS.range;
215  }
216 
217  friend bool operator!=(const Location &LHS, const Location &RHS) {
218  return !(LHS == RHS);
219  }
220 
221  friend bool operator<(const Location &LHS, const Location &RHS) {
222  return std::tie(LHS.uri, LHS.range) < std::tie(RHS.uri, RHS.range);
223  }
224 };
226 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Location &);
227 
228 struct TextEdit {
229  /// The range of the text document to be manipulated. To insert
230  /// text into a document create a range where start === end.
232 
233  /// The string to be inserted. For delete operations use an
234  /// empty string.
235  std::string newText;
236 };
237 inline bool operator==(const TextEdit &L, const TextEdit &R) {
238  return std::tie(L.newText, L.range) == std::tie(R.newText, R.range);
239 }
240 bool fromJSON(const llvm::json::Value &, TextEdit &, llvm::json::Path);
241 llvm::json::Value toJSON(const TextEdit &);
242 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const TextEdit &);
243 
245  /// The text document's URI.
247 
248  /// The text document's language identifier.
249  std::string languageId;
250 
251  /// The version number of this document (it will strictly increase after each
252  /// change, including undo/redo.
253  ///
254  /// clangd extension: versions are optional, and synthesized if missing.
255  llvm::Optional<int64_t> version;
256 
257  /// The content of the opened text document.
258  std::string text;
259 };
261 
262 enum class TraceLevel {
263  Off = 0,
264  Messages = 1,
265  Verbose = 2,
266 };
268 
269 struct NoParams {};
270 inline llvm::json::Value toJSON(const NoParams &) { return nullptr; }
272  return true;
273 }
275 
276 /// Defines how the host (editor) should sync document changes to the language
277 /// server.
279  /// Documents should not be synced at all.
280  None = 0,
281 
282  /// Documents are synced by always sending the full content of the document.
283  Full = 1,
284 
285  /// Documents are synced by sending the full content on open. After that
286  /// only incremental updates to the document are send.
287  Incremental = 2,
288 };
289 
290 /// The kind of a completion entry.
291 enum class CompletionItemKind {
292  Missing = 0,
293  Text = 1,
294  Method = 2,
295  Function = 3,
296  Constructor = 4,
297  Field = 5,
298  Variable = 6,
299  Class = 7,
300  Interface = 8,
301  Module = 9,
302  Property = 10,
303  Unit = 11,
304  Value = 12,
305  Enum = 13,
306  Keyword = 14,
307  Snippet = 15,
308  Color = 16,
309  File = 17,
310  Reference = 18,
311  Folder = 19,
312  EnumMember = 20,
313  Constant = 21,
314  Struct = 22,
315  Event = 23,
316  Operator = 24,
317  TypeParameter = 25,
318 };
321 constexpr auto CompletionItemKindMin =
322  static_cast<size_t>(CompletionItemKind::Text);
323 constexpr auto CompletionItemKindMax =
324  static_cast<size_t>(CompletionItemKind::TypeParameter);
325 using CompletionItemKindBitset = std::bitset<CompletionItemKindMax + 1>;
330  CompletionItemKindBitset &SupportedCompletionItemKinds);
331 
332 /// A symbol kind.
333 enum class SymbolKind {
334  File = 1,
335  Module = 2,
336  Namespace = 3,
337  Package = 4,
338  Class = 5,
339  Method = 6,
340  Property = 7,
341  Field = 8,
342  Constructor = 9,
343  Enum = 10,
344  Interface = 11,
345  Function = 12,
346  Variable = 13,
347  Constant = 14,
348  String = 15,
349  Number = 16,
350  Boolean = 17,
351  Array = 18,
352  Object = 19,
353  Key = 20,
354  Null = 21,
355  EnumMember = 22,
356  Struct = 23,
357  Event = 24,
358  Operator = 25,
359  TypeParameter = 26
360 };
362 constexpr auto SymbolKindMin = static_cast<size_t>(SymbolKind::File);
363 constexpr auto SymbolKindMax = static_cast<size_t>(SymbolKind::TypeParameter);
364 using SymbolKindBitset = std::bitset<SymbolKindMax + 1>;
367  SymbolKindBitset &supportedSymbolKinds);
368 
369 // Convert a index::SymbolKind to clangd::SymbolKind (LSP)
370 // Note, some are not perfect matches and should be improved when this LSP
371 // issue is addressed:
372 // https://github.com/Microsoft/language-server-protocol/issues/344
374 
375 // Determines the encoding used to measure offsets and lengths of source in LSP.
376 enum class OffsetEncoding {
377  // Any string is legal on the wire. Unrecognized encodings parse as this.
379  // Length counts code units of UTF-16 encoded text. (Standard LSP behavior).
380  UTF16,
381  // Length counts bytes of UTF-8 encoded text. (Clangd extension).
382  UTF8,
383  // Length counts codepoints in unicode text. (Clangd extension).
384  UTF32,
385 };
388 llvm::raw_ostream &operator<<(llvm::raw_ostream &, OffsetEncoding);
389 
390 // Describes the content type that a client supports in various result literals
391 // like `Hover`, `ParameterInfo` or `CompletionItem`.
392 enum class MarkupKind {
393  PlainText,
394  Markdown,
395 };
397 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, MarkupKind);
398 
399 // This struct doesn't mirror LSP!
400 // The protocol defines deeply nested structures for client capabilities.
401 // Instead of mapping them all, this just parses out the bits we care about.
403  /// The supported set of SymbolKinds for workspace/symbol.
404  /// workspace.symbol.symbolKind.valueSet
405  llvm::Optional<SymbolKindBitset> WorkspaceSymbolKinds;
406 
407  /// Whether the client accepts diagnostics with codeActions attached inline.
408  /// textDocument.publishDiagnostics.codeActionsInline.
409  bool DiagnosticFixes = false;
410 
411  /// Whether the client accepts diagnostics with related locations.
412  /// textDocument.publishDiagnostics.relatedInformation.
414 
415  /// Whether the client accepts diagnostics with category attached to it
416  /// using the "category" extension.
417  /// textDocument.publishDiagnostics.categorySupport
418  bool DiagnosticCategory = false;
419 
420  /// Client supports snippets as insert text.
421  /// textDocument.completion.completionItem.snippetSupport
422  bool CompletionSnippets = false;
423 
424  /// Client supports completions with additionalTextEdit near the cursor.
425  /// This is a clangd extension. (LSP says this is for unrelated text only).
426  /// textDocument.completion.editsNearCursor
427  bool CompletionFixes = false;
428 
429  /// Client supports hierarchical document symbols.
430  /// textDocument.documentSymbol.hierarchicalDocumentSymbolSupport
432 
433  /// Client supports signature help.
434  /// textDocument.signatureHelp
435  bool HasSignatureHelp = false;
436 
437  /// Client supports processing label offsets instead of a simple label string.
438  /// textDocument.signatureHelp.signatureInformation.parameterInformation.labelOffsetSupport
440 
441  /// The documentation format that should be used for
442  /// textDocument/signatureHelp.
443  /// textDocument.signatureHelp.signatureInformation.documentationFormat
445 
446  /// The supported set of CompletionItemKinds for textDocument/completion.
447  /// textDocument.completion.completionItemKind.valueSet
448  llvm::Optional<CompletionItemKindBitset> CompletionItemKinds;
449 
450  /// The documentation format that should be used for textDocument/completion.
451  /// textDocument.completion.completionItem.documentationFormat
453 
454  /// Client supports CodeAction return value for textDocument/codeAction.
455  /// textDocument.codeAction.codeActionLiteralSupport.
456  bool CodeActionStructure = false;
457 
458  /// Client advertises support for the semanticTokens feature.
459  /// We support the textDocument/semanticTokens request in any case.
460  /// textDocument.semanticTokens
461  bool SemanticTokens = false;
462  /// Client supports Theia semantic highlighting extension.
463  /// https://github.com/microsoft/vscode-languageserver-node/pull/367
464  /// clangd no longer supports this, we detect it just to log a warning.
465  /// textDocument.semanticHighlightingCapabilities.semanticHighlighting
467 
468  /// Supported encodings for LSP character offsets. (clangd extension).
469  llvm::Optional<std::vector<OffsetEncoding>> offsetEncoding;
470 
471  /// The content format that should be used for Hover requests.
472  /// textDocument.hover.contentEncoding
474 
475  /// The client supports testing for validity of rename operations
476  /// before execution.
477  bool RenamePrepareSupport = false;
478 
479  /// The client supports progress notifications.
480  /// window.workDoneProgress
481  bool WorkDoneProgress = false;
482 
483  /// The client supports implicit $/progress work-done progress streams,
484  /// without a preceding window/workDoneProgress/create.
485  /// This is a clangd extension.
486  /// window.implicitWorkDoneProgressCreate
488 
489  /// Whether the client claims to cancel stale requests.
490  /// general.staleRequestSupport.cancel
491  bool CancelsStaleRequests = false;
492 
493  /// Whether the client implementation supports a refresh request sent from the
494  /// server to the client.
496 };
499 
500 /// Clangd extension that's used in the 'compilationDatabaseChanges' in
501 /// workspace/didChangeConfiguration to record updates to the in-memory
502 /// compilation database.
504  std::string workingDirectory;
505  std::vector<std::string> compilationCommand;
506 };
509 
510 /// Clangd extension: parameters configurable at any time, via the
511 /// `workspace/didChangeConfiguration` notification.
512 /// LSP defines this type as `any`.
514  // Changes to the in-memory compilation database.
515  // The key of the map is a file name.
516  std::map<std::string, ClangdCompileCommand> compilationDatabaseChanges;
517 };
520 
521 /// Clangd extension: parameters configurable at `initialize` time.
522 /// LSP defines this type as `any`.
524  // What we can change throught the didChangeConfiguration request, we can
525  // also set through the initialize request (initializationOptions field).
527 
528  llvm::Optional<std::string> compilationDatabasePath;
529  // Additional flags to be included in the "fallback command" used when
530  // the compilation database doesn't describe an opened file.
531  // The command used will be approximately `clang $FILE $fallbackFlags`.
532  std::vector<std::string> fallbackFlags;
533 
534  /// Clients supports show file status for textDocument/clangd.fileStatus.
535  bool FileStatus = false;
536 };
539 
541  /// The process Id of the parent process that started
542  /// the server. Is null if the process has not been started by another
543  /// process. If the parent process is not alive then the server should exit
544  /// (see exit notification) its process.
545  llvm::Optional<int> processId;
546 
547  /// The rootPath of the workspace. Is null
548  /// if no folder is open.
549  ///
550  /// @deprecated in favour of rootUri.
551  llvm::Optional<std::string> rootPath;
552 
553  /// The rootUri of the workspace. Is null if no
554  /// folder is open. If both `rootPath` and `rootUri` are set
555  /// `rootUri` wins.
556  llvm::Optional<URIForFile> rootUri;
557 
558  // User provided initialization options.
559  // initializationOptions?: any;
560 
561  /// The capabilities provided by the client (editor or tool)
563  /// The same data as capabilities, but not parsed (to expose to modules).
564  llvm::json::Object rawCapabilities;
565 
566  /// The initial trace setting. If omitted trace is disabled ('off').
567  llvm::Optional<TraceLevel> trace;
568 
569  /// User-provided initialization options.
571 };
573 
575  /// The token to be used to report progress.
577 };
579 
580 template <typename T> struct ProgressParams {
581  /// The progress token provided by the client or server.
583 
584  /// The progress data.
585  T value;
586 };
587 template <typename T> llvm::json::Value toJSON(const ProgressParams<T> &P) {
588  return llvm::json::Object{{"token", P.token}, {"value", P.value}};
589 }
590 /// To start progress reporting a $/progress notification with the following
591 /// payload must be sent.
593  /// Mandatory title of the progress operation. Used to briefly inform about
594  /// the kind of operation being performed.
595  ///
596  /// Examples: "Indexing" or "Linking dependencies".
597  std::string title;
598 
599  /// Controls if a cancel button should show to allow the user to cancel the
600  /// long-running operation. Clients that don't support cancellation are
601  /// allowed to ignore the setting.
602  bool cancellable = false;
603 
604  /// Optional progress percentage to display (value 100 is considered 100%).
605  /// If not provided infinite progress is assumed and clients are allowed
606  /// to ignore the `percentage` value in subsequent in report notifications.
607  ///
608  /// The value should be steadily rising. Clients are free to ignore values
609  /// that are not following this rule.
610  ///
611  /// Clangd implementation note: we only send nonzero percentages in
612  /// the WorkProgressReport. 'true' here means percentages will be used.
613  bool percentage = false;
614 };
616 
617 /// Reporting progress is done using the following payload.
619  /// Mandatory title of the progress operation. Used to briefly inform about
620  /// the kind of operation being performed.
621  ///
622  /// Examples: "Indexing" or "Linking dependencies".
623  std::string title;
624 
625  /// Controls enablement state of a cancel button. This property is only valid
626  /// if a cancel button got requested in the `WorkDoneProgressStart` payload.
627  ///
628  /// Clients that don't support cancellation or don't support control
629  /// the button's enablement state are allowed to ignore the setting.
630  llvm::Optional<bool> cancellable;
631 
632  /// Optional, more detailed associated progress message. Contains
633  /// complementary information to the `title`.
634  ///
635  /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
636  /// If unset, the previous progress message (if any) is still valid.
637  llvm::Optional<std::string> message;
638 
639  /// Optional progress percentage to display (value 100 is considered 100%).
640  /// If not provided infinite progress is assumed and clients are allowed
641  /// to ignore the `percentage` value in subsequent in report notifications.
642  ///
643  /// The value should be steadily rising. Clients are free to ignore values
644  /// that are not following this rule.
645  llvm::Optional<unsigned> percentage;
646 };
648 //
649 /// Signals the end of progress reporting.
651  /// Optional, a final message indicating to for example indicate the outcome
652  /// of the operation.
653  llvm::Optional<std::string> message;
654 };
656 
657 enum class MessageType {
658  /// An error message.
659  Error = 1,
660  /// A warning message.
661  Warning = 2,
662  /// An information message.
663  Info = 3,
664  /// A log message.
665  Log = 4,
666 };
668 
669 /// The show message notification is sent from a server to a client to ask the
670 /// client to display a particular message in the user interface.
672  /// The message type.
674  /// The actual message.
675  std::string message;
676 };
678 
680  /// The document that was opened.
682 };
685 
687  /// The document that was closed.
689 };
692 
694  /// The document that was saved.
696 };
699 
701  /// The range of the document that changed.
702  llvm::Optional<Range> range;
703 
704  /// The length of the range that got replaced.
705  llvm::Optional<int> rangeLength;
706 
707  /// The new text of the range/document.
708  std::string text;
709 };
712 
714  /// The document that did change. The version number points
715  /// to the version after all provided content changes have
716  /// been applied.
718 
719  /// The actual content changes.
720  std::vector<TextDocumentContentChangeEvent> contentChanges;
721 
722  /// Forces diagnostics to be generated, or to not be generated, for this
723  /// version of the file. If not set, diagnostics are eventually consistent:
724  /// either they will be provided for this version or some subsequent one.
725  /// This is a clangd extension.
726  llvm::Optional<bool> wantDiagnostics;
727 
728  /// Force a complete rebuild of the file, ignoring all cached state. Slow!
729  /// This is useful to defeat clangd's assumption that missing headers will
730  /// stay missing.
731  /// This is a clangd extension.
732  bool forceRebuild = false;
733 };
736 
737 enum class FileChangeType {
738  /// The file got created.
739  Created = 1,
740  /// The file got changed.
741  Changed = 2,
742  /// The file got deleted.
743  Deleted = 3
744 };
747 
748 struct FileEvent {
749  /// The file's URI.
751  /// The change type.
753 };
755 
757  /// The actual file events.
758  std::vector<FileEvent> changes;
759 };
762 
765 };
768 
769 // Note: we do not parse FormattingOptions for *FormattingParams.
770 // In general, we use a clang-format style detected from common mechanisms
771 // (.clang-format files and the -fallback-style flag).
772 // It would be possible to override these with FormatOptions, but:
773 // - the protocol makes FormatOptions mandatory, so many clients set them to
774 // useless values, and we can't tell when to respect them
775 // - we also format in other places, where FormatOptions aren't available.
776 
778  /// The document to format.
780 
781  /// The range to format
783 };
786 
788  /// The document to format.
790 
791  /// The position at which this request was sent.
793 
794  /// The character that has been typed.
795  std::string ch;
796 };
799 
801  /// The document to format.
803 };
806 
808  // The text document to find symbols in.
810 };
813 
814 /// Represents a related message and source code location for a diagnostic.
815 /// This should be used to point to code locations that cause or related to a
816 /// diagnostics, e.g when duplicating a symbol in a scope.
818  /// The location of this related diagnostic information.
820  /// The message of this related diagnostic information.
821  std::string message;
822 };
824 
826  /// Unused or unnecessary code.
827  ///
828  /// Clients are allowed to render diagnostics with this tag faded out instead
829  /// of having an error squiggle.
831  /// Deprecated or obsolete code.
832  ///
833  /// Clients are allowed to rendered diagnostics with this tag strike through.
835 };
837 
838 struct CodeAction;
839 struct Diagnostic {
840  /// The range at which the message applies.
842 
843  /// The diagnostic's severity. Can be omitted. If omitted it is up to the
844  /// client to interpret diagnostics as error, warning, info or hint.
845  int severity = 0;
846 
847  /// The diagnostic's code. Can be omitted.
848  std::string code;
849 
850  /// A human-readable string describing the source of this
851  /// diagnostic, e.g. 'typescript' or 'super lint'.
852  std::string source;
853 
854  /// The diagnostic's message.
855  std::string message;
856 
857  /// Additional metadata about the diagnostic.
858  llvm::SmallVector<DiagnosticTag, 1> tags;
859 
860  /// An array of related diagnostic information, e.g. when symbol-names within
861  /// a scope collide all definitions can be marked via this property.
862  llvm::Optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
863 
864  /// The diagnostic's category. Can be omitted.
865  /// An LSP extension that's used to send the name of the category over to the
866  /// client. The category typically describes the compilation stage during
867  /// which the issue was produced, e.g. "Semantic Issue" or "Parse Issue".
868  llvm::Optional<std::string> category;
869 
870  /// Clangd extension: code actions related to this diagnostic.
871  /// Only with capability textDocument.publishDiagnostics.codeActionsInline.
872  /// (These actions can also be obtained using textDocument/codeAction).
873  llvm::Optional<std::vector<CodeAction>> codeActions;
874 
875  /// A data entry field that is preserved between a
876  /// `textDocument/publishDiagnostics` notification
877  /// and`textDocument/codeAction` request.
878  /// Mutating users should associate their data with a unique key they can use
879  /// to retrieve later on.
880  llvm::json::Object data;
881 };
883 
884 /// A LSP-specific comparator used to find diagnostic in a container like
885 /// std:map.
886 /// We only use the required fields of Diagnostic to do the comparison to avoid
887 /// any regression issues from LSP clients (e.g. VScode), see
888 /// https://git.io/vbr29
890  bool operator()(const Diagnostic &LHS, const Diagnostic &RHS) const {
891  return std::tie(LHS.range, LHS.message) < std::tie(RHS.range, RHS.message);
892  }
893 };
895 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Diagnostic &);
896 
898  /// The URI for which diagnostic information is reported.
900  /// An array of diagnostic information items.
901  std::vector<Diagnostic> diagnostics;
902  /// The version number of the document the diagnostics are published for.
903  llvm::Optional<int64_t> version;
904 };
906 
908  /// An array of diagnostics known on the client side overlapping the range
909  /// provided to the `textDocument/codeAction` request. They are provided so
910  /// that the server knows which errors are currently presented to the user for
911  /// the given range. There is no guarantee that these accurately reflect the
912  /// error state of the resource. The primary parameter to compute code actions
913  /// is the provided range.
914  std::vector<Diagnostic> diagnostics;
915 
916  /// Requested kind of actions to return.
917  ///
918  /// Actions not of this kind are filtered out by the client before being
919  /// shown. So servers can omit computing them.
920  std::vector<std::string> only;
921 };
923 
925  /// The document in which the command was invoked.
927 
928  /// The range for which the command was invoked.
930 
931  /// Context carrying additional information.
933 };
935 
937  /// Holds changes to existing resources.
938  std::map<std::string, std::vector<TextEdit>> changes;
939 
940  /// Note: "documentChanges" is not currently used because currently there is
941  /// no support for versioned edits.
942 };
945 
946 /// Arguments for the 'applyTweak' command. The server sends these commands as a
947 /// response to the textDocument/codeAction request. The client can later send a
948 /// command back to the server if the user requests to execute a particular code
949 /// tweak.
950 struct TweakArgs {
951  /// A file provided by the client on a textDocument/codeAction request.
953  /// A selection provided by the client on a textDocument/codeAction request.
955  /// ID of the tweak that should be executed. Corresponds to Tweak::id().
956  std::string tweakID;
957 };
960 
962  /// The identifier of the actual command handler.
963  std::string command;
964 
965  // This is `arguments?: []any` in LSP.
966  // All clangd's commands accept a single argument (or none => null).
968 };
971 
972 struct Command : public ExecuteCommandParams {
973  std::string title;
974 };
975 llvm::json::Value toJSON(const Command &C);
976 
977 /// A code action represents a change that can be performed in code, e.g. to fix
978 /// a problem or to refactor code.
979 ///
980 /// A CodeAction must set either `edit` and/or a `command`. If both are
981 /// supplied, the `edit` is applied first, then the `command` is executed.
982 struct CodeAction {
983  /// A short, human-readable, title for this code action.
984  std::string title;
985 
986  /// The kind of the code action.
987  /// Used to filter code actions.
988  llvm::Optional<std::string> kind;
989  const static llvm::StringLiteral QUICKFIX_KIND;
990  const static llvm::StringLiteral REFACTOR_KIND;
991  const static llvm::StringLiteral INFO_KIND;
992 
993  /// The diagnostics that this code action resolves.
994  llvm::Optional<std::vector<Diagnostic>> diagnostics;
995 
996  /// Marks this as a preferred action. Preferred actions are used by the
997  /// `auto fix` command and can be targeted by keybindings.
998  /// A quick fix should be marked preferred if it properly addresses the
999  /// underlying error. A refactoring should be marked preferred if it is the
1000  /// most reasonable choice of actions to take.
1001  bool isPreferred = false;
1002 
1003  /// The workspace edit this code action performs.
1004  llvm::Optional<WorkspaceEdit> edit;
1005 
1006  /// A command this code action executes. If a code action provides an edit
1007  /// and a command, first the edit is executed and then the command.
1008  llvm::Optional<Command> command;
1009 };
1011 
1012 /// Represents programming constructs like variables, classes, interfaces etc.
1013 /// that appear in a document. Document symbols can be hierarchical and they
1014 /// have two ranges: one that encloses its definition and one that points to its
1015 /// most interesting range, e.g. the range of an identifier.
1017  /// The name of this symbol.
1018  std::string name;
1019 
1020  /// More detail for this symbol, e.g the signature of a function.
1021  std::string detail;
1022 
1023  /// The kind of this symbol.
1025 
1026  /// Indicates if this symbol is deprecated.
1027  bool deprecated = false;
1028 
1029  /// The range enclosing this symbol not including leading/trailing whitespace
1030  /// but everything else like comments. This information is typically used to
1031  /// determine if the clients cursor is inside the symbol to reveal in the
1032  /// symbol in the UI.
1034 
1035  /// The range that should be selected and revealed when this symbol is being
1036  /// picked, e.g the name of a function. Must be contained by the `range`.
1038 
1039  /// Children of this symbol, e.g. properties of a class.
1040  std::vector<DocumentSymbol> children;
1041 };
1042 llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const DocumentSymbol &S);
1044 
1045 /// Represents information about programming constructs like variables, classes,
1046 /// interfaces etc.
1048  /// The name of this symbol.
1049  std::string name;
1050 
1051  /// The kind of this symbol.
1053 
1054  /// The location of this symbol.
1056 
1057  /// The name of the symbol containing this symbol.
1058  std::string containerName;
1059 
1060  /// The score that clangd calculates to rank the returned symbols.
1061  /// This excludes the fuzzy-matching score between `name` and the query.
1062  /// (Specifically, the last ::-separated component).
1063  /// This can be used to re-rank results as the user types, using client-side
1064  /// fuzzy-matching (that score should be multiplied with this one).
1065  /// This is a clangd extension, set only for workspace/symbol responses.
1066  llvm::Optional<float> score;
1067 };
1069 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolInformation &);
1070 
1071 /// Represents information about identifier.
1072 /// This is returned from textDocument/symbolInfo, which is a clangd extension.
1074  std::string name;
1075 
1076  std::string containerName;
1077 
1078  /// Unified Symbol Resolution identifier
1079  /// This is an opaque string uniquely identifying a symbol.
1080  /// Unlike SymbolID, it is variable-length and somewhat human-readable.
1081  /// It is a common representation across several clang tools.
1082  /// (See USRGeneration.h)
1083  std::string USR;
1084 
1086 };
1088 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolDetails &);
1089 bool operator==(const SymbolDetails &, const SymbolDetails &);
1090 
1091 /// The parameters of a Workspace Symbol Request.
1093  /// A query string to filter symbols by.
1094  /// Clients may send an empty string here to request all the symbols.
1095  std::string query;
1096 
1097  /// Max results to return, overriding global default. 0 means no limit.
1098  /// Clangd extension.
1099  llvm::Optional<int> limit;
1100 };
1103 
1106 };
1108 
1110  bool applied = true;
1111  llvm::Optional<std::string> failureReason;
1112 };
1115 
1117  /// The text document.
1119 
1120  /// The position inside the text document.
1122 };
1125 
1127  /// Completion was triggered by typing an identifier (24x7 code
1128  /// complete), manual invocation (e.g Ctrl+Space) or via API.
1129  Invoked = 1,
1130  /// Completion was triggered by a trigger character specified by
1131  /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
1132  TriggerCharacter = 2,
1133  /// Completion was re-triggered as the current completion list is incomplete.
1135 };
1136 
1138  /// How the completion was triggered.
1140  /// The trigger character (a single character) that has trigger code complete.
1141  /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
1142  std::string triggerCharacter;
1143 };
1145 
1148 
1149  /// Max results to return, overriding global default. 0 means no limit.
1150  /// Clangd extension.
1151  llvm::Optional<int> limit;
1152 };
1154 
1157  std::string value;
1158 };
1160 
1161 struct Hover {
1162  /// The hover's content
1164 
1165  /// An optional range is a range inside a text document
1166  /// that is used to visualize a hover, e.g. by changing the background color.
1167  llvm::Optional<Range> range;
1168 };
1169 llvm::json::Value toJSON(const Hover &H);
1170 
1171 /// Defines whether the insert text in a completion item should be interpreted
1172 /// as plain text or a snippet.
1173 enum class InsertTextFormat {
1174  Missing = 0,
1175  /// The primary text to be inserted is treated as a plain string.
1176  PlainText = 1,
1177  /// The primary text to be inserted is treated as a snippet.
1178  ///
1179  /// A snippet can define tab stops and placeholders with `$1`, `$2`
1180  /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end
1181  /// of the snippet. Placeholders with equal identifiers are linked, that is
1182  /// typing in one will update others too.
1183  ///
1184  /// See also:
1185  /// https://github.com/Microsoft/vscode/blob/main/src/vs/editor/contrib/snippet/snippet.md
1186  Snippet = 2,
1187 };
1188 
1190  /// The label of this completion item. By default also the text that is
1191  /// inserted when selecting this completion.
1192  std::string label;
1193 
1194  /// The kind of this completion item. Based of the kind an icon is chosen by
1195  /// the editor.
1197 
1198  /// A human-readable string with additional information about this item, like
1199  /// type or symbol information.
1200  std::string detail;
1201 
1202  /// A human-readable string that represents a doc-comment.
1203  llvm::Optional<MarkupContent> documentation;
1204 
1205  /// A string that should be used when comparing this item with other items.
1206  /// When `falsy` the label is used.
1207  std::string sortText;
1208 
1209  /// A string that should be used when filtering a set of completion items.
1210  /// When `falsy` the label is used.
1211  std::string filterText;
1212 
1213  /// A string that should be inserted to a document when selecting this
1214  /// completion. When `falsy` the label is used.
1215  std::string insertText;
1216 
1217  /// The format of the insert text. The format applies to both the `insertText`
1218  /// property and the `newText` property of a provided `textEdit`.
1220 
1221  /// An edit which is applied to a document when selecting this completion.
1222  /// When an edit is provided `insertText` is ignored.
1223  ///
1224  /// Note: The range of the edit must be a single line range and it must
1225  /// contain the position at which completion has been requested.
1226  llvm::Optional<TextEdit> textEdit;
1227 
1228  /// An optional array of additional text edits that are applied when selecting
1229  /// this completion. Edits must not overlap with the main edit nor with
1230  /// themselves.
1231  std::vector<TextEdit> additionalTextEdits;
1232 
1233  /// Indicates if this item is deprecated.
1234  bool deprecated = false;
1235 
1236  /// The score that clangd calculates to rank the returned completions.
1237  /// This excludes the fuzzy-match between `filterText` and the partial word.
1238  /// This can be used to re-rank results as the user types, using client-side
1239  /// fuzzy-matching (that score should be multiplied with this one).
1240  /// This is a clangd extension.
1241  float score = 0.f;
1242 
1243  // TODO: Add custom commitCharacters for some of the completion items. For
1244  // example, it makes sense to use () only for the functions.
1245  // TODO(krasimir): The following optional fields defined by the language
1246  // server protocol are unsupported:
1247  //
1248  // data?: any - A data entry field that is preserved on a completion item
1249  // between a completion and a completion resolve request.
1250 };
1252 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const CompletionItem &);
1253 
1254 bool operator<(const CompletionItem &, const CompletionItem &);
1255 
1256 /// Represents a collection of completion items to be presented in the editor.
1258  /// The list is not complete. Further typing should result in recomputing the
1259  /// list.
1260  bool isIncomplete = false;
1261 
1262  /// The completion items.
1263  std::vector<CompletionItem> items;
1264 };
1266 
1267 /// A single parameter of a particular signature.
1269 
1270  /// The label of this parameter. Ignored when labelOffsets is set.
1271  std::string labelString;
1272 
1273  /// Inclusive start and exclusive end offsets withing the containing signature
1274  /// label.
1275  /// Offsets are computed by lspLength(), which counts UTF-16 code units by
1276  /// default but that can be overriden, see its documentation for details.
1277  llvm::Optional<std::pair<unsigned, unsigned>> labelOffsets;
1278 
1279  /// The documentation of this parameter. Optional.
1280  std::string documentation;
1281 };
1283 
1284 /// Represents the signature of something callable.
1286 
1287  /// The label of this signature. Mandatory.
1288  std::string label;
1289 
1290  /// The documentation of this signature. Optional.
1292 
1293  /// The parameters of this signature.
1294  std::vector<ParameterInformation> parameters;
1295 };
1297 llvm::raw_ostream &operator<<(llvm::raw_ostream &,
1298  const SignatureInformation &);
1299 
1300 /// Represents the signature of a callable.
1302 
1303  /// The resulting signatures.
1304  std::vector<SignatureInformation> signatures;
1305 
1306  /// The active signature.
1308 
1309  /// The active parameter of the active signature.
1311 
1312  /// Position of the start of the argument list, including opening paren. e.g.
1313  /// foo("first arg", "second arg",
1314  /// ^-argListStart ^-cursor
1315  /// This is a clangd-specific extension, it is only available via C++ API and
1316  /// not currently serialized for the LSP.
1318 };
1320 
1322  /// The document that was opened.
1324 
1325  /// The position at which this request was sent.
1327 
1328  /// The new name of the symbol.
1329  std::string newName;
1330 };
1332 
1333 enum class DocumentHighlightKind { Text = 1, Read = 2, Write = 3 };
1334 
1335 /// A document highlight is a range inside a text document which deserves
1336 /// special attention. Usually a document highlight is visualized by changing
1337 /// the background color of its range.
1338 
1340  /// The range this highlight applies to.
1342 
1343  /// The highlight kind, default is DocumentHighlightKind.Text.
1345 
1346  friend bool operator<(const DocumentHighlight &LHS,
1347  const DocumentHighlight &RHS) {
1348  int LHSKind = static_cast<int>(LHS.kind);
1349  int RHSKind = static_cast<int>(RHS.kind);
1350  return std::tie(LHS.range, LHSKind) < std::tie(RHS.range, RHSKind);
1351  }
1352 
1353  friend bool operator==(const DocumentHighlight &LHS,
1354  const DocumentHighlight &RHS) {
1355  return LHS.kind == RHS.kind && LHS.range == RHS.range;
1356  }
1357 };
1358 llvm::json::Value toJSON(const DocumentHighlight &DH);
1359 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const DocumentHighlight &);
1360 
1361 enum class TypeHierarchyDirection { Children = 0, Parents = 1, Both = 2 };
1364 
1365 /// The type hierarchy params is an extension of the
1366 /// `TextDocumentPositionsParams` with optional properties which can be used to
1367 /// eagerly resolve the item when requesting from the server.
1369  /// The hierarchy levels to resolve. `0` indicates no level.
1370  int resolve = 0;
1371 
1372  /// The direction of the hierarchy levels to resolve.
1374 };
1377 
1379  /// The human readable name of the hierarchy item.
1380  std::string name;
1381 
1382  /// Optional detail for the hierarchy item. It can be, for instance, the
1383  /// signature of a function or method.
1384  llvm::Optional<std::string> detail;
1385 
1386  /// The kind of the hierarchy item. For instance, class or interface.
1388 
1389  /// `true` if the hierarchy item is deprecated. Otherwise, `false`.
1390  bool deprecated = false;
1391 
1392  /// The URI of the text document where this type hierarchy item belongs to.
1394 
1395  /// The range enclosing this type hierarchy item not including
1396  /// leading/trailing whitespace but everything else like comments. This
1397  /// information is typically used to determine if the client's cursor is
1398  /// inside the type hierarch item to reveal in the symbol in the UI.
1400 
1401  /// The range that should be selected and revealed when this type hierarchy
1402  /// item is being picked, e.g. the name of a function. Must be contained by
1403  /// the `range`.
1405 
1406  /// If this type hierarchy item is resolved, it contains the direct parents.
1407  /// Could be empty if the item does not have direct parents. If not defined,
1408  /// the parents have not been resolved yet.
1409  llvm::Optional<std::vector<TypeHierarchyItem>> parents;
1410 
1411  /// If this type hierarchy item is resolved, it contains the direct children
1412  /// of the current item. Could be empty if the item does not have any
1413  /// descendants. If not defined, the children have not been resolved.
1414  llvm::Optional<std::vector<TypeHierarchyItem>> children;
1415 
1416  /// An optional 'data' field, which can be used to identify a type hierarchy
1417  /// item in a resolve request.
1418  llvm::Optional<std::string> data;
1419 };
1421 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const TypeHierarchyItem &);
1423 
1424 /// Parameters for the `typeHierarchy/resolve` request.
1426  /// The item to resolve.
1428 
1429  /// The hierarchy levels to resolve. `0` indicates no level.
1430  int resolve;
1431 
1432  /// The direction of the hierarchy levels to resolve.
1434 };
1437 
1438 enum class SymbolTag { Deprecated = 1 };
1440 
1441 /// The parameter of a `textDocument/prepareCallHierarchy` request.
1443 
1444 /// Represents programming constructs like functions or constructors
1445 /// in the context of call hierarchy.
1447  /// The name of this item.
1448  std::string name;
1449 
1450  /// The kind of this item.
1452 
1453  /// Tags for this item.
1454  std::vector<SymbolTag> tags;
1455 
1456  /// More detaill for this item, e.g. the signature of a function.
1457  std::string detail;
1458 
1459  /// The resource identifier of this item.
1461 
1462  /// The range enclosing this symbol not including leading / trailing
1463  /// whitespace but everything else, e.g. comments and code.
1465 
1466  /// The range that should be selected and revealed when this symbol
1467  /// is being picked, e.g. the name of a function.
1468  /// Must be contained by `Rng`.
1470 
1471  /// An optional 'data' field, which can be used to identify a call
1472  /// hierarchy item in an incomingCalls or outgoingCalls request.
1473  std::string data;
1474 };
1477 
1478 /// The parameter of a `callHierarchy/incomingCalls` request.
1481 };
1484 
1485 /// Represents an incoming call, e.g. a caller of a method or constructor.
1487  /// The item that makes the call.
1489 
1490  /// The range at which the calls appear.
1491  /// This is relative to the caller denoted by `From`.
1492  std::vector<Range> fromRanges;
1493 };
1495 
1496 /// The parameter of a `callHierarchy/outgoingCalls` request.
1499 };
1502 
1503 /// Represents an outgoing call, e.g. calling a getter from a method or
1504 /// a method from a constructor etc.
1506  /// The item that is called.
1508 
1509  /// The range at which this item is called.
1510  /// This is the range relative to the caller, and not `To`.
1511  std::vector<Range> fromRanges;
1512 };
1514 
1515 /// The parameter of a `clangd/inlayHints` request.
1516 ///
1517 /// This is a clangd extension.
1519  /// The text document for which inlay hints are requested.
1521 
1522  /// If set, requests inlay hints for only part of the document.
1523  llvm::Optional<Range> range;
1524 };
1526 
1527 /// A set of predefined hint kinds.
1528 enum class InlayHintKind {
1529  /// The hint corresponds to parameter information.
1530  /// An example of a parameter hint is a hint in this position:
1531  /// func(^arg);
1532  /// which shows the name of the corresponding parameter.
1533  ParameterHint,
1534 
1535  /// The hint corresponds to information about a deduced type.
1536  /// An example of a type hint is a hint in this position:
1537  /// auto var ^ = expr;
1538  /// which shows the deduced type of the variable.
1539  TypeHint,
1540 
1541  /// Other ideas for hints that are not currently implemented:
1542  ///
1543  /// * Chaining hints, showing the types of intermediate expressions
1544  /// in a chain of function calls.
1545  /// * Hints indicating implicit conversions or implicit constructor calls.
1546 };
1548 
1549 /// An annotation to be displayed inline next to a range of source code.
1550 ///
1551 /// This is a clangd extension.
1552 struct InlayHint {
1553  /// The position between two characters where the hint should be displayed.
1554  ///
1555  /// For example, n parameter hint may be positioned before an argument.
1557 
1558  /// The range of source code to which the hint applies.
1559  ///
1560  /// For example, a parameter hint may have the argument as its range.
1561  /// The range allows clients more flexibility of when/how to display the hint.
1563 
1564  /// The type of hint, such as a parameter hint.
1566 
1567  /// The label that is displayed in the editor, such as a parameter name.
1568  ///
1569  /// The label may contain punctuation and/or whitespace to allow it to read
1570  /// naturally when placed inline with the code.
1571  std::string label;
1572 };
1574 bool operator==(const InlayHint &, const InlayHint &);
1575 bool operator<(const InlayHint &, const InlayHint &);
1576 
1578  /// Include the declaration of the current symbol.
1579  bool includeDeclaration = false;
1580 };
1581 
1584 };
1586 
1587 /// Clangd extension: indicates the current state of the file in clangd,
1588 /// sent from server via the `textDocument/clangd.fileStatus` notification.
1589 struct FileStatus {
1590  /// The text document's URI.
1592  /// The human-readable string presents the current state of the file, can be
1593  /// shown in the UI (e.g. status bar).
1594  std::string state;
1595  // FIXME: add detail messages.
1596 };
1598 
1599 /// Specifies a single semantic token in the document.
1600 /// This struct is not part of LSP, which just encodes lists of tokens as
1601 /// arrays of numbers directly.
1603  /// token line number, relative to the previous token
1604  unsigned deltaLine = 0;
1605  /// token start character, relative to the previous token
1606  /// (relative to 0 or the previous token's start if they are on the same line)
1607  unsigned deltaStart = 0;
1608  /// the length of the token. A token cannot be multiline
1609  unsigned length = 0;
1610  /// will be looked up in `SemanticTokensLegend.tokenTypes`
1611  unsigned tokenType = 0;
1612  /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers`
1613  unsigned tokenModifiers = 0;
1614 };
1615 bool operator==(const SemanticToken &, const SemanticToken &);
1616 
1617 /// A versioned set of tokens.
1619  // An optional result id. If provided and clients support delta updating
1620  // the client will include the result id in the next semantic token request.
1621  // A server can then instead of computing all semantic tokens again simply
1622  // send a delta.
1623  std::string resultId;
1624 
1625  /// The actual tokens.
1626  std::vector<SemanticToken> tokens; // encoded as a flat integer array.
1627 };
1629 
1630 /// Body of textDocument/semanticTokens/full request.
1632  /// The text document.
1634 };
1637 
1638 /// Body of textDocument/semanticTokens/full/delta request.
1639 /// Requests the changes in semantic tokens since a previous response.
1641  /// The text document.
1643  /// The previous result id.
1644  std::string previousResultId;
1645 };
1648 
1649 /// Describes a a replacement of a contiguous range of semanticTokens.
1651  // LSP specifies `start` and `deleteCount` which are relative to the array
1652  // encoding of the previous tokens.
1653  // We use token counts instead, and translate when serializing this struct.
1654  unsigned startToken = 0;
1655  unsigned deleteTokens = 0;
1656  std::vector<SemanticToken> tokens; // encoded as a flat integer array
1657 };
1659 
1660 /// This models LSP SemanticTokensDelta | SemanticTokens, which is the result of
1661 /// textDocument/semanticTokens/full/delta.
1663  std::string resultId;
1664  /// Set if we computed edits relative to a previous set of tokens.
1665  llvm::Optional<std::vector<SemanticTokensEdit>> edits;
1666  /// Set if we computed a fresh set of tokens.
1667  llvm::Optional<std::vector<SemanticToken>> tokens; // encoded as integer array
1668 };
1670 
1672  /// The text document.
1674 
1675  /// The positions inside the text document.
1676  std::vector<Position> positions;
1677 };
1680 
1682  /**
1683  * The range of this selection range.
1684  */
1686  /**
1687  * The parent selection range containing this range. Therefore `parent.range`
1688  * must contain `this.range`.
1689  */
1690  std::unique_ptr<SelectionRange> parent;
1691 };
1693 
1694 /// Parameters for the document link request.
1696  /// The document to provide document links for.
1698 };
1701 
1702 /// A range in a text document that links to an internal or external resource,
1703 /// like another text document or a web site.
1705  /// The range this link applies to.
1707 
1708  /// The uri this link points to. If missing a resolve request is sent later.
1710 
1711  // TODO(forster): The following optional fields defined by the language
1712  // server protocol are unsupported:
1713  //
1714  // data?: any - A data entry field that is preserved on a document link
1715  // between a DocumentLinkRequest and a
1716  // DocumentLinkResolveRequest.
1717 
1718  friend bool operator==(const DocumentLink &LHS, const DocumentLink &RHS) {
1719  return LHS.range == RHS.range && LHS.target == RHS.target;
1720  }
1721 
1722  friend bool operator!=(const DocumentLink &LHS, const DocumentLink &RHS) {
1723  return !(LHS == RHS);
1724  }
1725 };
1726 llvm::json::Value toJSON(const DocumentLink &DocumentLink);
1727 
1728 // FIXME(kirillbobyrev): Add FoldingRangeClientCapabilities so we can support
1729 // per-line-folding editors.
1732 };
1735 
1736 /// Stores information about a region of code that can be folded.
1738  unsigned startLine = 0;
1739  unsigned startCharacter;
1740  unsigned endLine = 0;
1741  unsigned endCharacter;
1742  llvm::Optional<std::string> kind;
1743 };
1745 
1746 /// Keys starting with an underscore(_) represent leaves, e.g. _total or _self
1747 /// for memory usage of whole subtree or only that specific node in bytes. All
1748 /// other keys represents children. An example:
1749 /// {
1750 /// "_self": 0,
1751 /// "_total": 8,
1752 /// "child1": {
1753 /// "_self": 4,
1754 /// "_total": 4,
1755 /// }
1756 /// "child2": {
1757 /// "_self": 2,
1758 /// "_total": 4,
1759 /// "child_deep": {
1760 /// "_self": 2,
1761 /// "_total": 2,
1762 /// }
1763 /// }
1764 /// }
1766 
1767 /// Payload for textDocument/ast request.
1768 /// This request is a clangd extension.
1769 struct ASTParams {
1770  /// The text document.
1772 
1773  /// The position of the node to be dumped.
1774  /// The highest-level node that entirely contains the range will be returned.
1775  /// If no range is given, the root translation unit node will be returned.
1776  llvm::Optional<Range> range;
1777 };
1779 
1780 /// Simplified description of a clang AST node.
1781 /// This is clangd's internal representation of C++ code.
1782 struct ASTNode {
1783  /// The general kind of node, such as "expression"
1784  /// Corresponds to the base AST node type such as Expr.
1785  std::string role;
1786  /// The specific kind of node this is, such as "BinaryOperator".
1787  /// This is usually a concrete node class (with Expr etc suffix dropped).
1788  /// When there's no hierarchy (e.g. TemplateName), the variant (NameKind).
1789  std::string kind;
1790  /// Brief additional information, such as "||" for the particular operator.
1791  /// The information included depends on the node kind, and may be empty.
1792  std::string detail;
1793  /// A one-line dump of detailed information about the node.
1794  /// This includes role/kind/description information, but is rather cryptic.
1795  /// It is similar to the output from `clang -Xclang -ast-dump`.
1796  /// May be empty for certain types of nodes.
1797  std::string arcana;
1798  /// The range of the original source file covered by this node.
1799  /// May be missing for implicit nodes, or those created by macro expansion.
1800  llvm::Optional<Range> range;
1801  /// Nodes nested within this one, such as the operands of a BinaryOperator.
1802  std::vector<ASTNode> children;
1803 };
1805 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const ASTNode &);
1806 
1807 } // namespace clangd
1808 } // namespace clang
1809 
1810 namespace llvm {
1811 template <> struct format_provider<clang::clangd::Position> {
1812  static void format(const clang::clangd::Position &Pos, raw_ostream &OS,
1813  StringRef Style) {
1814  assert(Style.empty() && "style modifiers for this type are not supported");
1815  OS << Pos;
1816  }
1817 };
1818 } // namespace llvm
1819 
1820 // NOLINTEND(readability-identifier-naming)
1821 
1822 #endif
clang::clangd::TraceLevel::Messages
@ Messages
clang::clangd::ReferenceContext::includeDeclaration
bool includeDeclaration
Include the declaration of the current symbol.
Definition: Protocol.h:1579
clang::clangd::CallHierarchyItem::selectionRange
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition: Protocol.h:1469
clang::clangd::DocumentHighlight
A document highlight is a range inside a text document which deserves special attention.
Definition: Protocol.h:1339
Range
CharSourceRange Range
SourceRange for the file name.
Definition: IncludeOrderCheck.cpp:38
clang::clangd::CompletionItemKind::Unit
@ Unit
clang::clangd::TypeHierarchyItem::selectionRange
Range selectionRange
The range that should be selected and revealed when this type hierarchy item is being picked,...
Definition: Protocol.h:1404
clang::clangd::WorkspaceEdit
Definition: Protocol.h:936
clang::clangd::CompletionList::isIncomplete
bool isIncomplete
The list is not complete.
Definition: Protocol.h:1260
clang::clangd::MessageType::Warning
@ Warning
A warning message.
clang::clangd::DocumentSymbol::range
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else like co...
Definition: Protocol.h:1033
clang::clangd::FoldingRange::startLine
unsigned startLine
Definition: Protocol.h:1738
clang::clangd::SemanticTokens::resultId
std::string resultId
Definition: Protocol.h:1623
clang::clangd::SymbolKind::Field
@ Field
clang::clangd::SymbolKindMax
constexpr auto SymbolKindMax
Definition: Protocol.h:363
clang::clangd::DidOpenTextDocumentParams::textDocument
TextDocumentItem textDocument
The document that was opened.
Definition: Protocol.h:681
clang::clangd::Diagnostic::source
std::string source
A human-readable string describing the source of this diagnostic, e.g.
Definition: Protocol.h:852
llvm
Some operations such as code completion produce a set of candidates.
Definition: YAMLGenerator.cpp:28
clang::clangd::LSPError::convertToErrorCode
std::error_code convertToErrorCode() const override
Definition: Protocol.h:75
SymbolID.h
clang::clangd::DocumentOnTypeFormattingParams::ch
std::string ch
The character that has been typed.
Definition: Protocol.h:795
clang::clangd::InlayHint::label
std::string label
The label that is displayed in the editor, such as a parameter name.
Definition: Protocol.h:1571
clang::clangd::SymbolKindMin
constexpr auto SymbolKindMin
Definition: Protocol.h:362
clang::clangd::TextDocumentIdentifier::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:130
clang::clangd::ClangdCompileCommand
Clangd extension that's used in the 'compilationDatabaseChanges' in workspace/didChangeConfiguration ...
Definition: Protocol.h:503
clang::clangd::ReferenceContext
Definition: Protocol.h:1577
clang::clangd::ErrorCode::ParseError
@ ParseError
clang::clangd::ClangdCompileCommand::workingDirectory
std::string workingDirectory
Definition: Protocol.h:504
clang::clangd::MarkupKind::PlainText
@ PlainText
clang::clangd::ClientCapabilities::DiagnosticFixes
bool DiagnosticFixes
Whether the client accepts diagnostics with codeActions attached inline.
Definition: Protocol.h:409
clang::clangd::MarkupKind::Markdown
@ Markdown
clang::clangd::LSPError::LSPError
LSPError(std::string Message, ErrorCode Code)
Definition: Protocol.h:69
clang::clangd::DidChangeTextDocumentParams::wantDiagnostics
llvm::Optional< bool > wantDiagnostics
Forces diagnostics to be generated, or to not be generated, for this version of the file.
Definition: Protocol.h:726
clang::clangd::SemanticTokensDeltaParams::previousResultId
std::string previousResultId
The previous result id.
Definition: Protocol.h:1644
clang::clangd::SemanticToken::tokenModifiers
unsigned tokenModifiers
each set bit will be looked up in SemanticTokensLegend.tokenModifiers
Definition: Protocol.h:1613
clang::clangd::SemanticTokensParams
Body of textDocument/semanticTokens/full request.
Definition: Protocol.h:1631
E
const Expr * E
Definition: AvoidBindCheck.cpp:88
clang::clangd::Location::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:210
clang::clangd::SymbolTag
SymbolTag
Definition: Protocol.h:1438
clang::clangd::PublishDiagnosticsParams::diagnostics
std::vector< Diagnostic > diagnostics
An array of diagnostic information items.
Definition: Protocol.h:901
clang::clangd::FileEvent::uri
URIForFile uri
The file's URI.
Definition: Protocol.h:750
clang::clangd::TraceLevel
TraceLevel
Definition: Protocol.h:262
clang::clangd::CallHierarchyOutgoingCallsParams::item
CallHierarchyItem item
Definition: Protocol.h:1498
clang::clangd::ClientCapabilities::DiagnosticCategory
bool DiagnosticCategory
Whether the client accepts diagnostics with category attached to it using the "category" extension.
Definition: Protocol.h:418
clang::clangd::InlayHint::kind
InlayHintKind kind
The type of hint, such as a parameter hint.
Definition: Protocol.h:1565
clang::clangd::CompletionTriggerKind::TriggerTriggerForIncompleteCompletions
@ TriggerTriggerForIncompleteCompletions
Completion was re-triggered as the current completion list is incomplete.
clang::clangd::ErrorCode::ServerNotInitialized
@ ServerNotInitialized
clang::clangd::SemanticTokensOrDelta::resultId
std::string resultId
Definition: Protocol.h:1663
clang::clangd::CompletionItemKind::Class
@ Class
clang::clangd::FileEvent
Definition: Protocol.h:748
clang::clangd::CallHierarchyItem::uri
URIForFile uri
The resource identifier of this item.
Definition: Protocol.h:1460
clang::clangd::ShowMessageParams::type
MessageType type
The message type.
Definition: Protocol.h:673
clang::clangd::ResolveTypeHierarchyItemParams::resolve
int resolve
The hierarchy levels to resolve. 0 indicates no level.
Definition: Protocol.h:1430
clang::clangd::CompletionItemKind::Operator
@ Operator
clang::clangd::SemanticTokensParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1633
clang::clangd::CallHierarchyItem::detail
std::string detail
More detaill for this item, e.g. the signature of a function.
Definition: Protocol.h:1457
Location
Definition: Modularize.cpp:382
clang::clangd::CodeAction
A code action represents a change that can be performed in code, e.g.
Definition: Protocol.h:982
clang::clangd::Diagnostic::category
llvm::Optional< std::string > category
The diagnostic's category.
Definition: Protocol.h:868
clang::clangd::SemanticTokensDeltaParams
Body of textDocument/semanticTokens/full/delta request.
Definition: Protocol.h:1640
clang::clangd::MarkupContent::kind
MarkupKind kind
Definition: Protocol.h:1156
clang::clangd::Location
Definition: Protocol.h:208
clang::clangd::ClientCapabilities::CompletionItemKinds
llvm::Optional< CompletionItemKindBitset > CompletionItemKinds
The supported set of CompletionItemKinds for textDocument/completion.
Definition: Protocol.h:448
clang::clangd::DocumentHighlight::operator==
friend bool operator==(const DocumentHighlight &LHS, const DocumentHighlight &RHS)
Definition: Protocol.h:1353
clang::clangd::DocumentOnTypeFormattingParams::textDocument
TextDocumentIdentifier textDocument
The document to format.
Definition: Protocol.h:789
clang::clangd::CompletionItem::deprecated
bool deprecated
Indicates if this item is deprecated.
Definition: Protocol.h:1234
clang::clangd::ProgressParams::value
T value
The progress data.
Definition: Protocol.h:585
clang::clangd::WorkDoneProgressEnd::message
llvm::Optional< std::string > message
Optional, a final message indicating to for example indicate the outcome of the operation.
Definition: Protocol.h:653
clang::clangd::DocumentRangeFormattingParams::textDocument
TextDocumentIdentifier textDocument
The document to format.
Definition: Protocol.h:779
clang::clangd::InitializeParams::processId
llvm::Optional< int > processId
The process Id of the parent process that started the server.
Definition: Protocol.h:545
clang::clangd::SemanticTokensEdit::startToken
unsigned startToken
Definition: Protocol.h:1654
clang::clangd::ASTNode::detail
std::string detail
Brief additional information, such as "||" for the particular operator.
Definition: Protocol.h:1792
clang::clangd::CompletionList
Represents a collection of completion items to be presented in the editor.
Definition: Protocol.h:1257
clang::clangd::ClientCapabilities::CompletionFixes
bool CompletionFixes
Client supports completions with additionalTextEdit near the cursor.
Definition: Protocol.h:427
clang::clangd::CompletionItemKind::Field
@ Field
clang::clangd::InsertTextFormat::PlainText
@ PlainText
The primary text to be inserted is treated as a plain string.
clang::clangd::SymbolKind::Object
@ Object
clang::clangd::CodeActionContext::only
std::vector< std::string > only
Requested kind of actions to return.
Definition: Protocol.h:920
clang::clangd::DiagnosticTag
DiagnosticTag
Definition: Protocol.h:825
clang::clangd::ClientCapabilities
Definition: Protocol.h:402
clang::clangd::SemanticTokensEdit
Describes a a replacement of a contiguous range of semanticTokens.
Definition: Protocol.h:1650
clang::clangd::SemanticTokensOrDelta
This models LSP SemanticTokensDelta | SemanticTokens, which is the result of textDocument/semanticTok...
Definition: Protocol.h:1662
clang::clangd::DocumentRangeFormattingParams::range
Range range
The range to format.
Definition: Protocol.h:782
clang::clangd::Hover
Definition: Protocol.h:1161
clang::clangd::TypeHierarchyDirection::Parents
@ Parents
clang::clangd::ClientCapabilities::WorkspaceSymbolKinds
llvm::Optional< SymbolKindBitset > WorkspaceSymbolKinds
The supported set of SymbolKinds for workspace/symbol.
Definition: Protocol.h:405
clang::clangd::FoldingRange::kind
llvm::Optional< std::string > kind
Definition: Protocol.h:1742
clang::clangd::SelectionRangeParams::positions
std::vector< Position > positions
The positions inside the text document.
Definition: Protocol.h:1676
clang::clangd::DidCloseTextDocumentParams
Definition: Protocol.h:686
clang::clangd::DocumentOnTypeFormattingParams::position
Position position
The position at which this request was sent.
Definition: Protocol.h:792
clang::clangd::SignatureInformation::documentation
MarkupContent documentation
The documentation of this signature. Optional.
Definition: Protocol.h:1291
clang::clangd::SymbolKind::Package
@ Package
clang::clangd::Location::operator<
friend bool operator<(const Location &LHS, const Location &RHS)
Definition: Protocol.h:221
clang::clangd::CodeAction::isPreferred
bool isPreferred
Marks this as a preferred action.
Definition: Protocol.h:1001
clang::clangd::ApplyWorkspaceEditResponse::applied
bool applied
Definition: Protocol.h:1110
clang::clangd::OffsetEncoding::UTF32
@ UTF32
clang::clangd::CallHierarchyOutgoingCall::to
CallHierarchyItem to
The item that is called.
Definition: Protocol.h:1507
clang::clangd::SymbolInformation
Represents information about programming constructs like variables, classes, interfaces etc.
Definition: Protocol.h:1047
clang::clangd::DidChangeConfigurationParams::settings
ConfigurationSettings settings
Definition: Protocol.h:764
Kind
BindArgumentKind Kind
Definition: AvoidBindCheck.cpp:59
clang::clangd::CompletionItem::label
std::string label
The label of this completion item.
Definition: Protocol.h:1192
clang::clangd::CompletionItemKind::Reference
@ Reference
clang::clangd::ClientCapabilities::HierarchicalDocumentSymbol
bool HierarchicalDocumentSymbol
Client supports hierarchical document symbols.
Definition: Protocol.h:431
clang::clangd::Range::operator<
friend bool operator<(const Range &LHS, const Range &RHS)
Definition: Protocol.h:195
clang::clangd::Range::start
Position start
The range's start position.
Definition: Protocol.h:184
clang::clangd::InitializationOptions::compilationDatabasePath
llvm::Optional< std::string > compilationDatabasePath
Definition: Protocol.h:528
clang::clangd::CompletionItemKind::Folder
@ Folder
clang::clangd::DidChangeTextDocumentParams::forceRebuild
bool forceRebuild
Force a complete rebuild of the file, ignoring all cached state.
Definition: Protocol.h:732
clang::clangd::DocumentHighlightKind
DocumentHighlightKind
Definition: Protocol.h:1333
clang::clangd::SymbolInformation::name
std::string name
The name of this symbol.
Definition: Protocol.h:1049
clang::clangd::ClientCapabilities::CompletionDocumentationFormat
MarkupKind CompletionDocumentationFormat
The documentation format that should be used for textDocument/completion.
Definition: Protocol.h:452
clang::clangd::FileChangeType::Created
@ Created
The file got created.
clang::clangd::TextDocumentSyncKind
TextDocumentSyncKind
Defines how the host (editor) should sync document changes to the language server.
Definition: Protocol.h:278
clang::clangd::FoldingRange::endCharacter
unsigned endCharacter
Definition: Protocol.h:1741
clang::clangd::CallHierarchyItem::tags
std::vector< SymbolTag > tags
Tags for this item.
Definition: Protocol.h:1454
clang::clangd::ErrorCode::InternalError
@ InternalError
clang::clangd::ParameterInformation::documentation
std::string documentation
The documentation of this parameter. Optional.
Definition: Protocol.h:1280
clang::clangd::TypeHierarchyItem::kind
SymbolKind kind
The kind of the hierarchy item. For instance, class or interface.
Definition: Protocol.h:1387
clang::clangd::FoldingRangeParams
Definition: Protocol.h:1730
clang::clangd::ClientCapabilities::CompletionSnippets
bool CompletionSnippets
Client supports snippets as insert text.
Definition: Protocol.h:422
clang::clangd::SymbolKind::Operator
@ Operator
clang::clangd::CompletionItem::score
float score
The score that clangd calculates to rank the returned completions.
Definition: Protocol.h:1241
clang::clangd::CompletionItemKind::Color
@ Color
clang::clangd::Location::range
Range range
Definition: Protocol.h:211
clang::clangd::TextDocumentSyncKind::None
@ None
Documents should not be synced at all.
clang::clangd::SemanticToken::deltaLine
unsigned deltaLine
token line number, relative to the previous token
Definition: Protocol.h:1604
clang::clangd::CompletionItemKind::Property
@ Property
clang::clangd::InitializeParams
Definition: Protocol.h:540
clang::clangd::DocumentHighlight::range
Range range
The range this highlight applies to.
Definition: Protocol.h:1341
clang::clangd::URIForFile::fromURI
static llvm::Expected< URIForFile > fromURI(const URI &U, llvm::StringRef HintPath)
Definition: Protocol.cpp:61
clang::clangd::CompletionItemKind::Text
@ Text
clang::clangd::SignatureHelp::argListStart
Position argListStart
Position of the start of the argument list, including opening paren.
Definition: Protocol.h:1317
clang::clangd::TweakArgs::tweakID
std::string tweakID
ID of the tweak that should be executed. Corresponds to Tweak::id().
Definition: Protocol.h:956
clang::clangd::Position::operator<=
friend bool operator<=(const Position &LHS, const Position &RHS)
Definition: Protocol.h:173
clang::clangd::CodeActionParams::textDocument
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Definition: Protocol.h:926
clang::clangd::SymbolKind::Class
@ Class
clang::clangd::CodeActionParams::context
CodeActionContext context
Context carrying additional information.
Definition: Protocol.h:932
clang::clangd::Range::contains
bool contains(Range Rng) const
Definition: Protocol.h:200
clang::clangd::TextDocumentItem
Definition: Protocol.h:244
clang::clangd::ErrorCode
ErrorCode
Definition: Protocol.h:47
clang::clangd::ApplyWorkspaceEditResponse::failureReason
llvm::Optional< std::string > failureReason
Definition: Protocol.h:1111
clang::clangd::URIForFile::operator<
friend bool operator<(const URIForFile &LHS, const URIForFile &RHS)
Definition: Protocol.h:114
clang::clangd::ASTNode::kind
std::string kind
The specific kind of node this is, such as "BinaryOperator".
Definition: Protocol.h:1789
clang::clangd::ASTParams::range
llvm::Optional< Range > range
The position of the node to be dumped.
Definition: Protocol.h:1776
clang::clangd::ParameterInformation::labelOffsets
llvm::Optional< std::pair< unsigned, unsigned > > labelOffsets
Inclusive start and exclusive end offsets withing the containing signature label.
Definition: Protocol.h:1277
clang::clangd::CallHierarchyIncomingCall
Represents an incoming call, e.g. a caller of a method or constructor.
Definition: Protocol.h:1486
clang::clangd::CompletionItem::filterText
std::string filterText
A string that should be used when filtering a set of completion items.
Definition: Protocol.h:1211
clang::clangd::Position::operator==
friend bool operator==(const Position &LHS, const Position &RHS)
Definition: Protocol.h:162
clang::clangd::InitializeParams::rawCapabilities
llvm::json::Object rawCapabilities
The same data as capabilities, but not parsed (to expose to modules).
Definition: Protocol.h:564
clang::clangd::WorkspaceSymbolParams::limit
llvm::Optional< int > limit
Max results to return, overriding global default.
Definition: Protocol.h:1099
clang::clangd::DocumentSymbol::children
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Definition: Protocol.h:1040
clang::clangd::SymbolKindBitset
std::bitset< SymbolKindMax+1 > SymbolKindBitset
Definition: Protocol.h:364
clang::clangd::LSPError::log
void log(llvm::raw_ostream &OS) const override
Definition: Protocol.h:72
clang::clangd::CompletionItemKind::Keyword
@ Keyword
clang::clangd::CompletionItem
Definition: Protocol.h:1189
clang::clangd::SymbolDetails::containerName
std::string containerName
Definition: Protocol.h:1076
clang::clangd::DocumentFormattingParams
Definition: Protocol.h:800
clang::clangd::TypeHierarchyItem::range
Range range
The range enclosing this type hierarchy item not including leading/trailing whitespace but everything...
Definition: Protocol.h:1399
clang::clangd::CompletionItem::textEdit
llvm::Optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
Definition: Protocol.h:1226
clang::clangd::TextDocumentItem::version
llvm::Optional< int64_t > version
The version number of this document (it will strictly increase after each change, including undo/redo...
Definition: Protocol.h:255
clang::clangd::SymbolKind
SymbolKind
A symbol kind.
Definition: Protocol.h:333
clang::clangd::MessageType::Log
@ Log
A log message.
clang::clangd::WorkDoneProgressBegin::cancellable
bool cancellable
Controls if a cancel button should show to allow the user to cancel the long-running operation.
Definition: Protocol.h:602
clang::clangd::CallHierarchyPrepareParams
The parameter of a textDocument/prepareCallHierarchy request.
Definition: Protocol.h:1442
clang::clangd::RenameParams::position
Position position
The position at which this request was sent.
Definition: Protocol.h:1326
clang::clangd::Diagnostic::range
Range range
The range at which the message applies.
Definition: Protocol.h:841
clang::clangd::MarkupContent::value
std::string value
Definition: Protocol.h:1157
clang::clangd::WorkDoneProgressReport::cancellable
llvm::Optional< bool > cancellable
Controls enablement state of a cancel button.
Definition: Protocol.h:630
clang::clangd::DocumentSymbolParams
Definition: Protocol.h:807
clang::clangd::ASTNode::range
llvm::Optional< Range > range
The range of the original source file covered by this node.
Definition: Protocol.h:1800
clang::clangd::OffsetEncoding::UTF8
@ UTF8
clang::clangd::CompletionItemKindBitset
std::bitset< CompletionItemKindMax+1 > CompletionItemKindBitset
Definition: Protocol.h:325
clang::clangd::Position::line
int line
Line position in a document (zero-based).
Definition: Protocol.h:155
clang::clangd::CodeAction::kind
llvm::Optional< std::string > kind
The kind of the code action.
Definition: Protocol.h:988
clang::clangd::SelectionRangeParams
Definition: Protocol.h:1671
clang::clangd::WorkDoneProgressBegin
To start progress reporting a $/progress notification with the following payload must be sent.
Definition: Protocol.h:592
clang::clangd::SymbolKind::TypeParameter
@ TypeParameter
clang::clangd::DiagnosticRelatedInformation::location
Location location
The location of this related diagnostic information.
Definition: Protocol.h:819
clang::clangd::CompletionItemKind::Enum
@ Enum
clang::clangd::CodeAction::title
std::string title
A short, human-readable, title for this code action.
Definition: Protocol.h:984
clang::clangd::DocumentHighlight::kind
DocumentHighlightKind kind
The highlight kind, default is DocumentHighlightKind.Text.
Definition: Protocol.h:1344
clang::clangd::SymbolDetails::name
std::string name
Definition: Protocol.h:1074
clang::clangd::InlayHint
An annotation to be displayed inline next to a range of source code.
Definition: Protocol.h:1552
clang::clangd::SymbolKind::Array
@ Array
clang::clangd::WorkspaceEdit::changes
std::map< std::string, std::vector< TextEdit > > changes
Holds changes to existing resources.
Definition: Protocol.h:938
clang::clangd::TypeHierarchyDirection::Both
@ Both
clang::clangd::CompletionItemKind::Constant
@ Constant
clang::clangd::SignatureInformation::parameters
std::vector< ParameterInformation > parameters
The parameters of this signature.
Definition: Protocol.h:1294
clang::clangd::SymbolKind::Boolean
@ Boolean
clang::clangd::Diagnostic
Definition: Protocol.h:839
clang::clangd::TextDocumentItem::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:246
clang::clangd::WorkDoneProgressEnd
Signals the end of progress reporting.
Definition: Protocol.h:650
clang::clangd::ClientCapabilities::offsetEncoding
llvm::Optional< std::vector< OffsetEncoding > > offsetEncoding
Supported encodings for LSP character offsets. (clangd extension).
Definition: Protocol.h:469
clang::clangd::ClientCapabilities::OffsetsInSignatureHelp
bool OffsetsInSignatureHelp
Client supports processing label offsets instead of a simple label string.
Definition: Protocol.h:439
ns1::ns2::A
@ A
Definition: CategoricalFeature.h:3
clang::clangd::CompletionContext::triggerCharacter
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
Definition: Protocol.h:1142
clang::clangd::Position
Definition: Protocol.h:153
clang::clangd::LSPError
Definition: Protocol.h:63
clang::clangd::FoldingRange::endLine
unsigned endLine
Definition: Protocol.h:1740
clang::clangd::CodeAction::edit
llvm::Optional< WorkspaceEdit > edit
The workspace edit this code action performs.
Definition: Protocol.h:1004
clang::clangd::InitializeParams::capabilities
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool)
Definition: Protocol.h:562
clang::clangd::SymbolDetails::ID
SymbolID ID
Definition: Protocol.h:1085
clang::clangd::WorkDoneProgressReport::title
std::string title
Mandatory title of the progress operation.
Definition: Protocol.h:623
clang::clangd::SymbolKind::Method
@ Method
Diagnostic
DiagnosticCallback Diagnostic
Definition: ConfigCompile.cpp:101
clang::clangd::SemanticTokens::tokens
std::vector< SemanticToken > tokens
The actual tokens.
Definition: Protocol.h:1626
clang::clangd::SymbolKind::Function
@ Function
clang::clangd::InitializationOptions::ConfigSettings
ConfigurationSettings ConfigSettings
Definition: Protocol.h:526
clang::clangd::ExecuteCommandParams::argument
llvm::json::Value argument
Definition: Protocol.h:967
clang::clangd::Diagnostic::tags
llvm::SmallVector< DiagnosticTag, 1 > tags
Additional metadata about the diagnostic.
Definition: Protocol.h:858
clang::clangd::CallHierarchyIncomingCall::fromRanges
std::vector< Range > fromRanges
The range at which the calls appear.
Definition: Protocol.h:1492
clang::clangd::FileStatus::state
std::string state
The human-readable string presents the current state of the file, can be shown in the UI (e....
Definition: Protocol.h:1594
clang::clangd::ClientCapabilities::RenamePrepareSupport
bool RenamePrepareSupport
The client supports testing for validity of rename operations before execution.
Definition: Protocol.h:477
clang::clangd::ClientCapabilities::HoverContentFormat
MarkupKind HoverContentFormat
The content format that should be used for Hover requests.
Definition: Protocol.h:473
clang::clangd::ErrorCode::InvalidParams
@ InvalidParams
clang::clangd::TweakArgs
Arguments for the 'applyTweak' command.
Definition: Protocol.h:950
clang::clangd::TypeHierarchyDirection::Children
@ Children
clang::clangd::ClientCapabilities::SignatureHelpDocumentationFormat
MarkupKind SignatureHelpDocumentationFormat
The documentation format that should be used for textDocument/signatureHelp.
Definition: Protocol.h:444
clang::clangd::SemanticToken
Specifies a single semantic token in the document.
Definition: Protocol.h:1602
clang::clangd::MemoryTree
A tree that can be used to represent memory usage of nested components while preserving the hierarchy...
Definition: MemoryTree.h:32
clang::clangd::Range::operator==
friend bool operator==(const Range &LHS, const Range &RHS)
Definition: Protocol.h:189
clang::clangd::CompletionItemKind::Interface
@ Interface
clang::clangd::CompletionItemKind::Function
@ Function
clang::clangd::ProgressParams
Definition: Protocol.h:580
clang::clangd::CompletionItem::insertText
std::string insertText
A string that should be inserted to a document when selecting this completion.
Definition: Protocol.h:1215
clang::clangd::SignatureInformation::label
std::string label
The label of this signature. Mandatory.
Definition: Protocol.h:1288
clang::clangd::SemanticTokensOrDelta::edits
llvm::Optional< std::vector< SemanticTokensEdit > > edits
Set if we computed edits relative to a previous set of tokens.
Definition: Protocol.h:1665
clang::clangd::SignatureHelp::signatures
std::vector< SignatureInformation > signatures
The resulting signatures.
Definition: Protocol.h:1304
clang::clangd::DocumentSymbolParams::textDocument
TextDocumentIdentifier textDocument
Definition: Protocol.h:809
clang::clangd::DidChangeWatchedFilesParams
Definition: Protocol.h:756
clang::clangd::ASTNode::role
std::string role
The general kind of node, such as "expression" Corresponds to the base AST node type such as Expr.
Definition: Protocol.h:1785
clang::clangd::PublishDiagnosticsParams::uri
URIForFile uri
The URI for which diagnostic information is reported.
Definition: Protocol.h:899
clang::clangd::toJSON
llvm::json::Value toJSON(const FuzzyFindRequest &Request)
Definition: Index.cpp:49
clang::clangd::SemanticTokensEdit::deleteTokens
unsigned deleteTokens
Definition: Protocol.h:1655
clang::clangd::InlayHintKind::TypeHint
@ TypeHint
The hint corresponds to information about a deduced type.
clang::clangd::CompletionList::items
std::vector< CompletionItem > items
The completion items.
Definition: Protocol.h:1263
clang::clangd::WorkDoneProgressReport::message
llvm::Optional< std::string > message
Optional, more detailed associated progress message.
Definition: Protocol.h:637
clang::clangd::Hover::range
llvm::Optional< Range > range
An optional range is a range inside a text document that is used to visualize a hover,...
Definition: Protocol.h:1167
clang::clangd::Location::operator!=
friend bool operator!=(const Location &LHS, const Location &RHS)
Definition: Protocol.h:217
clang::clangd::SemanticToken::deltaStart
unsigned deltaStart
token start character, relative to the previous token (relative to 0 or the previous token's start if...
Definition: Protocol.h:1607
clang::clangd::CompletionItem::kind
CompletionItemKind kind
The kind of this completion item.
Definition: Protocol.h:1196
clang::clangd::SymbolKind::Interface
@ Interface
clang::clangd::OffsetEncoding::UTF16
@ UTF16
clang::clangd::TypeHierarchyItem::name
std::string name
The human readable name of the hierarchy item.
Definition: Protocol.h:1380
clang::clangd::SemanticToken::tokenType
unsigned tokenType
will be looked up in SemanticTokensLegend.tokenTypes
Definition: Protocol.h:1611
clang::clangd::FileChangeType::Deleted
@ Deleted
The file got deleted.
clang::clangd::CallHierarchyOutgoingCall
Represents an outgoing call, e.g.
Definition: Protocol.h:1505
clang::clangd::fromJSON
bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request, llvm::json::Path P)
Definition: Index.cpp:34
clang::clangd::TextDocumentIdentifier
Definition: Protocol.h:128
clang::clangd::DocumentSymbol::detail
std::string detail
More detail for this symbol, e.g the signature of a function.
Definition: Protocol.h:1021
clang::clangd::DocumentRangeFormattingParams
Definition: Protocol.h:777
clang::clangd::WorkDoneProgressCreateParams::token
llvm::json::Value token
The token to be used to report progress.
Definition: Protocol.h:576
clang::clangd::TweakArgs::file
URIForFile file
A file provided by the client on a textDocument/codeAction request.
Definition: Protocol.h:952
clang::clangd::Location::operator==
friend bool operator==(const Location &LHS, const Location &RHS)
Definition: Protocol.h:213
clang::clangd::FileStatus::uri
URIForFile uri
The text document's URI.
Definition: Protocol.h:1591
clang::clangd::LSPError::Code
ErrorCode Code
Definition: Protocol.h:66
clang::clangd::CallHierarchyItem::data
std::string data
An optional 'data' field, which can be used to identify a call hierarchy item in an incomingCalls or ...
Definition: Protocol.h:1473
clang::clangd::ExecuteCommandParams::command
std::string command
The identifier of the actual command handler.
Definition: Protocol.h:963
clang::clangd::FoldingRangeParams::textDocument
TextDocumentIdentifier textDocument
Definition: Protocol.h:1731
clang::clangd::indexSymbolKindToSymbolKind
SymbolKind indexSymbolKindToSymbolKind(index::SymbolKind Kind)
Definition: Protocol.cpp:253
clang::clangd::Diagnostic::data
llvm::json::Object data
A data entry field that is preserved between a textDocument/publishDiagnostics notification andtextDo...
Definition: Protocol.h:880
clang::clangd::ErrorCode::UnknownErrorCode
@ UnknownErrorCode
clang::clangd::DocumentSymbol::selectionRange
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition: Protocol.h:1037
clang::find_all_symbols::SymbolInfo::SymbolKind
SymbolKind
The SymbolInfo Type.
Definition: SymbolInfo.h:30
clang::clangd::TextDocumentItem::languageId
std::string languageId
The text document's language identifier.
Definition: Protocol.h:249
clang::clangd::CompletionItem::sortText
std::string sortText
A string that should be used when comparing this item with other items.
Definition: Protocol.h:1207
clang::clangd::InsertTextFormat::Missing
@ Missing
clang::clangd::SymbolTag::Deprecated
@ Deprecated
clang::clangd::Position::character
int character
Character offset on a line in a document (zero-based).
Definition: Protocol.h:160
clang::clangd::ReferenceParams::context
ReferenceContext context
Definition: Protocol.h:1583
clang::clangd::NoParams
Definition: Protocol.h:269
clang::clangd::CompletionContext::triggerKind
CompletionTriggerKind triggerKind
How the completion was triggered.
Definition: Protocol.h:1139
clang::clangd::CompletionTriggerKind::Invoked
@ Invoked
Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e....
clang::clangd::CompletionItemKind::Struct
@ Struct
llvm::format_provider< clang::clangd::Position >::format
static void format(const clang::clangd::Position &Pos, raw_ostream &OS, StringRef Style)
Definition: Protocol.h:1812
clang::clangd::TextDocumentPositionParams::position
Position position
The position inside the text document.
Definition: Protocol.h:1121
clang::clangd::Range::end
Position end
The range's end position.
Definition: Protocol.h:187
clang::clangd::InitializationOptions::fallbackFlags
std::vector< std::string > fallbackFlags
Definition: Protocol.h:532
clang::clangd::Key
Values in a Context are indexed by typed keys.
Definition: Context.h:40
clang::clangd::CompletionItemKindMax
constexpr auto CompletionItemKindMax
Definition: Protocol.h:323
clang::clangd::Command::title
std::string title
Definition: Protocol.h:973
clang::clangd::DocumentSymbol
Represents programming constructs like variables, classes, interfaces etc.
Definition: Protocol.h:1016
clang::clangd::SemanticTokensOrDelta::tokens
llvm::Optional< std::vector< SemanticToken > > tokens
Set if we computed a fresh set of tokens.
Definition: Protocol.h:1667
clang::clangd::URIForFile
Definition: Protocol.h:81
clang::clangd::CompletionItemKind::Method
@ Method
clang::clangd::SemanticToken::length
unsigned length
the length of the token. A token cannot be multiline
Definition: Protocol.h:1609
clang::clangd::URIForFile::uri
std::string uri() const
Definition: Protocol.h:104
clang::clangd::ErrorCode::InvalidRequest
@ InvalidRequest
clang::clangd::DidChangeConfigurationParams
Definition: Protocol.h:763
clang::clangd::SymbolKind::Number
@ Number
clang::clangd::SymbolKind::Enum
@ Enum
clang::clangd::DidChangeWatchedFilesParams::changes
std::vector< FileEvent > changes
The actual file events.
Definition: Protocol.h:758
clang::clangd::TypeHierarchyItem::children
llvm::Optional< std::vector< TypeHierarchyItem > > children
If this type hierarchy item is resolved, it contains the direct children of the current item.
Definition: Protocol.h:1414
clang::clangd::SelectionRange
Definition: Protocol.h:1681
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:2160
clang::clangd::CodeAction::command
llvm::Optional< Command > command
A command this code action executes.
Definition: Protocol.h:1008
clang::clangd::DocumentFormattingParams::textDocument
TextDocumentIdentifier textDocument
The document to format.
Definition: Protocol.h:802
clang::clangd::CompletionItemKind
CompletionItemKind
The kind of a completion entry.
Definition: Protocol.h:291
clang::clangd::URIForFile::operator==
friend bool operator==(const URIForFile &LHS, const URIForFile &RHS)
Definition: Protocol.h:106
clang::clangd::TypeHierarchyItem::uri
URIForFile uri
The URI of the text document where this type hierarchy item belongs to.
Definition: Protocol.h:1393
clang::clangd::DocumentHighlightKind::Write
@ Write
clang::clangd::SymbolDetails
Represents information about identifier.
Definition: Protocol.h:1073
clang::clangd::ConfigurationSettings
Clangd extension: parameters configurable at any time, via the workspace/didChangeConfiguration notif...
Definition: Protocol.h:513
clang::clangd::DocumentLinkParams
Parameters for the document link request.
Definition: Protocol.h:1695
clang::clangd::SymbolDetails::USR
std::string USR
Unified Symbol Resolution identifier This is an opaque string uniquely identifying a symbol.
Definition: Protocol.h:1083
clang::clangd::TextDocumentSyncKind::Incremental
@ Incremental
Documents are synced by sending the full content on open.
clang::clangd::TextDocumentSyncKind::Full
@ Full
Documents are synced by always sending the full content of the document.
clang::clangd::ExecuteCommandParams
Definition: Protocol.h:961
clang::clangd::SymbolKind::Module
@ Module
SymbolKind
clang::find_all_symbols::SymbolInfo::SymbolKind SymbolKind
Definition: SymbolInfo.cpp:19
clang::clangd::SignatureHelp::activeSignature
int activeSignature
The active signature.
Definition: Protocol.h:1307
clang::clangd::TextDocumentItem::text
std::string text
The content of the opened text document.
Definition: Protocol.h:258
clang::clangd::InitializeParams::initializationOptions
InitializationOptions initializationOptions
User-provided initialization options.
Definition: Protocol.h:570
clang::clangd::LSPDiagnosticCompare::operator()
bool operator()(const Diagnostic &LHS, const Diagnostic &RHS) const
Definition: Protocol.h:890
clang::clangd::SymbolInformation::score
llvm::Optional< float > score
The score that clangd calculates to rank the returned symbols.
Definition: Protocol.h:1066
clang::clangd::Deprecated
@ Deprecated
Deprecated or obsolete code.
Definition: Protocol.h:834
clang::clangd::CallHierarchyIncomingCallsParams
The parameter of a callHierarchy/incomingCalls request.
Definition: Protocol.h:1479
clang::clangd::TypeHierarchyParams::resolve
int resolve
The hierarchy levels to resolve. 0 indicates no level.
Definition: Protocol.h:1370
clang::clangd::CompletionItemKind::File
@ File
clang::clangd::CodeActionContext::diagnostics
std::vector< Diagnostic > diagnostics
An array of diagnostics known on the client side overlapping the range provided to the textDocument/c...
Definition: Protocol.h:914
clang::clangd::SelectionRangeParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1673
clang::clangd::WorkDoneProgressReport
Reporting progress is done using the following payload.
Definition: Protocol.h:618
clang::clangd::PublishDiagnosticsParams
Definition: Protocol.h:897
clang::clangd::CompletionItem::insertTextFormat
InsertTextFormat insertTextFormat
The format of the insert text.
Definition: Protocol.h:1219
clang::clangd::ClientCapabilities::WorkDoneProgress
bool WorkDoneProgress
The client supports progress notifications.
Definition: Protocol.h:481
clang::clangd::MarkupKind
MarkupKind
Definition: Protocol.h:392
clang::clangd::CodeAction::diagnostics
llvm::Optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
Definition: Protocol.h:994
clang::clangd::MessageType
MessageType
Definition: Protocol.h:657
clang::clangd::CompletionItem::additionalTextEdits
std::vector< TextEdit > additionalTextEdits
An optional array of additional text edits that are applied when selecting this completion.
Definition: Protocol.h:1231
clang::clangd::TypeHierarchyDirection
TypeHierarchyDirection
Definition: Protocol.h:1361
clang::clangd::TypeHierarchyParams
The type hierarchy params is an extension of the TextDocumentPositionsParams with optional properties...
Definition: Protocol.h:1368
clang::clangd::SymbolKind::Variable
@ Variable
clang::clangd::TypeHierarchyItem
Definition: Protocol.h:1378
clang::clangd::DocumentHighlight::operator<
friend bool operator<(const DocumentHighlight &LHS, const DocumentHighlight &RHS)
Definition: Protocol.h:1346
clang::clangd::Hover::contents
MarkupContent contents
The hover's content.
Definition: Protocol.h:1163
clang::clangd::URI::toString
std::string toString() const
Returns a string URI with all components percent-encoded.
Definition: URI.cpp:162
clang::clangd::DidChangeTextDocumentParams
Definition: Protocol.h:713
clang::clangd::CompletionTriggerKind
CompletionTriggerKind
Definition: Protocol.h:1126
clang::clangd::SymbolKind::Null
@ Null
clang::clangd::ConfigurationSettings::compilationDatabaseChanges
std::map< std::string, ClangdCompileCommand > compilationDatabaseChanges
Definition: Protocol.h:516
clang::clangd::TypeHierarchyItem::detail
llvm::Optional< std::string > detail
Optional detail for the hierarchy item.
Definition: Protocol.h:1384
clang::clangd::TypeHierarchyItem::deprecated
bool deprecated
true if the hierarchy item is deprecated. Otherwise, false.
Definition: Protocol.h:1390
clang::clangd::SignatureInformation
Represents the signature of something callable.
Definition: Protocol.h:1285
clang::clangd::ClientCapabilities::SemanticTokenRefreshSupport
bool SemanticTokenRefreshSupport
Whether the client implementation supports a refresh request sent from the server to the client.
Definition: Protocol.h:495
clang::clangd::ClientCapabilities::CodeActionStructure
bool CodeActionStructure
Client supports CodeAction return value for textDocument/codeAction.
Definition: Protocol.h:456
clang::clangd::ASTParams
Payload for textDocument/ast request.
Definition: Protocol.h:1769
clang::clangd::ErrorCode::RequestCancelled
@ RequestCancelled
clang::clangd::DocumentSymbol::kind
SymbolKind kind
The kind of this symbol.
Definition: Protocol.h:1024
clang::clangd::SelectionRange::range
Range range
The range of this selection range.
Definition: Protocol.h:1685
clang::clangd::CompletionItemKind::EnumMember
@ EnumMember
clang::clangd::WorkDoneProgressBegin::percentage
bool percentage
Optional progress percentage to display (value 100 is considered 100%).
Definition: Protocol.h:613
clang::clangd::InlayHintsParams::range
llvm::Optional< Range > range
If set, requests inlay hints for only part of the document.
Definition: Protocol.h:1523
clang::clangd::CompletionItemKind::Snippet
@ Snippet
clang::clangd::DidChangeTextDocumentParams::contentChanges
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
Definition: Protocol.h:720
clang::clangd::DidChangeTextDocumentParams::textDocument
VersionedTextDocumentIdentifier textDocument
The document that did change.
Definition: Protocol.h:717
clang::clangd::TypeHierarchyParams::direction
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
Definition: Protocol.h:1373
clang::clangd::TextDocumentPositionParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1118
clang::clangd::Position::operator<
friend bool operator<(const Position &LHS, const Position &RHS)
Definition: Protocol.h:169
clang::clangd::DidSaveTextDocumentParams::textDocument
TextDocumentIdentifier textDocument
The document that was saved.
Definition: Protocol.h:695
clang::clangd::InlayHintKind::ParameterHint
@ ParameterHint
The hint corresponds to parameter information.
clang::clangd::WorkspaceSymbolParams
The parameters of a Workspace Symbol Request.
Definition: Protocol.h:1092
clang::clangd::SemanticTokensEdit::tokens
std::vector< SemanticToken > tokens
Definition: Protocol.h:1656
clang::clangd::CompletionParams
Definition: Protocol.h:1146
clang::clangd::LSPError::Message
std::string Message
Definition: Protocol.h:65
clang::clangd::ClangdCompileCommand::compilationCommand
std::vector< std::string > compilationCommand
Definition: Protocol.h:505
clang::clangd::CompletionItem::detail
std::string detail
A human-readable string with additional information about this item, like type or symbol information.
Definition: Protocol.h:1200
clang::clangd::Range
Definition: Protocol.h:182
clang::clangd::FileEvent::type
FileChangeType type
The change type.
Definition: Protocol.h:752
clang::clangd::SignatureHelp
Represents the signature of a callable.
Definition: Protocol.h:1301
clang::clangd::FileChangeType
FileChangeType
Definition: Protocol.h:737
clang::clangd::SemanticTokens
A versioned set of tokens.
Definition: Protocol.h:1618
clang::clangd::VersionedTextDocumentIdentifier::version
llvm::Optional< std::int64_t > version
The version number of this document.
Definition: Protocol.h:147
clang::clangd::URIForFile::operator!=
friend bool operator!=(const URIForFile &LHS, const URIForFile &RHS)
Definition: Protocol.h:110
C
const Criteria C
Definition: FunctionCognitiveComplexityCheck.cpp:93
clang::clangd::ShowMessageParams::message
std::string message
The actual message.
Definition: Protocol.h:675
clang::clangd::Diagnostic::message
std::string message
The diagnostic's message.
Definition: Protocol.h:855
clang::clangd::Range::operator!=
friend bool operator!=(const Range &LHS, const Range &RHS)
Definition: Protocol.h:192
clang::clangd::URIForFile::URIForFile
URIForFile()=default
clang::clangd::SelectionRange::parent
std::unique_ptr< SelectionRange > parent
The parent selection range containing this range.
Definition: Protocol.h:1690
clang::clangd::URIForFile::canonicalize
static URIForFile canonicalize(llvm::StringRef AbsPath, llvm::StringRef TUPath)
Canonicalizes AbsPath via URI.
Definition: Protocol.cpp:48
clang::clangd::MessageType::Info
@ Info
An information message.
clang::clangd::ApplyWorkspaceEditResponse
Definition: Protocol.h:1109
MemoryTree.h
clang::clangd::CompletionItemKind::Constructor
@ Constructor
clang::clangd::Diagnostic::severity
int severity
The diagnostic's severity.
Definition: Protocol.h:845
clang::clangd::ProgressParams::token
llvm::json::Value token
The progress token provided by the client or server.
Definition: Protocol.h:582
clang::clangd::ParameterInformation::labelString
std::string labelString
The label of this parameter. Ignored when labelOffsets is set.
Definition: Protocol.h:1271
clang::clangd::InitializeParams::trace
llvm::Optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
Definition: Protocol.h:567
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::clangd::PublishDiagnosticsParams::version
llvm::Optional< int64_t > version
The version number of the document the diagnostics are published for.
Definition: Protocol.h:903
clang::clangd::Diagnostic::codeActions
llvm::Optional< std::vector< CodeAction > > codeActions
Clangd extension: code actions related to this diagnostic.
Definition: Protocol.h:873
clang::clangd::WorkDoneProgressReport::percentage
llvm::Optional< unsigned > percentage
Optional progress percentage to display (value 100 is considered 100%).
Definition: Protocol.h:645
OS
llvm::raw_string_ostream OS
Definition: TraceTests.cpp:163
clang::clangd::FoldingRange
Stores information about a region of code that can be folded.
Definition: Protocol.h:1737
clang::clangd::CodeAction::REFACTOR_KIND
const static llvm::StringLiteral REFACTOR_KIND
Definition: Protocol.h:990
clang::clangd::DidSaveTextDocumentParams
Definition: Protocol.h:693
clang::clangd::TypeHierarchyItem::parents
llvm::Optional< std::vector< TypeHierarchyItem > > parents
If this type hierarchy item is resolved, it contains the direct parents.
Definition: Protocol.h:1409
clang::clangd::CallHierarchyItem::range
Range range
The range enclosing this symbol not including leading / trailing whitespace but everything else,...
Definition: Protocol.h:1464
clang::clangd::OffsetEncoding
OffsetEncoding
Definition: Protocol.h:376
clang::clangd::TextDocumentContentChangeEvent::range
llvm::Optional< Range > range
The range of the document that changed.
Definition: Protocol.h:702
clang::clangd::FileStatus
Clangd extension: indicates the current state of the file in clangd, sent from server via the textDoc...
Definition: Protocol.h:1589
clang::clangd::TextDocumentContentChangeEvent
Definition: Protocol.h:700
clang::clangd::WorkspaceSymbolParams::query
std::string query
A query string to filter symbols by.
Definition: Protocol.h:1095
clang::clangd::DocumentSymbol::deprecated
bool deprecated
Indicates if this symbol is deprecated.
Definition: Protocol.h:1027
clang::clangd::ClientCapabilities::TheiaSemanticHighlighting
bool TheiaSemanticHighlighting
Client supports Theia semantic highlighting extension.
Definition: Protocol.h:466
clang::clangd::CodeActionParams
Definition: Protocol.h:924
clang::clangd::operator<
bool operator<(const Ref &L, const Ref &R)
Definition: Ref.h:97
clang::clangd::TextDocumentPositionParams
Definition: Protocol.h:1116
clang::clangd::InitializeParams::rootPath
llvm::Optional< std::string > rootPath
The rootPath of the workspace.
Definition: Protocol.h:551
clang::clangd::InitializationOptions
Clangd extension: parameters configurable at initialize time.
Definition: Protocol.h:523
clang::clangd::DidCloseTextDocumentParams::textDocument
TextDocumentIdentifier textDocument
The document that was closed.
Definition: Protocol.h:688
clang::clangd::CallHierarchyItem
Represents programming constructs like functions or constructors in the context of call hierarchy.
Definition: Protocol.h:1446
clang::clangd::Diagnostic::code
std::string code
The diagnostic's code. Can be omitted.
Definition: Protocol.h:848
clang::clangd::SymbolKind::EnumMember
@ EnumMember
clang::clangd::RenameParams::textDocument
TextDocumentIdentifier textDocument
The document that was opened.
Definition: Protocol.h:1323
clang::clangd::CallHierarchyIncomingCall::from
CallHierarchyItem from
The item that makes the call.
Definition: Protocol.h:1488
clang::clangd::DocumentOnTypeFormattingParams
Definition: Protocol.h:787
clang::clangd::TextEdit
Definition: Protocol.h:228
clang::clangd::SignatureHelp::activeParameter
int activeParameter
The active parameter of the active signature.
Definition: Protocol.h:1310
clang::clangd::OffsetEncoding::UnsupportedEncoding
@ UnsupportedEncoding
clang::clangd::SymbolInformation::containerName
std::string containerName
The name of the symbol containing this symbol.
Definition: Protocol.h:1058
clang::clangd::RenameParams
Definition: Protocol.h:1321
clang::clangd::Range::contains
bool contains(Position Pos) const
Definition: Protocol.h:199
clang::clangd::ApplyWorkspaceEditParams
Definition: Protocol.h:1104
clang::clangd::CompletionParams::limit
llvm::Optional< int > limit
Max results to return, overriding global default.
Definition: Protocol.h:1151
clang::clangd::SymbolKind::Constant
@ Constant
clang::clangd::URIForFile::file
llvm::StringRef file() const
Retrieves absolute path to the file.
Definition: Protocol.h:101
clang::clangd::TraceLevel::Off
@ Off
clang::clangd::SymbolKind::Namespace
@ Namespace
clang::clangd::operator==
bool operator==(const Inclusion &LHS, const Inclusion &RHS)
Definition: Headers.cpp:346
clang::clangd::ClientCapabilities::ImplicitProgressCreation
bool ImplicitProgressCreation
The client supports implicit $/progress work-done progress streams, without a preceding window/workDo...
Definition: Protocol.h:487
clang::clangd::DidOpenTextDocumentParams
Definition: Protocol.h:679
clang::clangd::TraceLevel::Verbose
@ Verbose
clang::clangd::DocumentSymbol::name
std::string name
The name of this symbol.
Definition: Protocol.h:1018
clang::clangd::TweakArgs::selection
Range selection
A selection provided by the client on a textDocument/codeAction request.
Definition: Protocol.h:954
clang::clangd::ErrorCode::MethodNotFound
@ MethodNotFound
clang::clangd::CompletionItemKind::Missing
@ Missing
clang::clangd::CompletionItemKind::Module
@ Module
clang::clangd::DocumentHighlightKind::Read
@ Read
clang::clangd::CompletionParams::context
CompletionContext context
Definition: Protocol.h:1147
clang::clangd::InsertTextFormat
InsertTextFormat
Defines whether the insert text in a completion item should be interpreted as plain text or a snippet...
Definition: Protocol.h:1173
Pos
Position Pos
Definition: SourceCode.cpp:657
clang::clangd::ReferenceParams
Definition: Protocol.h:1582
clang::clangd::InlayHintKind
InlayHintKind
A set of predefined hint kinds.
Definition: Protocol.h:1528
URI.h
clang::clangd::SymbolKind::File
@ File
clang::clangd::ASTNode::arcana
std::string arcana
A one-line dump of detailed information about the node.
Definition: Protocol.h:1797
clang::clangd::ParameterInformation
A single parameter of a particular signature.
Definition: Protocol.h:1268
clang::clangd::Diagnostic::relatedInformation
llvm::Optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
An array of related diagnostic information, e.g.
Definition: Protocol.h:862
clang::clangd::CompletionTriggerKind::TriggerCharacter
@ TriggerCharacter
Completion was triggered by a trigger character specified by the triggerCharacters properties of the ...
clang::clangd::DocumentLinkParams::textDocument
TextDocumentIdentifier textDocument
The document to provide document links for.
Definition: Protocol.h:1697
clang::clangd::LSPError::ID
static char ID
Definition: Protocol.h:67
clang::clangd::FoldingRange::startCharacter
unsigned startCharacter
Definition: Protocol.h:1739
clang::clangd::InlayHintsParams::textDocument
TextDocumentIdentifier textDocument
The text document for which inlay hints are requested.
Definition: Protocol.h:1520
clang::clangd::TextEdit::newText
std::string newText
The string to be inserted.
Definition: Protocol.h:235
clang::clangd::LSPDiagnosticCompare
A LSP-specific comparator used to find diagnostic in a container like std:map.
Definition: Protocol.h:889
clang::clangd::Unnecessary
@ Unnecessary
Unused or unnecessary code.
Definition: Protocol.h:830
clang::clangd::URI::createFile
static URI createFile(llvm::StringRef AbsolutePath)
This creates a file:// URI for AbsolutePath. The path must be absolute.
Definition: URI.cpp:240
clang::clangd::SymbolInformation::location
Location location
The location of this symbol.
Definition: Protocol.h:1055
Out
CompiledFragmentImpl & Out
Definition: ConfigCompile.cpp:100
clang::clangd::ClientCapabilities::CancelsStaleRequests
bool CancelsStaleRequests
Whether the client claims to cancel stale requests.
Definition: Protocol.h:491
clang::clangd::SemanticTokensDeltaParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1642
clang::clangd::MarkupContent
Definition: Protocol.h:1155
clang::clangd::ASTNode::children
std::vector< ASTNode > children
Nodes nested within this one, such as the operands of a BinaryOperator.
Definition: Protocol.h:1802
clang::clangd::SymbolID
Definition: SymbolID.h:32
clang::clangd::DocumentHighlightKind::Text
@ Text
clang::clangd::InitializeParams::rootUri
llvm::Optional< URIForFile > rootUri
The rootUri of the workspace.
Definition: Protocol.h:556
clang::clangd::DiagnosticRelatedInformation
Represents a related message and source code location for a diagnostic.
Definition: Protocol.h:817
clang::clangd::ResolveTypeHierarchyItemParams::direction
TypeHierarchyDirection direction
The direction of the hierarchy levels to resolve.
Definition: Protocol.h:1433
clang::clangd::CompletionContext
Definition: Protocol.h:1137
clang::clangd::ErrorCode::ContentModified
@ ContentModified
clang::clangd::TextDocumentContentChangeEvent::text
std::string text
The new text of the range/document.
Definition: Protocol.h:708
clang::clangd::ASTParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1771
Tag
HTMLTag Tag
Definition: HTMLGenerator.cpp:90
clang::clangd::CallHierarchyOutgoingCallsParams
The parameter of a callHierarchy/outgoingCalls request.
Definition: Protocol.h:1497
clang::clangd::CompletionItemKind::TypeParameter
@ TypeParameter
clang::clangd::ASTNode
Simplified description of a clang AST node.
Definition: Protocol.h:1782
clang::clangd::CompletionItemKindMin
constexpr auto CompletionItemKindMin
Definition: Protocol.h:321
clang::clangd::ResolveTypeHierarchyItemParams::item
TypeHierarchyItem item
The item to resolve.
Definition: Protocol.h:1427
clang::clangd::CallHierarchyOutgoingCall::fromRanges
std::vector< Range > fromRanges
The range at which this item is called.
Definition: Protocol.h:1511
clang::clangd::ApplyWorkspaceEditParams::edit
WorkspaceEdit edit
Definition: Protocol.h:1105
clang::clangd::TextEdit::range
Range range
The range of the text document to be manipulated.
Definition: Protocol.h:231
clang::clangd::ShowMessageParams
The show message notification is sent from a server to a client to ask the client to display a partic...
Definition: Protocol.h:671
clang::clangd::MessageType::Error
@ Error
An error message.
clang::clangd::CodeAction::INFO_KIND
const static llvm::StringLiteral INFO_KIND
Definition: Protocol.h:991
clang::clangd::SymbolKind::Constructor
@ Constructor
clang::clangd::CodeActionContext
Definition: Protocol.h:907
clang::clangd::CompletionItemKind::Variable
@ Variable
clang::clangd::CallHierarchyIncomingCallsParams::item
CallHierarchyItem item
Definition: Protocol.h:1480
clang::clangd::URI
A URI describes the location of a source file.
Definition: URI.h:28
clang::clangd::CompletionItemKind::Value
@ Value
clang::clangd::SymbolInformation::kind
SymbolKind kind
The kind of this symbol.
Definition: Protocol.h:1052
clang::clangd::ClientCapabilities::HasSignatureHelp
bool HasSignatureHelp
Client supports signature help.
Definition: Protocol.h:435
clang::clangd::VersionedTextDocumentIdentifier
Definition: Protocol.h:136
clang::clangd::WorkDoneProgressBegin::title
std::string title
Mandatory title of the progress operation.
Definition: Protocol.h:597
clang::clangd::CodeActionParams::range
Range range
The range for which the command was invoked.
Definition: Protocol.h:929
clang::clangd::SymbolKind::String
@ String
clang::clangd::FileChangeType::Changed
@ Changed
The file got changed.
clang::clangd::InsertTextFormat::Snippet
@ Snippet
The primary text to be inserted is treated as a snippet.
clang::clangd::DiagnosticRelatedInformation::message
std::string message
The message of this related diagnostic information.
Definition: Protocol.h:821
clang::clangd::InlayHint::position
Position position
The position between two characters where the hint should be displayed.
Definition: Protocol.h:1556
clang::clangd::InlayHint::range
Range range
The range of source code to which the hint applies.
Definition: Protocol.h:1562
Value
static constexpr bool Value
Definition: SuspiciousCallArgumentCheck.cpp:72
clang::clangd::Position::operator!=
friend bool operator!=(const Position &LHS, const Position &RHS)
Definition: Protocol.h:166
clang::clangd::CallHierarchyItem::name
std::string name
The name of this item.
Definition: Protocol.h:1448
clang::clangd::TypeHierarchyItem::data
llvm::Optional< std::string > data
An optional 'data' field, which can be used to identify a type hierarchy item in a resolve request.
Definition: Protocol.h:1418
clang::clangd::RenameParams::newName
std::string newName
The new name of the symbol.
Definition: Protocol.h:1329
clang::clangd::SymbolKind::Property
@ Property
clang::clangd::SymbolKind::Struct
@ Struct
Path
std::vector< HeaderHandle > Path
Definition: PreprocessorTracker.cpp:525
clang::clangd::InlayHintsParams
The parameter of a clangd/inlayHints request.
Definition: Protocol.h:1518
clang::clangd::adjustKindToCapability
SymbolKind adjustKindToCapability(SymbolKind Kind, SymbolKindBitset &SupportedSymbolKinds)
Definition: Protocol.cpp:235
clang::clangd::TextDocumentContentChangeEvent::rangeLength
llvm::Optional< int > rangeLength
The length of the range that got replaced.
Definition: Protocol.h:705
clang::clangd::CallHierarchyItem::kind
SymbolKind kind
The kind of this item.
Definition: Protocol.h:1451
clang::clangd::CodeAction::QUICKFIX_KIND
const static llvm::StringLiteral QUICKFIX_KIND
Definition: Protocol.h:989
clang::clangd::ResolveTypeHierarchyItemParams
Parameters for the typeHierarchy/resolve request.
Definition: Protocol.h:1425
clang::clangd::Event
An Event<T> allows events of type T to be broadcast to listeners.
Definition: Function.h:31
clang::clangd::CompletionItem::documentation
llvm::Optional< MarkupContent > documentation
A human-readable string that represents a doc-comment.
Definition: Protocol.h:1203
clang::clangd::WorkDoneProgressCreateParams
Definition: Protocol.h:574