mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
Fix highlighting of const patterns
This commit is contained in:
parent
209eb32796
commit
5ebfcb9cb7
5 changed files with 60 additions and 15 deletions
|
@ -90,6 +90,12 @@ impl NameClass {
|
|||
}
|
||||
|
||||
pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> {
|
||||
if let Some(bind_pat) = name.syntax().parent().and_then(ast::BindPat::cast) {
|
||||
if let Some(def) = sema.resolve_bind_pat_to_const(&bind_pat) {
|
||||
return Some(NameClass::ConstReference(NameDefinition::ModuleDef(def)));
|
||||
}
|
||||
}
|
||||
|
||||
classify_name_inner(sema, name).map(NameClass::NameDefinition)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue