Implementations lens for unions

closes #4728
This commit is contained in:
Aleksey Kladov 2020-07-11 22:48:56 +02:00
parent 00c81f8006
commit b34cdf7bf4
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))
},
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),

View file

@ -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);