5324: Implementations lens for unions r=matklad a=matklad

closes #4728



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-11 20:53:57 +00:00 committed by GitHub
commit 02efda91d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -127,6 +127,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
decl_with_detail(it, Some(detail)) decl_with_detail(it, Some(detail))
}, },
ast::StructDef(it) => decl(it), ast::StructDef(it) => decl(it),
ast::UnionDef(it) => decl(it),
ast::EnumDef(it) => decl(it), ast::EnumDef(it) => decl(it),
ast::EnumVariant(it) => decl(it), ast::EnumVariant(it) => decl(it),
ast::TraitDef(it) => decl(it), ast::TraitDef(it) => decl(it),

View file

@ -878,9 +878,14 @@ pub(crate) fn handle_code_lens(
snap.analysis snap.analysis
.file_structure(file_id)? .file_structure(file_id)?
.into_iter() .into_iter()
.filter(|it| match it.kind { .filter(|it| {
SyntaxKind::TRAIT_DEF | SyntaxKind::STRUCT_DEF | SyntaxKind::ENUM_DEF => true, matches!(
_ => false, it.kind,
SyntaxKind::TRAIT_DEF
| SyntaxKind::STRUCT_DEF
| SyntaxKind::ENUM_DEF
| SyntaxKind::UNION_DEF
)
}) })
.map(|it| { .map(|it| {
let range = to_proto::range(&line_index, it.node_range); let range = to_proto::range(&line_index, it.node_range);