Treat BlockExpr as a potential module origin

This commit is contained in:
Jonas Schievink 2021-01-20 20:05:48 +01:00
parent 7d5ed18c42
commit 82146737ac
8 changed files with 44 additions and 7 deletions

View file

@ -294,6 +294,7 @@ impl ToNav for hir::Module {
ModuleSource::Module(node) => {
(node.syntax(), node.name().map(|it| it.syntax().text_range()))
}
ModuleSource::BlockExpr(node) => (node.syntax(), None),
};
let frange = src.with_value(syntax).original_file_range(db);
NavigationTarget::from_syntax(frange.file_id, name, focus, frange.range, SymbolKind::Module)

View file

@ -53,6 +53,12 @@ impl ShortLabel for ast::SourceFile {
}
}
impl ShortLabel for ast::BlockExpr {
fn short_label(&self) -> Option<String> {
None
}
}
impl ShortLabel for ast::TypeAlias {
fn short_label(&self) -> Option<String> {
short_label_from_node(self, "type ")