clang-tools  15.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 /// Structure to capture a description for an error code.
840  /// An URI to open with more information about the diagnostic error.
841  std::string href;
842 };
844 
845 struct CodeAction;
846 struct Diagnostic {
847  /// The range at which the message applies.
849 
850  /// The diagnostic's severity. Can be omitted. If omitted it is up to the
851  /// client to interpret diagnostics as error, warning, info or hint.
852  int severity = 0;
853 
854  /// The diagnostic's code. Can be omitted.
855  std::string code;
856 
857  /// An optional property to describe the error code.
858  llvm::Optional<CodeDescription> codeDescription;
859 
860  /// A human-readable string describing the source of this
861  /// diagnostic, e.g. 'typescript' or 'super lint'.
862  std::string source;
863 
864  /// The diagnostic's message.
865  std::string message;
866 
867  /// Additional metadata about the diagnostic.
868  llvm::SmallVector<DiagnosticTag, 1> tags;
869 
870  /// An array of related diagnostic information, e.g. when symbol-names within
871  /// a scope collide all definitions can be marked via this property.
872  llvm::Optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
873 
874  /// The diagnostic's category. Can be omitted.
875  /// An LSP extension that's used to send the name of the category over to the
876  /// client. The category typically describes the compilation stage during
877  /// which the issue was produced, e.g. "Semantic Issue" or "Parse Issue".
878  llvm::Optional<std::string> category;
879 
880  /// Clangd extension: code actions related to this diagnostic.
881  /// Only with capability textDocument.publishDiagnostics.codeActionsInline.
882  /// (These actions can also be obtained using textDocument/codeAction).
883  llvm::Optional<std::vector<CodeAction>> codeActions;
884 
885  /// A data entry field that is preserved between a
886  /// `textDocument/publishDiagnostics` notification
887  /// and `textDocument/codeAction` request.
888  /// Mutating users should associate their data with a unique key they can use
889  /// to retrieve later on.
890  llvm::json::Object data;
891 };
893 
894 /// A LSP-specific comparator used to find diagnostic in a container like
895 /// std:map.
896 /// We only use the required fields of Diagnostic to do the comparison to avoid
897 /// any regression issues from LSP clients (e.g. VScode), see
898 /// https://git.io/vbr29
900  bool operator()(const Diagnostic &LHS, const Diagnostic &RHS) const {
901  return std::tie(LHS.range, LHS.message) < std::tie(RHS.range, RHS.message);
902  }
903 };
905 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Diagnostic &);
906 
908  /// The URI for which diagnostic information is reported.
910  /// An array of diagnostic information items.
911  std::vector<Diagnostic> diagnostics;
912  /// The version number of the document the diagnostics are published for.
913  llvm::Optional<int64_t> version;
914 };
916 
918  /// An array of diagnostics known on the client side overlapping the range
919  /// provided to the `textDocument/codeAction` request. They are provided so
920  /// that the server knows which errors are currently presented to the user for
921  /// the given range. There is no guarantee that these accurately reflect the
922  /// error state of the resource. The primary parameter to compute code actions
923  /// is the provided range.
924  std::vector<Diagnostic> diagnostics;
925 
926  /// Requested kind of actions to return.
927  ///
928  /// Actions not of this kind are filtered out by the client before being
929  /// shown. So servers can omit computing them.
930  std::vector<std::string> only;
931 };
933 
935  /// The document in which the command was invoked.
937 
938  /// The range for which the command was invoked.
940 
941  /// Context carrying additional information.
943 };
945 
947  /// Holds changes to existing resources.
948  std::map<std::string, std::vector<TextEdit>> changes;
949 
950  /// Note: "documentChanges" is not currently used because currently there is
951  /// no support for versioned edits.
952 };
955 
956 /// Arguments for the 'applyTweak' command. The server sends these commands as a
957 /// response to the textDocument/codeAction request. The client can later send a
958 /// command back to the server if the user requests to execute a particular code
959 /// tweak.
960 struct TweakArgs {
961  /// A file provided by the client on a textDocument/codeAction request.
963  /// A selection provided by the client on a textDocument/codeAction request.
965  /// ID of the tweak that should be executed. Corresponds to Tweak::id().
966  std::string tweakID;
967 };
970 
972  /// The identifier of the actual command handler.
973  std::string command;
974 
975  // This is `arguments?: []any` in LSP.
976  // All clangd's commands accept a single argument (or none => null).
978 };
981 
982 struct Command : public ExecuteCommandParams {
983  std::string title;
984 };
985 llvm::json::Value toJSON(const Command &C);
986 
987 /// A code action represents a change that can be performed in code, e.g. to fix
988 /// a problem or to refactor code.
989 ///
990 /// A CodeAction must set either `edit` and/or a `command`. If both are
991 /// supplied, the `edit` is applied first, then the `command` is executed.
992 struct CodeAction {
993  /// A short, human-readable, title for this code action.
994  std::string title;
995 
996  /// The kind of the code action.
997  /// Used to filter code actions.
998  llvm::Optional<std::string> kind;
999  const static llvm::StringLiteral QUICKFIX_KIND;
1000  const static llvm::StringLiteral REFACTOR_KIND;
1001  const static llvm::StringLiteral INFO_KIND;
1002 
1003  /// The diagnostics that this code action resolves.
1004  llvm::Optional<std::vector<Diagnostic>> diagnostics;
1005 
1006  /// Marks this as a preferred action. Preferred actions are used by the
1007  /// `auto fix` command and can be targeted by keybindings.
1008  /// A quick fix should be marked preferred if it properly addresses the
1009  /// underlying error. A refactoring should be marked preferred if it is the
1010  /// most reasonable choice of actions to take.
1011  bool isPreferred = false;
1012 
1013  /// The workspace edit this code action performs.
1014  llvm::Optional<WorkspaceEdit> edit;
1015 
1016  /// A command this code action executes. If a code action provides an edit
1017  /// and a command, first the edit is executed and then the command.
1018  llvm::Optional<Command> command;
1019 };
1021 
1022 /// Represents programming constructs like variables, classes, interfaces etc.
1023 /// that appear in a document. Document symbols can be hierarchical and they
1024 /// have two ranges: one that encloses its definition and one that points to its
1025 /// most interesting range, e.g. the range of an identifier.
1027  /// The name of this symbol.
1028  std::string name;
1029 
1030  /// More detail for this symbol, e.g the signature of a function.
1031  std::string detail;
1032 
1033  /// The kind of this symbol.
1035 
1036  /// Indicates if this symbol is deprecated.
1037  bool deprecated = false;
1038 
1039  /// The range enclosing this symbol not including leading/trailing whitespace
1040  /// but everything else like comments. This information is typically used to
1041  /// determine if the clients cursor is inside the symbol to reveal in the
1042  /// symbol in the UI.
1044 
1045  /// The range that should be selected and revealed when this symbol is being
1046  /// picked, e.g the name of a function. Must be contained by the `range`.
1048 
1049  /// Children of this symbol, e.g. properties of a class.
1050  std::vector<DocumentSymbol> children;
1051 };
1052 llvm::raw_ostream &operator<<(llvm::raw_ostream &O, const DocumentSymbol &S);
1054 
1055 /// Represents information about programming constructs like variables, classes,
1056 /// interfaces etc.
1058  /// The name of this symbol.
1059  std::string name;
1060 
1061  /// The kind of this symbol.
1063 
1064  /// The location of this symbol.
1066 
1067  /// The name of the symbol containing this symbol.
1068  std::string containerName;
1069 
1070  /// The score that clangd calculates to rank the returned symbols.
1071  /// This excludes the fuzzy-matching score between `name` and the query.
1072  /// (Specifically, the last ::-separated component).
1073  /// This can be used to re-rank results as the user types, using client-side
1074  /// fuzzy-matching (that score should be multiplied with this one).
1075  /// This is a clangd extension, set only for workspace/symbol responses.
1076  llvm::Optional<float> score;
1077 };
1079 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolInformation &);
1080 
1081 /// Represents information about identifier.
1082 /// This is returned from textDocument/symbolInfo, which is a clangd extension.
1084  std::string name;
1085 
1086  std::string containerName;
1087 
1088  /// Unified Symbol Resolution identifier
1089  /// This is an opaque string uniquely identifying a symbol.
1090  /// Unlike SymbolID, it is variable-length and somewhat human-readable.
1091  /// It is a common representation across several clang tools.
1092  /// (See USRGeneration.h)
1093  std::string USR;
1094 
1096 };
1098 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolDetails &);
1099 bool operator==(const SymbolDetails &, const SymbolDetails &);
1100 
1101 /// The parameters of a Workspace Symbol Request.
1103  /// A query string to filter symbols by.
1104  /// Clients may send an empty string here to request all the symbols.
1105  std::string query;
1106 
1107  /// Max results to return, overriding global default. 0 means no limit.
1108  /// Clangd extension.
1109  llvm::Optional<int> limit;
1110 };
1113 
1116 };
1118 
1120  bool applied = true;
1121  llvm::Optional<std::string> failureReason;
1122 };
1125 
1127  /// The text document.
1129 
1130  /// The position inside the text document.
1132 };
1135 
1137  /// Completion was triggered by typing an identifier (24x7 code
1138  /// complete), manual invocation (e.g Ctrl+Space) or via API.
1139  Invoked = 1,
1140  /// Completion was triggered by a trigger character specified by
1141  /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
1142  TriggerCharacter = 2,
1143  /// Completion was re-triggered as the current completion list is incomplete.
1145 };
1146 
1148  /// How the completion was triggered.
1150  /// The trigger character (a single character) that has trigger code complete.
1151  /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
1152  std::string triggerCharacter;
1153 };
1155 
1158 
1159  /// Max results to return, overriding global default. 0 means no limit.
1160  /// Clangd extension.
1161  llvm::Optional<int> limit;
1162 };
1164 
1167  std::string value;
1168 };
1170 
1171 struct Hover {
1172  /// The hover's content
1174 
1175  /// An optional range is a range inside a text document
1176  /// that is used to visualize a hover, e.g. by changing the background color.
1177  llvm::Optional<Range> range;
1178 };
1179 llvm::json::Value toJSON(const Hover &H);
1180 
1181 /// Defines whether the insert text in a completion item should be interpreted
1182 /// as plain text or a snippet.
1183 enum class InsertTextFormat {
1184  Missing = 0,
1185  /// The primary text to be inserted is treated as a plain string.
1186  PlainText = 1,
1187  /// The primary text to be inserted is treated as a snippet.
1188  ///
1189  /// A snippet can define tab stops and placeholders with `$1`, `$2`
1190  /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end
1191  /// of the snippet. Placeholders with equal identifiers are linked, that is
1192  /// typing in one will update others too.
1193  ///
1194  /// See also:
1195  /// https://github.com/Microsoft/vscode/blob/main/src/vs/editor/contrib/snippet/snippet.md
1196  Snippet = 2,
1197 };
1198 
1200  /// The label of this completion item. By default also the text that is
1201  /// inserted when selecting this completion.
1202  std::string label;
1203 
1204  /// The kind of this completion item. Based of the kind an icon is chosen by
1205  /// the editor.
1207 
1208  /// A human-readable string with additional information about this item, like
1209  /// type or symbol information.
1210  std::string detail;
1211 
1212  /// A human-readable string that represents a doc-comment.
1213  llvm::Optional<MarkupContent> documentation;
1214 
1215  /// A string that should be used when comparing this item with other items.
1216  /// When `falsy` the label is used.
1217  std::string sortText;
1218 
1219  /// A string that should be used when filtering a set of completion items.
1220  /// When `falsy` the label is used.
1221  std::string filterText;
1222 
1223  /// A string that should be inserted to a document when selecting this
1224  /// completion. When `falsy` the label is used.
1225  std::string insertText;
1226 
1227  /// The format of the insert text. The format applies to both the `insertText`
1228  /// property and the `newText` property of a provided `textEdit`.
1230 
1231  /// An edit which is applied to a document when selecting this completion.
1232  /// When an edit is provided `insertText` is ignored.
1233  ///
1234  /// Note: The range of the edit must be a single line range and it must
1235  /// contain the position at which completion has been requested.
1236  llvm::Optional<TextEdit> textEdit;
1237 
1238  /// An optional array of additional text edits that are applied when selecting
1239  /// this completion. Edits must not overlap with the main edit nor with
1240  /// themselves.
1241  std::vector<TextEdit> additionalTextEdits;
1242 
1243  /// Indicates if this item is deprecated.
1244  bool deprecated = false;
1245 
1246  /// The score that clangd calculates to rank the returned completions.
1247  /// This excludes the fuzzy-match between `filterText` and the partial word.
1248  /// This can be used to re-rank results as the user types, using client-side
1249  /// fuzzy-matching (that score should be multiplied with this one).
1250  /// This is a clangd extension.
1251  float score = 0.f;
1252 
1253  // TODO: Add custom commitCharacters for some of the completion items. For
1254  // example, it makes sense to use () only for the functions.
1255  // TODO(krasimir): The following optional fields defined by the language
1256  // server protocol are unsupported:
1257  //
1258  // data?: any - A data entry field that is preserved on a completion item
1259  // between a completion and a completion resolve request.
1260 };
1262 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const CompletionItem &);
1263 
1264 bool operator<(const CompletionItem &, const CompletionItem &);
1265 
1266 /// Represents a collection of completion items to be presented in the editor.
1268  /// The list is not complete. Further typing should result in recomputing the
1269  /// list.
1270  bool isIncomplete = false;
1271 
1272  /// The completion items.
1273  std::vector<CompletionItem> items;
1274 };
1276 
1277 /// A single parameter of a particular signature.
1279 
1280  /// The label of this parameter. Ignored when labelOffsets is set.
1281  std::string labelString;
1282 
1283  /// Inclusive start and exclusive end offsets withing the containing signature
1284  /// label.
1285  /// Offsets are computed by lspLength(), which counts UTF-16 code units by
1286  /// default but that can be overriden, see its documentation for details.
1287  llvm::Optional<std::pair<unsigned, unsigned>> labelOffsets;
1288 
1289  /// The documentation of this parameter. Optional.
1290  std::string documentation;
1291 };
1293 
1294 /// Represents the signature of something callable.
1296 
1297  /// The label of this signature. Mandatory.
1298  std::string label;
1299 
1300  /// The documentation of this signature. Optional.
1302 
1303  /// The parameters of this signature.
1304  std::vector<ParameterInformation> parameters;
1305 };
1307 llvm::raw_ostream &operator<<(llvm::raw_ostream &,
1308  const SignatureInformation &);
1309 
1310 /// Represents the signature of a callable.
1312 
1313  /// The resulting signatures.
1314  std::vector<SignatureInformation> signatures;
1315 
1316  /// The active signature.
1318 
1319  /// The active parameter of the active signature.
1321 
1322  /// Position of the start of the argument list, including opening paren. e.g.
1323  /// foo("first arg", "second arg",
1324  /// ^-argListStart ^-cursor
1325  /// This is a clangd-specific extension, it is only available via C++ API and
1326  /// not currently serialized for the LSP.
1328 };
1330 
1332  /// The document that was opened.
1334 
1335  /// The position at which this request was sent.
1337 
1338  /// The new name of the symbol.
1339  std::string newName;
1340 };
1342 
1343 enum class DocumentHighlightKind { Text = 1, Read = 2, Write = 3 };
1344 
1345 /// A document highlight is a range inside a text document which deserves
1346 /// special attention. Usually a document highlight is visualized by changing
1347 /// the background color of its range.
1348 
1350  /// The range this highlight applies to.
1352 
1353  /// The highlight kind, default is DocumentHighlightKind.Text.
1355 
1356  friend bool operator<(const DocumentHighlight &LHS,
1357  const DocumentHighlight &RHS) {
1358  int LHSKind = static_cast<int>(LHS.kind);
1359  int RHSKind = static_cast<int>(RHS.kind);
1360  return std::tie(LHS.range, LHSKind) < std::tie(RHS.range, RHSKind);
1361  }
1362 
1363  friend bool operator==(const DocumentHighlight &LHS,
1364  const DocumentHighlight &RHS) {
1365  return LHS.kind == RHS.kind && LHS.range == RHS.range;
1366  }
1367 };
1368 llvm::json::Value toJSON(const DocumentHighlight &DH);
1369 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const DocumentHighlight &);
1370 
1371 enum class TypeHierarchyDirection { Children = 0, Parents = 1, Both = 2 };
1374 
1375 /// The type hierarchy params is an extension of the
1376 /// `TextDocumentPositionsParams` with optional properties which can be used to
1377 /// eagerly resolve the item when requesting from the server.
1379  /// The hierarchy levels to resolve. `0` indicates no level.
1380  int resolve = 0;
1381 
1382  /// The direction of the hierarchy levels to resolve.
1384 };
1387 
1389  /// The human readable name of the hierarchy item.
1390  std::string name;
1391 
1392  /// Optional detail for the hierarchy item. It can be, for instance, the
1393  /// signature of a function or method.
1394  llvm::Optional<std::string> detail;
1395 
1396  /// The kind of the hierarchy item. For instance, class or interface.
1398 
1399  /// `true` if the hierarchy item is deprecated. Otherwise, `false`.
1400  bool deprecated = false;
1401 
1402  /// The URI of the text document where this type hierarchy item belongs to.
1404 
1405  /// The range enclosing this type hierarchy item not including
1406  /// leading/trailing whitespace but everything else like comments. This
1407  /// information is typically used to determine if the client's cursor is
1408  /// inside the type hierarch item to reveal in the symbol in the UI.
1410 
1411  /// The range that should be selected and revealed when this type hierarchy
1412  /// item is being picked, e.g. the name of a function. Must be contained by
1413  /// the `range`.
1415 
1416  /// If this type hierarchy item is resolved, it contains the direct parents.
1417  /// Could be empty if the item does not have direct parents. If not defined,
1418  /// the parents have not been resolved yet.
1419  llvm::Optional<std::vector<TypeHierarchyItem>> parents;
1420 
1421  /// If this type hierarchy item is resolved, it contains the direct children
1422  /// of the current item. Could be empty if the item does not have any
1423  /// descendants. If not defined, the children have not been resolved.
1424  llvm::Optional<std::vector<TypeHierarchyItem>> children;
1425 
1426  /// An optional 'data' field, which can be used to identify a type hierarchy
1427  /// item in a resolve request.
1428  llvm::Optional<std::string> data;
1429 };
1431 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const TypeHierarchyItem &);
1433 
1434 /// Parameters for the `typeHierarchy/resolve` request.
1436  /// The item to resolve.
1438 
1439  /// The hierarchy levels to resolve. `0` indicates no level.
1440  int resolve;
1441 
1442  /// The direction of the hierarchy levels to resolve.
1444 };
1447 
1448 enum class SymbolTag { Deprecated = 1 };
1450 
1451 /// The parameter of a `textDocument/prepareCallHierarchy` request.
1453 
1454 /// Represents programming constructs like functions or constructors
1455 /// in the context of call hierarchy.
1457  /// The name of this item.
1458  std::string name;
1459 
1460  /// The kind of this item.
1462 
1463  /// Tags for this item.
1464  std::vector<SymbolTag> tags;
1465 
1466  /// More detaill for this item, e.g. the signature of a function.
1467  std::string detail;
1468 
1469  /// The resource identifier of this item.
1471 
1472  /// The range enclosing this symbol not including leading / trailing
1473  /// whitespace but everything else, e.g. comments and code.
1475 
1476  /// The range that should be selected and revealed when this symbol
1477  /// is being picked, e.g. the name of a function.
1478  /// Must be contained by `Rng`.
1480 
1481  /// An optional 'data' field, which can be used to identify a call
1482  /// hierarchy item in an incomingCalls or outgoingCalls request.
1483  std::string data;
1484 };
1487 
1488 /// The parameter of a `callHierarchy/incomingCalls` request.
1491 };
1494 
1495 /// Represents an incoming call, e.g. a caller of a method or constructor.
1497  /// The item that makes the call.
1499 
1500  /// The range at which the calls appear.
1501  /// This is relative to the caller denoted by `From`.
1502  std::vector<Range> fromRanges;
1503 };
1505 
1506 /// The parameter of a `callHierarchy/outgoingCalls` request.
1509 };
1512 
1513 /// Represents an outgoing call, e.g. calling a getter from a method or
1514 /// a method from a constructor etc.
1516  /// The item that is called.
1518 
1519  /// The range at which this item is called.
1520  /// This is the range relative to the caller, and not `To`.
1521  std::vector<Range> fromRanges;
1522 };
1524 
1525 /// A parameter literal used in inlay hint requests.
1527  /// The text document.
1529 
1530  /// The visible document range for which inlay hints should be computed.
1531  ///
1532  /// None is a clangd extension, which hints for computing hints on the whole
1533  /// file.
1534  llvm::Optional<Range> range;
1535 };
1537 
1538 /// Inlay hint kinds.
1539 enum class InlayHintKind {
1540  /// An inlay hint that for a type annotation.
1541  ///
1542  /// An example of a type hint is a hint in this position:
1543  /// auto var ^ = expr;
1544  /// which shows the deduced type of the variable.
1545  Type = 1,
1546 
1547  /// An inlay hint that is for a parameter.
1548  ///
1549  /// An example of a parameter hint is a hint in this position:
1550  /// func(^arg);
1551  /// which shows the name of the corresponding parameter.
1552  Parameter = 2,
1553 
1554  /// A hint before an element of an aggregate braced initializer list,
1555  /// indicating what it is initializing.
1556  /// Pair{^1, ^2};
1557  /// Uses designator syntax, e.g. `.first:`.
1558  /// This is a clangd extension.
1559  Designator = 3,
1560 
1561  /// Other ideas for hints that are not currently implemented:
1562  ///
1563  /// * Chaining hints, showing the types of intermediate expressions
1564  /// in a chain of function calls.
1565  /// * Hints indicating implicit conversions or implicit constructor calls.
1566 };
1568 
1569 /// Inlay hint information.
1570 struct InlayHint {
1571  /// The position of this hint.
1573 
1574  /// The label of this hint. A human readable string or an array of
1575  /// InlayHintLabelPart label parts.
1576  ///
1577  /// *Note* that neither the string nor the label part can be empty.
1578  std::string label;
1579 
1580  /// The kind of this hint. Can be omitted in which case the client should fall
1581  /// back to a reasonable default.
1583 
1584  /// Render padding before the hint.
1585  ///
1586  /// Note: Padding should use the editor's background color, not the
1587  /// background color of the hint itself. That means padding can be used
1588  /// to visually align/separate an inlay hint.
1589  bool paddingLeft = false;
1590 
1591  /// Render padding after the hint.
1592  ///
1593  /// Note: Padding should use the editor's background color, not the
1594  /// background color of the hint itself. That means padding can be used
1595  /// to visually align/separate an inlay hint.
1596  bool paddingRight = false;
1597 
1598  /// The range of source code to which the hint applies.
1599  ///
1600  /// For example, a parameter hint may have the argument as its range.
1601  /// The range allows clients more flexibility of when/how to display the hint.
1602  /// This is an (unserialized) clangd extension.
1604 };
1606 bool operator==(const InlayHint &, const InlayHint &);
1607 bool operator<(const InlayHint &, const InlayHint &);
1608 llvm::raw_ostream &operator<<(llvm::raw_ostream &, InlayHintKind);
1609 
1611  /// Include the declaration of the current symbol.
1612  bool includeDeclaration = false;
1613 };
1614 
1617 };
1619 
1620 /// Clangd extension: indicates the current state of the file in clangd,
1621 /// sent from server via the `textDocument/clangd.fileStatus` notification.
1622 struct FileStatus {
1623  /// The text document's URI.
1625  /// The human-readable string presents the current state of the file, can be
1626  /// shown in the UI (e.g. status bar).
1627  std::string state;
1628  // FIXME: add detail messages.
1629 };
1631 
1632 /// Specifies a single semantic token in the document.
1633 /// This struct is not part of LSP, which just encodes lists of tokens as
1634 /// arrays of numbers directly.
1636  /// token line number, relative to the previous token
1637  unsigned deltaLine = 0;
1638  /// token start character, relative to the previous token
1639  /// (relative to 0 or the previous token's start if they are on the same line)
1640  unsigned deltaStart = 0;
1641  /// the length of the token. A token cannot be multiline
1642  unsigned length = 0;
1643  /// will be looked up in `SemanticTokensLegend.tokenTypes`
1644  unsigned tokenType = 0;
1645  /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers`
1646  unsigned tokenModifiers = 0;
1647 };
1648 bool operator==(const SemanticToken &, const SemanticToken &);
1649 
1650 /// A versioned set of tokens.
1652  // An optional result id. If provided and clients support delta updating
1653  // the client will include the result id in the next semantic token request.
1654  // A server can then instead of computing all semantic tokens again simply
1655  // send a delta.
1656  std::string resultId;
1657 
1658  /// The actual tokens.
1659  std::vector<SemanticToken> tokens; // encoded as a flat integer array.
1660 };
1662 
1663 /// Body of textDocument/semanticTokens/full request.
1665  /// The text document.
1667 };
1670 
1671 /// Body of textDocument/semanticTokens/full/delta request.
1672 /// Requests the changes in semantic tokens since a previous response.
1674  /// The text document.
1676  /// The previous result id.
1677  std::string previousResultId;
1678 };
1681 
1682 /// Describes a a replacement of a contiguous range of semanticTokens.
1684  // LSP specifies `start` and `deleteCount` which are relative to the array
1685  // encoding of the previous tokens.
1686  // We use token counts instead, and translate when serializing this struct.
1687  unsigned startToken = 0;
1688  unsigned deleteTokens = 0;
1689  std::vector<SemanticToken> tokens; // encoded as a flat integer array
1690 };
1692 
1693 /// This models LSP SemanticTokensDelta | SemanticTokens, which is the result of
1694 /// textDocument/semanticTokens/full/delta.
1696  std::string resultId;
1697  /// Set if we computed edits relative to a previous set of tokens.
1698  llvm::Optional<std::vector<SemanticTokensEdit>> edits;
1699  /// Set if we computed a fresh set of tokens.
1700  llvm::Optional<std::vector<SemanticToken>> tokens; // encoded as integer array
1701 };
1703 
1705  /// The text document.
1707 
1708  /// The positions inside the text document.
1709  std::vector<Position> positions;
1710 };
1713 
1715  /**
1716  * The range of this selection range.
1717  */
1719  /**
1720  * The parent selection range containing this range. Therefore `parent.range`
1721  * must contain `this.range`.
1722  */
1723  std::unique_ptr<SelectionRange> parent;
1724 };
1726 
1727 /// Parameters for the document link request.
1729  /// The document to provide document links for.
1731 };
1734 
1735 /// A range in a text document that links to an internal or external resource,
1736 /// like another text document or a web site.
1738  /// The range this link applies to.
1740 
1741  /// The uri this link points to. If missing a resolve request is sent later.
1743 
1744  // TODO(forster): The following optional fields defined by the language
1745  // server protocol are unsupported:
1746  //
1747  // data?: any - A data entry field that is preserved on a document link
1748  // between a DocumentLinkRequest and a
1749  // DocumentLinkResolveRequest.
1750 
1751  friend bool operator==(const DocumentLink &LHS, const DocumentLink &RHS) {
1752  return LHS.range == RHS.range && LHS.target == RHS.target;
1753  }
1754 
1755  friend bool operator!=(const DocumentLink &LHS, const DocumentLink &RHS) {
1756  return !(LHS == RHS);
1757  }
1758 };
1759 llvm::json::Value toJSON(const DocumentLink &DocumentLink);
1760 
1761 // FIXME(kirillbobyrev): Add FoldingRangeClientCapabilities so we can support
1762 // per-line-folding editors.
1765 };
1768 
1769 /// Stores information about a region of code that can be folded.
1771  unsigned startLine = 0;
1772  unsigned startCharacter;
1773  unsigned endLine = 0;
1774  unsigned endCharacter;
1775  llvm::Optional<std::string> kind;
1776 };
1778 
1779 /// Keys starting with an underscore(_) represent leaves, e.g. _total or _self
1780 /// for memory usage of whole subtree or only that specific node in bytes. All
1781 /// other keys represents children. An example:
1782 /// {
1783 /// "_self": 0,
1784 /// "_total": 8,
1785 /// "child1": {
1786 /// "_self": 4,
1787 /// "_total": 4,
1788 /// }
1789 /// "child2": {
1790 /// "_self": 2,
1791 /// "_total": 4,
1792 /// "child_deep": {
1793 /// "_self": 2,
1794 /// "_total": 2,
1795 /// }
1796 /// }
1797 /// }
1799 
1800 /// Payload for textDocument/ast request.
1801 /// This request is a clangd extension.
1802 struct ASTParams {
1803  /// The text document.
1805 
1806  /// The position of the node to be dumped.
1807  /// The highest-level node that entirely contains the range will be returned.
1808  /// If no range is given, the root translation unit node will be returned.
1809  llvm::Optional<Range> range;
1810 };
1812 
1813 /// Simplified description of a clang AST node.
1814 /// This is clangd's internal representation of C++ code.
1815 struct ASTNode {
1816  /// The general kind of node, such as "expression"
1817  /// Corresponds to the base AST node type such as Expr.
1818  std::string role;
1819  /// The specific kind of node this is, such as "BinaryOperator".
1820  /// This is usually a concrete node class (with Expr etc suffix dropped).
1821  /// When there's no hierarchy (e.g. TemplateName), the variant (NameKind).
1822  std::string kind;
1823  /// Brief additional information, such as "||" for the particular operator.
1824  /// The information included depends on the node kind, and may be empty.
1825  std::string detail;
1826  /// A one-line dump of detailed information about the node.
1827  /// This includes role/kind/description information, but is rather cryptic.
1828  /// It is similar to the output from `clang -Xclang -ast-dump`.
1829  /// May be empty for certain types of nodes.
1830  std::string arcana;
1831  /// The range of the original source file covered by this node.
1832  /// May be missing for implicit nodes, or those created by macro expansion.
1833  llvm::Optional<Range> range;
1834  /// Nodes nested within this one, such as the operands of a BinaryOperator.
1835  std::vector<ASTNode> children;
1836 };
1838 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const ASTNode &);
1839 
1840 } // namespace clangd
1841 } // namespace clang
1842 
1843 namespace llvm {
1844 template <> struct format_provider<clang::clangd::Position> {
1845  static void format(const clang::clangd::Position &Pos, raw_ostream &OS,
1846  StringRef Style) {
1847  assert(Style.empty() && "style modifiers for this type are not supported");
1848  OS << Pos;
1849  }
1850 };
1851 } // namespace llvm
1852 
1853 // NOLINTEND(readability-identifier-naming)
1854 
1855 #endif
clang::clangd::TraceLevel::Messages
@ Messages
clang::clangd::ReferenceContext::includeDeclaration
bool includeDeclaration
Include the declaration of the current symbol.
Definition: Protocol.h:1612
clang::clangd::CallHierarchyItem::selectionRange
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
Definition: Protocol.h:1479
clang::clangd::DocumentHighlight
A document highlight is a range inside a text document which deserves special attention.
Definition: Protocol.h:1349
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:1414
clang::clangd::InlayHint::paddingLeft
bool paddingLeft
Render padding before the hint.
Definition: Protocol.h:1589
clang::clangd::WorkspaceEdit
Definition: Protocol.h:946
clang::clangd::CompletionList::isIncomplete
bool isIncomplete
The list is not complete.
Definition: Protocol.h:1270
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:1043
clang::clangd::InlayHintKind::Designator
@ Designator
A hint before an element of an aggregate braced initializer list, indicating what it is initializing.
clang::clangd::FoldingRange::startLine
unsigned startLine
Definition: Protocol.h:1771
clang::clangd::SemanticTokens::resultId
std::string resultId
Definition: Protocol.h:1656
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:862
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 of this hint.
Definition: Protocol.h:1578
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:1610
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:1677
clang::clangd::SemanticToken::tokenModifiers
unsigned tokenModifiers
each set bit will be looked up in SemanticTokensLegend.tokenModifiers
Definition: Protocol.h:1646
clang::clangd::SemanticTokensParams
Body of textDocument/semanticTokens/full request.
Definition: Protocol.h:1664
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:1448
clang::clangd::PublishDiagnosticsParams::diagnostics
std::vector< Diagnostic > diagnostics
An array of diagnostic information items.
Definition: Protocol.h:911
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:1508
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 kind of this hint.
Definition: Protocol.h:1582
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:1696
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:1470
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:1440
clang::clangd::CompletionItemKind::Operator
@ Operator
clang::clangd::SemanticTokensParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1666
clang::clangd::CallHierarchyItem::detail
std::string detail
More detaill for this item, e.g. the signature of a function.
Definition: Protocol.h:1467
Location
Definition: Modularize.cpp:381
clang::clangd::CodeAction
A code action represents a change that can be performed in code, e.g.
Definition: Protocol.h:992
clang::clangd::Diagnostic::category
llvm::Optional< std::string > category
The diagnostic's category.
Definition: Protocol.h:878
clang::clangd::SemanticTokensDeltaParams
Body of textDocument/semanticTokens/full/delta request.
Definition: Protocol.h:1673
clang::clangd::Diagnostic::codeDescription
llvm::Optional< CodeDescription > codeDescription
An optional property to describe the error code.
Definition: Protocol.h:858
clang::clangd::MarkupContent::kind
MarkupKind kind
Definition: Protocol.h:1166
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:1363
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:1244
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:1687
clang::clangd::ASTNode::detail
std::string detail
Brief additional information, such as "||" for the particular operator.
Definition: Protocol.h:1825
clang::clangd::CompletionList
Represents a collection of completion items to be presented in the editor.
Definition: Protocol.h:1267
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:930
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:1683
clang::clangd::SemanticTokensOrDelta
This models LSP SemanticTokensDelta | SemanticTokens, which is the result of textDocument/semanticTok...
Definition: Protocol.h:1695
clang::clangd::DocumentRangeFormattingParams::range
Range range
The range to format.
Definition: Protocol.h:782
clang::clangd::Hover
Definition: Protocol.h:1171
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:1775
clang::clangd::SelectionRangeParams::positions
std::vector< Position > positions
The positions inside the text document.
Definition: Protocol.h:1709
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:1301
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:1011
clang::clangd::ApplyWorkspaceEditResponse::applied
bool applied
Definition: Protocol.h:1120
clang::clangd::OffsetEncoding::UTF32
@ UTF32
clang::clangd::CallHierarchyOutgoingCall::to
CallHierarchyItem to
The item that is called.
Definition: Protocol.h:1517
clang::clangd::SymbolInformation
Represents information about programming constructs like variables, classes, interfaces etc.
Definition: Protocol.h:1057
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:1202
clang::clangd::CompletionItemKind::Reference
@ Reference
clang::clangd::InlayHint::paddingRight
bool paddingRight
Render padding after the hint.
Definition: Protocol.h:1596
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:1343
clang::clangd::SymbolInformation::name
std::string name
The name of this symbol.
Definition: Protocol.h:1059
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:1774
clang::clangd::CallHierarchyItem::tags
std::vector< SymbolTag > tags
Tags for this item.
Definition: Protocol.h:1464
clang::clangd::ErrorCode::InternalError
@ InternalError
clang::clangd::ParameterInformation::documentation
std::string documentation
The documentation of this parameter. Optional.
Definition: Protocol.h:1290
clang::clangd::TypeHierarchyItem::kind
SymbolKind kind
The kind of the hierarchy item. For instance, class or interface.
Definition: Protocol.h:1397
clang::clangd::FoldingRangeParams
Definition: Protocol.h:1763
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:1251
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:1637
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:1351
clang::clangd::URIForFile::fromURI
static llvm::Expected< URIForFile > fromURI(const URI &U, llvm::StringRef HintPath)
Definition: Protocol.cpp:58
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:1327
clang::clangd::TweakArgs::tweakID
std::string tweakID
ID of the tweak that should be executed. Corresponds to Tweak::id().
Definition: Protocol.h:966
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:936
clang::clangd::SymbolKind::Class
@ Class
clang::clangd::CodeActionParams::context
CodeActionContext context
Context carrying additional information.
Definition: Protocol.h:942
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:1121
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:1822
clang::clangd::ASTParams::range
llvm::Optional< Range > range
The position of the node to be dumped.
Definition: Protocol.h:1809
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:1287
clang::clangd::CallHierarchyIncomingCall
Represents an incoming call, e.g. a caller of a method or constructor.
Definition: Protocol.h:1496
clang::clangd::CompletionItem::filterText
std::string filterText
A string that should be used when filtering a set of completion items.
Definition: Protocol.h:1221
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:1109
clang::clangd::DocumentSymbol::children
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Definition: Protocol.h:1050
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:1199
clang::clangd::SymbolDetails::containerName
std::string containerName
Definition: Protocol.h:1086
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:1409
clang::clangd::CompletionItem::textEdit
llvm::Optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
Definition: Protocol.h:1236
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:1452
clang::clangd::RenameParams::position
Position position
The position at which this request was sent.
Definition: Protocol.h:1336
clang::clangd::Diagnostic::range
Range range
The range at which the message applies.
Definition: Protocol.h:848
clang::clangd::MarkupContent::value
std::string value
Definition: Protocol.h:1167
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
Pos
size_t Pos
Definition: NoLintDirectiveHandler.cpp:97
clang::clangd::ASTNode::range
llvm::Optional< Range > range
The range of the original source file covered by this node.
Definition: Protocol.h:1833
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:998
clang::clangd::SelectionRangeParams
Definition: Protocol.h:1704
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:994
clang::clangd::DocumentHighlight::kind
DocumentHighlightKind kind
The highlight kind, default is DocumentHighlightKind.Text.
Definition: Protocol.h:1354
clang::clangd::SymbolDetails::name
std::string name
Definition: Protocol.h:1084
clang::clangd::InlayHint
Inlay hint information.
Definition: Protocol.h:1570
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:948
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:1304
clang::clangd::SymbolKind::Boolean
@ Boolean
clang::clangd::Diagnostic
Definition: Protocol.h:846
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:1152
clang::clangd::Position
Definition: Protocol.h:153
clang::clangd::LSPError
Definition: Protocol.h:63
clang::clangd::FoldingRange::endLine
unsigned endLine
Definition: Protocol.h:1773
clang::clangd::CodeAction::edit
llvm::Optional< WorkspaceEdit > edit
The workspace edit this code action performs.
Definition: Protocol.h:1014
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:1095
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:100
clang::clangd::SemanticTokens::tokens
std::vector< SemanticToken > tokens
The actual tokens.
Definition: Protocol.h:1659
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:977
clang::clangd::Diagnostic::tags
llvm::SmallVector< DiagnosticTag, 1 > tags
Additional metadata about the diagnostic.
Definition: Protocol.h:868
clang::clangd::CallHierarchyIncomingCall::fromRanges
std::vector< Range > fromRanges
The range at which the calls appear.
Definition: Protocol.h:1502
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:1627
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:960
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:1635
clang::clangd::MemoryTree
A tree that can be used to represent memory usage of nested components while preserving the hierarchy...
Definition: MemoryTree.h:30
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:1225
clang::clangd::SignatureInformation::label
std::string label
The label of this signature. Mandatory.
Definition: Protocol.h:1298
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:1698
clang::clangd::SignatureHelp::signatures
std::vector< SignatureInformation > signatures
The resulting signatures.
Definition: Protocol.h:1314
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:1818
clang::clangd::PublishDiagnosticsParams::uri
URIForFile uri
The URI for which diagnostic information is reported.
Definition: Protocol.h:909
clang::clangd::toJSON
llvm::json::Value toJSON(const FuzzyFindRequest &Request)
Definition: Index.cpp:45
clang::clangd::SemanticTokensEdit::deleteTokens
unsigned deleteTokens
Definition: Protocol.h:1688
clang::clangd::CompletionList::items
std::vector< CompletionItem > items
The completion items.
Definition: Protocol.h:1273
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:1177
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:1640
clang::clangd::CompletionItem::kind
CompletionItemKind kind
The kind of this completion item.
Definition: Protocol.h:1206
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:1390
clang::clangd::SemanticToken::tokenType
unsigned tokenType
will be looked up in SemanticTokensLegend.tokenTypes
Definition: Protocol.h:1644
clang::clangd::FileChangeType::Deleted
@ Deleted
The file got deleted.
clang::clangd::CallHierarchyOutgoingCall
Represents an outgoing call, e.g.
Definition: Protocol.h:1515
clang::clangd::fromJSON
bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request, llvm::json::Path P)
Definition: Index.cpp:30
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:1031
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:962
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:1624
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:1483
clang::clangd::ExecuteCommandParams::command
std::string command
The identifier of the actual command handler.
Definition: Protocol.h:973
clang::clangd::FoldingRangeParams::textDocument
TextDocumentIdentifier textDocument
Definition: Protocol.h:1764
clang::clangd::indexSymbolKindToSymbolKind
SymbolKind indexSymbolKindToSymbolKind(index::SymbolKind Kind)
Definition: Protocol.cpp:250
clang::clangd::Diagnostic::data
llvm::json::Object data
A data entry field that is preserved between a textDocument/publishDiagnostics notification and textD...
Definition: Protocol.h:890
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:1047
clang::find_all_symbols::SymbolInfo::SymbolKind
SymbolKind
The SymbolInfo Type.
Definition: SymbolInfo.h:30
clang::clangd::CodeDescription
Structure to capture a description for an error code.
Definition: Protocol.h:839
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:1217
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:1616
clang::clangd::NoParams
Definition: Protocol.h:269
clang::clangd::CompletionContext::triggerKind
CompletionTriggerKind triggerKind
How the completion was triggered.
Definition: Protocol.h:1149
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:1845
clang::clangd::TextDocumentPositionParams::position
Position position
The position inside the text document.
Definition: Protocol.h:1131
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:983
clang::clangd::DocumentSymbol
Represents programming constructs like variables, classes, interfaces etc.
Definition: Protocol.h:1026
clang::clangd::SemanticTokensOrDelta::tokens
llvm::Optional< std::vector< SemanticToken > > tokens
Set if we computed a fresh set of tokens.
Definition: Protocol.h:1700
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:1642
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:1424
clang::clangd::SelectionRange
Definition: Protocol.h:1714
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:2182
clang::clangd::CodeAction::command
llvm::Optional< Command > command
A command this code action executes.
Definition: Protocol.h:1018
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:1403
clang::clangd::DocumentHighlightKind::Write
@ Write
clang::clangd::SymbolDetails
Represents information about identifier.
Definition: Protocol.h:1083
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:1728
clang::clangd::SymbolDetails::USR
std::string USR
Unified Symbol Resolution identifier This is an opaque string uniquely identifying a symbol.
Definition: Protocol.h:1093
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:971
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:1317
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:900
clang::clangd::SymbolInformation::score
llvm::Optional< float > score
The score that clangd calculates to rank the returned symbols.
Definition: Protocol.h:1076
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:1489
clang::clangd::TypeHierarchyParams::resolve
int resolve
The hierarchy levels to resolve. 0 indicates no level.
Definition: Protocol.h:1380
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:924
clang::clangd::SelectionRangeParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1706
clang::clangd::WorkDoneProgressReport
Reporting progress is done using the following payload.
Definition: Protocol.h:618
clang::clangd::PublishDiagnosticsParams
Definition: Protocol.h:907
clang::clangd::CompletionItem::insertTextFormat
InsertTextFormat insertTextFormat
The format of the insert text.
Definition: Protocol.h:1229
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:1004
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:1241
clang::clangd::TypeHierarchyDirection
TypeHierarchyDirection
Definition: Protocol.h:1371
clang::clangd::TypeHierarchyParams
The type hierarchy params is an extension of the TextDocumentPositionsParams with optional properties...
Definition: Protocol.h:1378
clang::clangd::SymbolKind::Variable
@ Variable
clang::clangd::TypeHierarchyItem
Definition: Protocol.h:1388
clang::clangd::DocumentHighlight::operator<
friend bool operator<(const DocumentHighlight &LHS, const DocumentHighlight &RHS)
Definition: Protocol.h:1356
clang::clangd::Hover::contents
MarkupContent contents
The hover's content.
Definition: Protocol.h:1173
clang::clangd::URI::toString
std::string toString() const
Returns a string URI with all components percent-encoded.
Definition: URI.cpp:160
clang::clangd::DidChangeTextDocumentParams
Definition: Protocol.h:713
clang::clangd::CompletionTriggerKind
CompletionTriggerKind
Definition: Protocol.h:1136
clang::clangd::InlayHintKind::Type
@ Type
An inlay hint that for a type annotation.
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:1394
clang::clangd::TypeHierarchyItem::deprecated
bool deprecated
true if the hierarchy item is deprecated. Otherwise, false.
Definition: Protocol.h:1400
clang::clangd::SignatureInformation
Represents the signature of something callable.
Definition: Protocol.h:1295
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:1802
clang::clangd::ErrorCode::RequestCancelled
@ RequestCancelled
clang::clangd::DocumentSymbol::kind
SymbolKind kind
The kind of this symbol.
Definition: Protocol.h:1034
clang::clangd::SelectionRange::range
Range range
The range of this selection range.
Definition: Protocol.h:1718
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
The visible document range for which inlay hints should be computed.
Definition: Protocol.h:1534
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:1383
clang::clangd::TextDocumentPositionParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1128
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::WorkspaceSymbolParams
The parameters of a Workspace Symbol Request.
Definition: Protocol.h:1102
clang::clangd::SemanticTokensEdit::tokens
std::vector< SemanticToken > tokens
Definition: Protocol.h:1689
clang::clangd::CompletionParams
Definition: Protocol.h:1156
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:1210
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:1311
clang::clangd::FileChangeType
FileChangeType
Definition: Protocol.h:737
clang::clangd::SemanticTokens
A versioned set of tokens.
Definition: Protocol.h:1651
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:865
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:1723
clang::clangd::URIForFile::canonicalize
static URIForFile canonicalize(llvm::StringRef AbsPath, llvm::StringRef TUPath)
Canonicalizes AbsPath via URI.
Definition: Protocol.cpp:45
clang::clangd::MessageType::Info
@ Info
An information message.
clang::clangd::ApplyWorkspaceEditResponse
Definition: Protocol.h:1119
MemoryTree.h
clang::clangd::CompletionItemKind::Constructor
@ Constructor
clang::clangd::Diagnostic::severity
int severity
The diagnostic's severity.
Definition: Protocol.h:852
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:1281
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:913
clang::clangd::Diagnostic::codeActions
llvm::Optional< std::vector< CodeAction > > codeActions
Clangd extension: code actions related to this diagnostic.
Definition: Protocol.h:883
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:160
clang::clangd::FoldingRange
Stores information about a region of code that can be folded.
Definition: Protocol.h:1770
clang::clangd::CodeAction::REFACTOR_KIND
const static llvm::StringLiteral REFACTOR_KIND
Definition: Protocol.h:1000
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:1419
clang::clangd::CallHierarchyItem::range
Range range
The range enclosing this symbol not including leading / trailing whitespace but everything else,...
Definition: Protocol.h:1474
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:1622
clang::clangd::TextDocumentContentChangeEvent
Definition: Protocol.h:700
clang::clangd::WorkspaceSymbolParams::query
std::string query
A query string to filter symbols by.
Definition: Protocol.h:1105
clang::clangd::DocumentSymbol::deprecated
bool deprecated
Indicates if this symbol is deprecated.
Definition: Protocol.h:1037
clang::clangd::ClientCapabilities::TheiaSemanticHighlighting
bool TheiaSemanticHighlighting
Client supports Theia semantic highlighting extension.
Definition: Protocol.h:466
clang::clangd::CodeActionParams
Definition: Protocol.h:934
clang::clangd::operator<
bool operator<(const Ref &L, const Ref &R)
Definition: Ref.h:95
clang::clangd::TextDocumentPositionParams
Definition: Protocol.h:1126
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:1456
clang::clangd::Diagnostic::code
std::string code
The diagnostic's code. Can be omitted.
Definition: Protocol.h:855
clang::clangd::SymbolKind::EnumMember
@ EnumMember
clang::clangd::RenameParams::textDocument
TextDocumentIdentifier textDocument
The document that was opened.
Definition: Protocol.h:1333
clang::clangd::CallHierarchyIncomingCall::from
CallHierarchyItem from
The item that makes the call.
Definition: Protocol.h:1498
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:1320
clang::clangd::OffsetEncoding::UnsupportedEncoding
@ UnsupportedEncoding
clang::clangd::SymbolInformation::containerName
std::string containerName
The name of the symbol containing this symbol.
Definition: Protocol.h:1068
clang::clangd::RenameParams
Definition: Protocol.h:1331
clang::clangd::Range::contains
bool contains(Position Pos) const
Definition: Protocol.h:199
clang::clangd::ApplyWorkspaceEditParams
Definition: Protocol.h:1114
clang::clangd::CompletionParams::limit
llvm::Optional< int > limit
Max results to return, overriding global default.
Definition: Protocol.h:1161
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:368
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:1028
clang::clangd::TweakArgs::selection
Range selection
A selection provided by the client on a textDocument/codeAction request.
Definition: Protocol.h:964
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:1157
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:1183
clang::clangd::ReferenceParams
Definition: Protocol.h:1615
clang::clangd::InlayHintKind
InlayHintKind
Inlay hint kinds.
Definition: Protocol.h:1539
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:1830
clang::clangd::ParameterInformation
A single parameter of a particular signature.
Definition: Protocol.h:1278
clang::clangd::Diagnostic::relatedInformation
llvm::Optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
An array of related diagnostic information, e.g.
Definition: Protocol.h:872
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:1730
clang::clangd::LSPError::ID
static char ID
Definition: Protocol.h:67
clang::clangd::FoldingRange::startCharacter
unsigned startCharacter
Definition: Protocol.h:1772
clang::clangd::InlayHintsParams::textDocument
TextDocumentIdentifier textDocument
The text document.
Definition: Protocol.h:1528
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:899
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:238
clang::clangd::SymbolInformation::location
Location location
The location of this symbol.
Definition: Protocol.h:1065
Out
CompiledFragmentImpl & Out
Definition: ConfigCompile.cpp:99
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:1675
clang::clangd::MarkupContent
Definition: Protocol.h:1165
clang::clangd::ASTNode::children
std::vector< ASTNode > children
Nodes nested within this one, such as the operands of a BinaryOperator.
Definition: Protocol.h:1835
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:1443
clang::clangd::CompletionContext
Definition: Protocol.h:1147
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:1804
Tag
HTMLTag Tag
Definition: HTMLGenerator.cpp:90
clang::clangd::CallHierarchyOutgoingCallsParams
The parameter of a callHierarchy/outgoingCalls request.
Definition: Protocol.h:1507
clang::clangd::CompletionItemKind::TypeParameter
@ TypeParameter
clang::clangd::ASTNode
Simplified description of a clang AST node.
Definition: Protocol.h:1815
clang::clangd::CompletionItemKindMin
constexpr auto CompletionItemKindMin
Definition: Protocol.h:321
clang::clangd::ResolveTypeHierarchyItemParams::item
TypeHierarchyItem item
The item to resolve.
Definition: Protocol.h:1437
clang::clangd::CallHierarchyOutgoingCall::fromRanges
std::vector< Range > fromRanges
The range at which this item is called.
Definition: Protocol.h:1521
clang::clangd::ApplyWorkspaceEditParams::edit
WorkspaceEdit edit
Definition: Protocol.h:1115
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:1001
clang::clangd::SymbolKind::Constructor
@ Constructor
clang::clangd::CodeActionContext
Definition: Protocol.h:917
clang::clangd::CompletionItemKind::Variable
@ Variable
clang::clangd::CallHierarchyIncomingCallsParams::item
CallHierarchyItem item
Definition: Protocol.h:1490
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:1062
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:939
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 of this hint.
Definition: Protocol.h:1572
clang::clangd::InlayHint::range
Range range
The range of source code to which the hint applies.
Definition: Protocol.h:1603
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:1458
clang::clangd::CodeDescription::href
std::string href
An URI to open with more information about the diagnostic error.
Definition: Protocol.h:841
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:1428
clang::clangd::RenameParams::newName
std::string newName
The new name of the symbol.
Definition: Protocol.h:1339
clang::clangd::SymbolKind::Property
@ Property
clang::clangd::SymbolKind::Struct
@ Struct
Path
std::vector< HeaderHandle > Path
Definition: PreprocessorTracker.cpp:525
clang::clangd::InlayHintsParams
A parameter literal used in inlay hint requests.
Definition: Protocol.h:1526
clang::clangd::adjustKindToCapability
SymbolKind adjustKindToCapability(SymbolKind Kind, SymbolKindBitset &SupportedSymbolKinds)
Definition: Protocol.cpp:232
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:1461
clang::clangd::CodeAction::QUICKFIX_KIND
const static llvm::StringLiteral QUICKFIX_KIND
Definition: Protocol.h:999
clang::clangd::ResolveTypeHierarchyItemParams
Parameters for the typeHierarchy/resolve request.
Definition: Protocol.h:1435
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:1213
clang::clangd::InlayHintKind::Parameter
@ Parameter
An inlay hint that is for a parameter.
clang::clangd::WorkDoneProgressCreateParams
Definition: Protocol.h:574