diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-28 15:11:07 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-28 15:11:07 +0100 |
commit | 8138b1da4f1564913a1a22407c65e77aa5320d56 (patch) | |
tree | 6b037199384ddf1021c2ad81886425dfcb8271a8 /crates/ra_assists/src/introduce_variable.rs | |
parent | 1dd3d9bc2d328e164c594f3d2022dcf174f907a9 (diff) | |
parent | 85633656dfc3ad4516a99e3062599e3ee85a578d (diff) |
Merge #1215
1215: Fix hover on the beginning of a nested expression r=matklad a=flodiebold
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.
This might seem rather inconsequential, but emacs-lsp's sideline requests hover for the beginning of each word in the current line, so it tends to hit this a lot :smile: Actually, as I think about this now, another solution might be just making hover right-biased, since if I'm hovering a certain character I really mean that character and not the one to its left...
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/introduce_variable.rs')
0 files changed, 0 insertions, 0 deletions