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