From 85633656dfc3ad4516a99e3062599e3ee85a578d Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 28 Apr 2019 15:43:10 +0200 Subject: Fix hover on the beginning of a nested expression E.g. in ``` let foo = 1u32; if true { <|>foo; } ``` the hover shows `()`, the type of the whole if expression, instead of the more sensible `u32`. The reason for this was that the search for an expression was slightly left-biased: When on the edge between two tokens, it first looked at all ancestors of the left token and then of the right token. Instead merge the ancestors in ascending order, so that we get the smaller of the two possible expressions. --- crates/ra_ide_api/src/goto_definition.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/ra_ide_api/src/goto_definition.rs') diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 40a2bd148..163781f88 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -25,6 +25,7 @@ pub(crate) fn goto_definition( None } +#[derive(Debug)] pub(crate) enum ReferenceResult { Exact(NavigationTarget), Approximate(Vec), -- cgit v1.2.3