From 38853459e3d964cc7f635829cdc66f5faee33d85 Mon Sep 17 00:00:00 2001 From: ice1000 Date: Tue, 3 Dec 2019 15:24:02 -0500 Subject: Add `ModuleSource::Block` --- crates/ra_ide/src/display/navigation_target.rs | 43 +++++++++----------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'crates/ra_ide/src/display') diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index f920d3db6..b376fcdae 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -231,34 +231,21 @@ impl ToNav for hir::Module { fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { let src = self.definition_source(db); let name = self.name(db).map(|it| it.to_string().into()).unwrap_or_default(); - match &src.value { - ModuleSource::SourceFile(node) => { - let frange = original_range(db, src.with_value(node.syntax())); - - NavigationTarget::from_syntax( - frange.file_id, - name, - None, - frange.range, - node.syntax().kind(), - None, - None, - ) - } - ModuleSource::Module(node) => { - let frange = original_range(db, src.with_value(node.syntax())); - - NavigationTarget::from_syntax( - frange.file_id, - name, - None, - frange.range, - node.syntax().kind(), - node.doc_comment_text(), - node.short_label(), - ) - } - } + let syntax = match &src.value { + ModuleSource::SourceFile(node) => node.syntax(), + ModuleSource::Module(node) => node.syntax(), + ModuleSource::Block(node) => node.syntax(), + }; + let frange = original_range(db, src.with_value(syntax)); + NavigationTarget::from_syntax( + frange.file_id, + name, + None, + frange.range, + syntax.kind(), + None, + None, + ) } } -- cgit v1.2.3