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