Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/syntax_highlighting.rs')
| -rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 531c7e1f4d..e7c5f95a25 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -197,9 +197,7 @@ pub(crate) fn highlight( ) -> Vec<HlRange> { let _p = tracing::info_span!("highlight").entered(); let sema = Semantics::new(db); - let file_id = sema - .attach_first_edition(file_id) - .unwrap_or_else(|| EditionedFileId::current_edition(db, file_id)); + let file_id = sema.attach_first_edition(file_id); // Determine the root based on the given range. let (root, range_to_highlight) = { @@ -437,17 +435,15 @@ fn traverse( |node| unsafe_ops.contains(&InFile::new(descended_element.file_id, node)); let element = match descended_element.value { NodeOrToken::Node(name_like) => { - let hl = hir::attach_db(sema.db, || { - highlight::name_like( - sema, - krate, - bindings_shadow_count, - &is_unsafe_node, - config.syntactic_name_ref_highlighting, - name_like, - edition, - ) - }); + let hl = highlight::name_like( + sema, + krate, + bindings_shadow_count, + &is_unsafe_node, + config.syntactic_name_ref_highlighting, + name_like, + edition, + ); if hl.is_some() && !in_macro { // skip highlighting the contained token of our name-like node // as that would potentially overwrite our result @@ -455,10 +451,10 @@ fn traverse( } hl } - NodeOrToken::Token(token) => hir::attach_db(sema.db, || { + NodeOrToken::Token(token) => { highlight::token(sema, token, edition, &is_unsafe_node, tt_level > 0) .zip(Some(None)) - }), + } }; if let Some((mut highlight, binding_hash)) = element { if is_unlinked && highlight.tag == HlTag::UnresolvedReference { |