diff options
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.h')
-rw-r--r-- | clang-tools-extra/clangd/Protocol.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index f110292b091..1ccfa587bf8 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -1250,6 +1250,39 @@ struct SelectionRange { }; llvm::json::Value toJSON(const SelectionRange &); +/// Parameters for the document link request. +struct DocumentLinkParams { + /// The document to provide document links for. + TextDocumentIdentifier textDocument; +}; +bool fromJSON(const llvm::json::Value &, DocumentLinkParams &); + +/// A range in a text document that links to an internal or external resource, +/// like another text document or a web site. +struct DocumentLink { + /// The range this link applies to. + Range range; + + /// The uri this link points to. If missing a resolve request is sent later. + URIForFile target; + + // TODO(forster): The following optional fields defined by the language + // server protocol are unsupported: + // + // data?: any - A data entry field that is preserved on a document link + // between a DocumentLinkRequest and a + // DocumentLinkResolveRequest. + + friend bool operator==(const DocumentLink &LHS, const DocumentLink &RHS) { + return LHS.range == RHS.range && LHS.target == RHS.target; + } + + friend bool operator!=(const DocumentLink &LHS, const DocumentLink &RHS) { + return !(LHS == RHS); + } +}; +llvm::json::Value toJSON(const DocumentLink &DocumentLink); + } // namespace clangd } // namespace clang |