diff options
author | Edwin Cheng <[email protected]> | 2019-12-14 17:20:07 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-14 17:24:51 +0000 |
commit | 61360fdfec981eadef1eefb595c8b32c951771e8 (patch) | |
tree | 08e89aa372dd4680569ee4a7788019196d65b375 /crates/ra_ide/src/display | |
parent | 7238037de42a2fd88434930c521b926d7b0026da (diff) |
Fix original_source find order
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 6a6b49afd..6a2bf7273 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -7,10 +7,14 @@ use ra_syntax::{ | |||
7 | ast::{self, DocCommentsOwner, NameOwner}, | 7 | ast::{self, DocCommentsOwner, NameOwner}, |
8 | match_ast, AstNode, SmolStr, | 8 | match_ast, AstNode, SmolStr, |
9 | SyntaxKind::{self, BIND_PAT, TYPE_PARAM}, | 9 | SyntaxKind::{self, BIND_PAT, TYPE_PARAM}, |
10 | TextRange, | 10 | SyntaxNode, TextRange, |
11 | }; | 11 | }; |
12 | 12 | ||
13 | use crate::{db::RootDatabase, expand::original_range, FileSymbol}; | 13 | use crate::{ |
14 | db::RootDatabase, | ||
15 | expand::{original_range_by_kind, OriginalRangeKind}, | ||
16 | FileRange, FileSymbol, | ||
17 | }; | ||
14 | 18 | ||
15 | use super::short_label::ShortLabel; | 19 | use super::short_label::ShortLabel; |
16 | 20 | ||
@@ -416,3 +420,14 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
416 | } | 420 | } |
417 | } | 421 | } |
418 | } | 422 | } |
423 | |||
424 | fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange { | ||
425 | if let Some(range) = original_range_by_kind(db, node, OriginalRangeKind::CallToken) { | ||
426 | return range; | ||
427 | } | ||
428 | if let Some(range) = original_range_by_kind(db, node, OriginalRangeKind::WholeCall) { | ||
429 | return range; | ||
430 | } | ||
431 | |||
432 | FileRange { file_id: node.file_id.original_file(db), range: node.value.text_range() } | ||
433 | } | ||