Basic hover for builtin-attr and tool modules

This commit is contained in:
Lukas Wirth 2021-12-03 17:10:56 +01:00
parent db559e5049
commit 70b8331fd5
2 changed files with 13 additions and 2 deletions

View file

@ -2031,6 +2031,11 @@ impl BuiltinAttr {
// FIXME: def maps registered attrs?
hir_def::builtin_attr::find_builtin_attr_idx(name).map(Self)
}
pub fn name(&self, _: &dyn HirDatabase) -> &str {
// FIXME: Return a `Name` here
hir_def::builtin_attr::INERT_ATTRIBUTES[self.0].name
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
@ -2041,6 +2046,11 @@ impl Tool {
// FIXME: def maps registered tools
hir_def::builtin_attr::TOOL_MODULES.iter().position(|&tool| tool == name).map(Self)
}
pub fn name(&self, _: &dyn HirDatabase) -> &str {
// FIXME: Return a `Name` here
hir_def::builtin_attr::TOOL_MODULES[self.0]
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]