summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Protocol.h
diff options
context:
space:
mode:
authorNathan Ridge <zeratul976@hotmail.com>2019-07-12 03:26:32 +0000
committerNathan Ridge <zeratul976@hotmail.com>2019-07-12 03:26:32 +0000
commit5b9484e559d44bd923fc290e335891b1dd2e17c4 (patch)
tree9b900d93f5f14eb8563771b2027a580409920c5c /clang-tools-extra/clangd/Protocol.h
parentc46d78d1b7a06aad11f8810279271224fc8466af (diff)
downloadbcm5719-llvm-5b9484e559d44bd923fc290e335891b1dd2e17c4.tar.gz
bcm5719-llvm-5b9484e559d44bd923fc290e335891b1dd2e17c4.zip
[clangd] Implement typeHierarchy/resolve for subtypes
Summary: This allows the client to resolve subtypes one level at a time. For supertypes, this is not necessary, because we eagerly compute supertypes and return all levels. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64308 llvm-svn: 365867
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.h')
-rw-r--r--clang-tools-extra/clangd/Protocol.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index 7a1a8c77d25..a2c9438ea9d 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -1127,7 +1127,7 @@ struct TypeHierarchyItem {
SymbolKind kind;
/// `true` if the hierarchy item is deprecated. Otherwise, `false`.
- bool deprecated;
+ bool deprecated = false;
/// The URI of the text document where this type hierarchy item belongs to.
URIForFile uri;
@@ -1153,13 +1153,26 @@ struct TypeHierarchyItem {
/// descendants. If not defined, the children have not been resolved.
llvm::Optional<std::vector<TypeHierarchyItem>> children;
- /// The protocol has a slot here for an optional 'data' filed, which can
- /// be used to identify a type hierarchy item in a resolve request. We don't
- /// need this (the item itself is sufficient to identify what to resolve)
- /// so don't declare it.
+ /// An optional 'data' filed, which can be used to identify a type hierarchy
+ /// item in a resolve request.
+ llvm::Optional<std::string> data;
};
llvm::json::Value toJSON(const TypeHierarchyItem &);
llvm::raw_ostream &operator<<(llvm::raw_ostream &, const TypeHierarchyItem &);
+bool fromJSON(const llvm::json::Value &, TypeHierarchyItem &);
+
+/// Parameters for the `typeHierarchy/resolve` request.
+struct ResolveTypeHierarchyItemParams {
+ /// The item to resolve.
+ TypeHierarchyItem item;
+
+ /// The hierarchy levels to resolve. `0` indicates no level.
+ int resolve;
+
+ /// The direction of the hierarchy levels to resolve.
+ TypeHierarchyDirection direction;
+};
+bool fromJSON(const llvm::json::Value &, ResolveTypeHierarchyItemParams &);
struct ReferenceParams : public TextDocumentPositionParams {
// For now, no options like context.includeDeclaration are supported.
OpenPOWER on IntegriCloud