From 4eff8ddb8b8352d432d87198d43c674696ca9344 Mon Sep 17 00:00:00 2001 From: Hrvoje Ban Date: Thu, 24 Jan 2019 18:21:17 +0100 Subject: Fill in DocumentSymbol::detail --- crates/ra_syntax/src/ast/generated.rs | 18 ++++++++++--- crates/ra_syntax/src/grammar.ron | 51 ++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 24 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index ac6c8a835..be16511df 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -526,7 +526,11 @@ impl ast::NameOwner for ConstDef {} impl ast::TypeParamsOwner for ConstDef {} impl ast::AttrsOwner for ConstDef {} impl ast::DocCommentsOwner for ConstDef {} -impl ConstDef {} +impl ConstDef { + pub fn type_ref(&self) -> Option<&TypeRef> { + super::child_opt(self) + } +} // ContinueExpr #[derive(Debug, PartialEq, Eq, Hash)] @@ -3015,7 +3019,11 @@ impl ast::NameOwner for StaticDef {} impl ast::TypeParamsOwner for StaticDef {} impl ast::AttrsOwner for StaticDef {} impl ast::DocCommentsOwner for StaticDef {} -impl StaticDef {} +impl StaticDef { + pub fn type_ref(&self) -> Option<&TypeRef> { + super::child_opt(self) + } +} // Stmt #[derive(Debug, PartialEq, Eq, Hash)] @@ -3491,7 +3499,11 @@ impl ast::NameOwner for TypeDef {} impl ast::TypeParamsOwner for TypeDef {} impl ast::AttrsOwner for TypeDef {} impl ast::DocCommentsOwner for TypeDef {} -impl TypeDef {} +impl TypeDef { + pub fn type_ref(&self) -> Option<&TypeRef> { + super::child_opt(self) + } +} // TypeParam #[derive(Debug, PartialEq, Eq, Hash)] diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index c5297e46d..9a6f990b6 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -289,27 +289,36 @@ Grammar( collections: [["impl_items", "ImplItem"]], traits: [ "FnDefOwner", "ModuleItemOwner" ], ), - "ConstDef": ( traits: [ - "VisibilityOwner", - "NameOwner", - "TypeParamsOwner", - "AttrsOwner", - "DocCommentsOwner" - ] ), - "StaticDef": ( traits: [ - "VisibilityOwner", - "NameOwner", - "TypeParamsOwner", - "AttrsOwner", - "DocCommentsOwner" - ] ), - "TypeDef": ( traits: [ - "VisibilityOwner", - "NameOwner", - "TypeParamsOwner", - "AttrsOwner", - "DocCommentsOwner" - ] ), + "ConstDef": ( + traits: [ + "VisibilityOwner", + "NameOwner", + "TypeParamsOwner", + "AttrsOwner", + "DocCommentsOwner" + ], + options: ["TypeRef"] + ), + "StaticDef": ( + traits: [ + "VisibilityOwner", + "NameOwner", + "TypeParamsOwner", + "AttrsOwner", + "DocCommentsOwner" + ], + options: ["TypeRef"] + ), + "TypeDef": ( + traits: [ + "VisibilityOwner", + "NameOwner", + "TypeParamsOwner", + "AttrsOwner", + "DocCommentsOwner" + ], + options: ["TypeRef"] + ), "ImplBlock": (options: ["ItemList"]), "ParenType": (options: ["TypeRef"]), -- cgit v1.2.3