24 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROTOCOL_H 25 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROTOCOL_H 28 #include "llvm/ADT/Optional.h" 29 #include "llvm/Support/JSON.h" 59 explicit operator bool()
const {
return !
File.empty(); }
63 return LHS.File == RHS.File;
71 return LHS.File < RHS.File;
103 return !(LHS == RHS);
129 return !(LHS == RHS);
151 return !(LHS == RHS);
222 bool snippetSupport =
false;
224 bool commitCharacterSupport =
false;
234 bool dynamicRegistration =
false;
242 bool contextSupport =
false;
288 bool fromJSON(
const llvm::json::Value &, std::vector<SymbolKind> &);
303 llvm::Optional<WorkspaceSymbolCapabilities>
symbol;
448 bool insertSpaces =
false;
549 llvm::Optional<std::map<std::string, std::vector<TextEdit>>>
changes;
743 bool isIncomplete =
false;
774 llvm::raw_ostream &
operator<<(llvm::raw_ostream &,
784 int activeSignature = 0;
787 int activeParameter = 0;
818 int LHSKind =
static_cast<int>(LHS.
kind);
819 int RHSKind =
static_cast<int>(RHS.
kind);
820 return std::tie(LHS.
range, LHSKind) < std::tie(RHS.
range, RHSKind);
835 template <>
struct format_provider<
clang::clangd::Position> {
838 assert(Style.empty() &&
"style modifiers for this type are not supported");
std::string insertText
A string that should be inserted to a document when selecting this completion.
friend bool operator<(const Location &LHS, const Location &RHS)
URIForFile uri
The file's URI.
CompletionClientCapabilities completion
Capabilities specific to the textDocument/completion
friend bool operator==(const Location &LHS, const Location &RHS)
llvm::Optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
Exact commands are not specified in the protocol so we define the ones supported by Clangd here...
Some operations such as code completion produce a set of candidates.
llvm::Optional< URIForFile > rootUri
The rootUri of the workspace.
Position start
The range's start position.
llvm::Optional< SymbolKindCapabilities > symbolKind
Capabilities SymbolKind.
friend bool operator==(const URIForFile &LHS, const URIForFile &RHS)
Represents a collection of completion items to be presented in the editor.
Range range
The range this highlight applies to.
llvm::Optional< bool > wantDiagnostics
Forces diagnostics to be generated, or to not be generated, for this version of the file...
friend bool operator<=(const Position &LHS, const Position &RHS)
Range range
The range for which the command was invoked.
CodeActionContext context
Context carrying additional information.
static const llvm::StringLiteral CLANGD_APPLY_FIX_COMMAND
Clangd extension to set clangd-specific "initializationOptions" in the "initialize" request and for t...
llvm::Optional< WorkspaceSymbolCapabilities > symbol
Capabilities specific to workspace/symbol.
std::vector< CompletionItem > items
The completion items.
Documents are synced by always sending the full content of the document.
Documents are synced by sending the full content on open.
llvm::Optional< std::map< std::string, std::vector< TextEdit > > > changes
Holds changes to existing resources.
bool operator()(const Diagnostic &LHS, const Diagnostic &RHS) const
llvm::Optional< Range > range
An optional range is a range inside a text document that is used to visualize a hover, e.g.
TextDocumentIdentifier textDocument
The document that was closed.
llvm::Optional< ClangdInitializationOptions > initializationOptions
friend bool operator!=(const URIForFile &LHS, const URIForFile &RHS)
URIForFile uri
The text document's URI.
std::string text
The new text of the range/document.
friend bool operator!=(const Position &LHS, const Position &RHS)
llvm::Optional< WorkspaceClientCapabilities > workspace
Values in a Context are indexed by typed keys.
constexpr auto SymbolKindMin
std::string sortText
A string that should be used when comparing this item with other items.
friend bool operator!=(const Range &LHS, const Range &RHS)
Documents should not be synced at all.
llvm::Optional< Metadata > metadata
Extension storing per-file metadata, such as compilation flags.
std::string documentation
A human-readable string that represents a doc-comment.
InsertTextFormat
Defines whether the insert text in a completion item should be interpreted as plain text or a snippet...
std::vector< TextEdit > additionalTextEdits
An optional array of additional text edits that are applied when selecting this completion.
llvm::Optional< int > processId
The process Id of the parent process that started the server.
CompletionItemKind
The kind of a completion entry.
TextDocumentSyncKind
Defines how the host (editor) should sync document changes to the language server.
MarkupContent contents
The hover's content.
A document highlight is a range inside a text document which deserves special attention.
TextDocumentClientCapabilities textDocument
URIForFile uri
The text document's URI.
std::string detail
A human-readable string with additional information about this item, like type or symbol information...
static URI createFile(llvm::StringRef AbsolutePath)
This creates a file:// URI for AbsolutePath. The path must be absolute.
TextDocumentIdentifier textDocument
The document that was opened.
std::string newText
The string to be inserted.
std::string newName
The new name of the symbol.
std::string command
The command identifier, e.g. CLANGD_APPLY_FIX_COMMAND.
TextDocumentIdentifier textDocument
std::string filterText
A string that should be used when filtering a set of completion items.
friend bool operator<(const Position &LHS, const Position &RHS)
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Range range
The range of the text document to be manipulated.
CompletionItemClientCapabilities completionItem
The client supports the following CompletionItem specific capabilities.
friend bool operator<(const Range &LHS, const Range &RHS)
llvm::Optional< Range > range
The range of the document that changed.
Position position
The position inside the text document.
std::vector< SignatureInformation > signatures
The resulting signatures.
llvm::Optional< int > rangeLength
The length of the range that got replaced.
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool)
TextDocumentItem textDocument
The document that was opened.
TextDocumentIdentifier textDocument
The document that did change.
std::vector< FileEvent > changes
The actual file events.
std::string languageId
The text document's language identifier.
llvm::Optional< std::string > rootPath
The rootPath of the workspace.
A LSP-specific comparator used to find diagnostic in a container like std:map.
int line
Line position in a document (zero-based).
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
friend bool operator<(const DocumentHighlight &LHS, const DocumentHighlight &RHS)
int character
Character offset on a line in a document (zero-based).
llvm::Optional< std::vector< SymbolKind > > valueSet
The SymbolKinds that the client supports.
bool contains(Position Pos) const
Represents the signature of a callable.
std::string query
A non-empty query string.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::bitset< SymbolKindMax+1 > SymbolKindBitset
std::string message
The diagnostic's code.
TextDocumentIdentifier textDocument
The text document.
json::Value toJSON(const URIForFile &U)
Serialize/deserialize URIForFile to/from a string URI.
std::string label
The label of this completion item.
friend bool operator==(const DocumentHighlight &LHS, const DocumentHighlight &RHS)
DocumentHighlightKind kind
The highlight kind, default is DocumentHighlightKind.Text.
SymbolKind adjustKindToCapability(SymbolKind Kind, SymbolKindBitset &SupportedSymbolKinds)
std::vector< Diagnostic > diagnostics
An array of diagnostics.
The parameters of a Workspace Symbol Request.
std::string text
The content of the opened text document.
Position position
The position at which this request was sent.
URIForFile uri
The text document's URI.
friend bool operator!=(const Location &LHS, const Location &RHS)
Range range
The range at which the message applies.
friend bool operator<(const URIForFile &LHS, const URIForFile &RHS)
Position end
The range's end position.
llvm::Optional< WorkspaceEdit > workspaceEdit
std::string toString() const
Returns a string URI with all components percent-encoded.
ClangdConfigurationParamsChange settings
bool operator<(const CompletionItem &L, const CompletionItem &R)
bool fromJSON(const json::Value &E, URIForFile &R)
friend bool operator==(const Position &LHS, const Position &RHS)
friend bool operator==(const Range &LHS, const Range &RHS)
llvm::Optional< std::string > compilationDatabasePath
raw_ostream & operator<<(raw_ostream &OS, const CodeCompletion &C)
constexpr auto SymbolKindMax
llvm::Optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
llvm::StringRef file() const
Retrieves absolute path to the file.