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:
Aleksey Kladov 2018-11-27 14:11:36 +03:00
parent 4d87799a4a
commit 10f4d4b74c
6 changed files with 139 additions and 84 deletions

View file

@ -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 {