From b34cdf7bf47c87290500a573756e719a2699cd3b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Jul 2020 22:48:56 +0200 Subject: Implementations lens for unions closes #4728 --- crates/ra_ide/src/display/structure.rs | 1 + crates/rust-analyzer/src/handlers.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/ra_ide/src/display/structure.rs b/crates/ra_ide/src/display/structure.rs index c22a5d17b..1f6a3febf 100644 --- a/crates/ra_ide/src/display/structure.rs +++ b/crates/ra_ide/src/display/structure.rs @@ -127,6 +127,7 @@ fn structure_node(node: &SyntaxNode) -> Option { decl_with_detail(it, Some(detail)) }, ast::StructDef(it) => decl(it), + ast::UnionDef(it) => decl(it), ast::EnumDef(it) => decl(it), ast::EnumVariant(it) => decl(it), ast::TraitDef(it) => decl(it), diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index d39dceae0..85758eed6 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -878,9 +878,14 @@ pub(crate) fn handle_code_lens( snap.analysis .file_structure(file_id)? .into_iter() - .filter(|it| match it.kind { - SyntaxKind::TRAIT_DEF | SyntaxKind::STRUCT_DEF | SyntaxKind::ENUM_DEF => true, - _ => false, + .filter(|it| { + matches!( + it.kind, + SyntaxKind::TRAIT_DEF + | SyntaxKind::STRUCT_DEF + | SyntaxKind::ENUM_DEF + | SyntaxKind::UNION_DEF + ) }) .map(|it| { let range = to_proto::range(&line_index, it.node_range); -- cgit v1.2.3