mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Make nameresolution resilient to reparsing
We now store item id's instead of local syntax ptrs, and item ids don't change if you type inside a single function.
This commit is contained in:
parent
4d87799a4a
commit
10f4d4b74c
6 changed files with 139 additions and 84 deletions
|
@ -46,9 +46,12 @@ pub(super) fn completions(
|
|||
.iter()
|
||||
.filter(|(_name, res)| {
|
||||
// Don't expose this item
|
||||
match res.import_name {
|
||||
match res.import {
|
||||
None => true,
|
||||
Some(ptr) => !ptr.range().is_subrange(&name_ref.syntax().range()),
|
||||
Some(import) => {
|
||||
let range = import.range(db, module.source().file_id());
|
||||
!range.is_subrange(&name_ref.syntax().range())
|
||||
}
|
||||
}
|
||||
})
|
||||
.map(|(name, _res)| CompletionItem {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue