From 6a6ce2bc959c346aed7a98c8509d1aa3d19ec8a9 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Wed, 23 Jan 2019 15:59:19 -0500 Subject: Make EnumVariant a DocCommentsOwner --- crates/ra_syntax/src/ast/generated.rs | 1 + crates/ra_syntax/src/grammar.ron | 2 +- crates/ra_syntax/src/parser_impl/event.rs | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 9fe946172..ac6c8a835 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -632,6 +632,7 @@ impl AstNode for EnumVariant { impl ast::NameOwner for EnumVariant {} +impl ast::DocCommentsOwner for EnumVariant {} impl EnumVariant { pub fn expr(&self) -> Option<&Expr> { super::child_opt(self) diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 0385183fd..c5297e46d 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -279,7 +279,7 @@ Grammar( "DocCommentsOwner" ], options: [["variant_list", "EnumVariantList"]] ), "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), - "EnumVariant": ( traits: ["NameOwner"], options: ["Expr"] ), + "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ), "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"] ), "Module": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], diff --git a/crates/ra_syntax/src/parser_impl/event.rs b/crates/ra_syntax/src/parser_impl/event.rs index 73dd6e02b..bd77fee89 100644 --- a/crates/ra_syntax/src/parser_impl/event.rs +++ b/crates/ra_syntax/src/parser_impl/event.rs @@ -249,7 +249,8 @@ fn n_attached_trivias<'a>( trivias: impl Iterator, ) -> usize { match kind { - CONST_DEF | TYPE_DEF | STRUCT_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | MODULE => { + CONST_DEF | TYPE_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF + | MODULE => { let mut res = 0; for (i, (kind, text)) in trivias.enumerate() { match kind { -- cgit v1.2.3