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