internal: Don't parse files unnecessarily in scope_for_offset

This commit is contained in:
Lukas Wirth 2022-07-23 00:50:59 +02:00
parent 84a6fac37a
commit cb6703fe06
4 changed files with 10 additions and 6 deletions

View file

@ -650,9 +650,7 @@ fn scope_for_offset(
.filter_map(|(id, scope)| {
let InFile { file_id, value } = source_map.expr_syntax(*id).ok()?;
if from_file == file_id {
let root = db.parse_or_expand(file_id)?;
let node = value.to_node(&root);
return Some((node.syntax().text_range(), scope));
return Some((value.text_range(), scope));
}
// FIXME handle attribute expansion