mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
the scope of the return type is not the body of the function
This commit is contained in:
parent
519d7484f3
commit
fbf8e12234
3 changed files with 30 additions and 7 deletions
|
@ -600,13 +600,11 @@ fn scope_for_offset(
|
|||
.filter(|it| it.value.kind() == SyntaxKind::MACRO_CALL)?;
|
||||
Some((source.value.text_range(), scope))
|
||||
})
|
||||
// find containing scope
|
||||
.min_by_key(|(expr_range, _scope)| {
|
||||
(
|
||||
!(expr_range.start() <= offset.value && offset.value <= expr_range.end()),
|
||||
expr_range.len(),
|
||||
)
|
||||
.filter(|(expr_range, _scope)| {
|
||||
expr_range.start() <= offset.value && offset.value <= expr_range.end()
|
||||
})
|
||||
// find containing scope
|
||||
.min_by_key(|(expr_range, _scope)| expr_range.len())
|
||||
.map(|(expr_range, scope)| {
|
||||
adjust(db, scopes, source_map, expr_range, offset).unwrap_or(*scope)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue