Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/syntax_highlighting/highlight.rs')
| -rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 52e729ee68..340168a90d 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -208,22 +208,14 @@ fn node( }, // Highlight references like the definitions they resolve to ast::NameRef(name_ref) => { - if node.ancestors().any(|it| it.kind() == ATTR) { - - // FIXME: We highlight paths in attributes slightly differently to work around this module - // currently not knowing about tool attributes and rustc builtin attributes as - // we do not want to resolve those to functions that may be defined in scope. - highlight_name_ref_in_attr(sema, name_ref) - } else { - highlight_name_ref( - sema, - krate, - bindings_shadow_count, - &mut binding_hash, - syntactic_name_ref_highlighting, - name_ref, - ) - } + highlight_name_ref( + sema, + krate, + bindings_shadow_count, + &mut binding_hash, + syntactic_name_ref_highlighting, + name_ref, + ) }, ast::Lifetime(lifetime) => { match NameClass::classify_lifetime(sema, &lifetime) { @@ -243,28 +235,6 @@ fn node( Some((highlight, binding_hash)) } -fn highlight_name_ref_in_attr(sema: &Semantics<RootDatabase>, name_ref: ast::NameRef) -> Highlight { - match NameRefClass::classify(sema, &name_ref) { - Some(name_class) => match name_class { - NameRefClass::Definition(Definition::Module(_)) - if name_ref - .syntax() - .ancestors() - .find_map(ast::Path::cast) - .map_or(false, |it| it.parent_path().is_some()) => - { - HlTag::Symbol(SymbolKind::Module) - } - NameRefClass::Definition(Definition::Macro(m)) if m.kind() == hir::MacroKind::Attr => { - HlTag::Symbol(SymbolKind::Macro) - } - _ => HlTag::BuiltinAttr, - }, - None => HlTag::BuiltinAttr, - } - .into() -} - fn highlight_name_ref( sema: &Semantics<RootDatabase>, krate: Option<hir::Crate>, @@ -542,8 +512,8 @@ fn highlight_def( h } Definition::Label(_) => Highlight::new(HlTag::Symbol(SymbolKind::Label)), - Definition::BuiltinAttr(_) => Highlight::new(HlTag::Symbol(SymbolKind::Label)), // FIXME - Definition::Tool(_) => Highlight::new(HlTag::Symbol(SymbolKind::Label)), // FIXME + Definition::BuiltinAttr(_) => Highlight::new(HlTag::Symbol(SymbolKind::BuiltinAttr)), + Definition::Tool(_) => Highlight::new(HlTag::Symbol(SymbolKind::Tool)), }; let famous_defs = FamousDefs(sema, krate); |