Move attribute path completions into attribute completion module

This commit is contained in:
Lukas Wirth 2022-02-02 13:35:46 +01:00
parent 46b5089bfa
commit 6940cca760
11 changed files with 139 additions and 107 deletions

View file

@ -949,12 +949,15 @@ impl<'db> SemanticsImpl<'db> {
})?;
match res {
Either::Left(path) => resolve_hir_path(
self.db,
&self.scope(derive.syntax()).resolver,
&Path::from_known_path(path, []),
)
.filter(|res| matches!(res, PathResolution::Def(ModuleDef::Module(_)))),
Either::Left(path) => {
let len = path.len();
resolve_hir_path(
self.db,
&self.scope(derive.syntax()).resolver,
&Path::from_known_path(path, vec![None; len]),
)
.filter(|res| matches!(res, PathResolution::Def(ModuleDef::Module(_))))
}
Either::Right(derive) => derive
.map(|call| MacroDef { id: self.db.lookup_intern_macro_call(call).def })
.map(PathResolution::Macro),