feat: Deprioritize ops methods in completion

This commit is contained in:
Lukas Wirth 2022-01-06 13:31:36 +01:00
parent 41a0e95d61
commit ca0633c808
6 changed files with 106 additions and 30 deletions

View file

@ -1610,6 +1610,12 @@ pub struct Trait {
}
impl Trait {
pub fn lang(db: &dyn HirDatabase, krate: Crate, name: &Name) -> Option<Trait> {
db.lang_item(krate.into(), name.to_smol_str())
.and_then(LangItemTarget::as_trait)
.map(Into::into)
}
pub fn module(self, db: &dyn HirDatabase) -> Module {
Module { id: self.id.lookup(db.upcast()).container }
}