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