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