internal: Enforce Resolver to always have a module scope

This commit is contained in:
Lukas Wirth
2022-03-31 11:12:08 +02:00
parent ef92453dfe
commit 75689f2ad8
71 changed files with 360 additions and 398 deletions

View File

@@ -179,12 +179,16 @@ pub(crate) fn highlight(
};
let mut hl = highlights::Highlights::new(root.text_range());
let krate = match sema.scope(&root) {
Some(it) => it.krate(),
None => return hl.to_vec(),
};
traverse(
&mut hl,
&sema,
file_id,
&root,
sema.scope(&root).krate(),
krate,
range_to_highlight,
syntactic_name_ref_highlighting,
);
@@ -196,7 +200,7 @@ fn traverse(
sema: &Semantics<RootDatabase>,
file_id: FileId,
root: &SyntaxNode,
krate: Option<hir::Crate>,
krate: hir::Crate,
range_to_highlight: TextRange,
syntactic_name_ref_highlighting: bool,
) {