mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
feat: Resolve builtin-attr and tools in ide layer
This commit is contained in:
parent
4691a0647b
commit
e58af219a4
15 changed files with 209 additions and 99 deletions
|
@ -2023,6 +2023,26 @@ impl Local {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct BuiltinAttr(usize);
|
||||
|
||||
impl BuiltinAttr {
|
||||
pub(crate) fn by_name(name: &str) -> Option<Self> {
|
||||
// TODO: def maps registered attrs?
|
||||
hir_def::builtin_attr::find_builtin_attr_idx(name).map(Self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct Tool(usize);
|
||||
|
||||
impl Tool {
|
||||
pub(crate) fn by_name(name: &str) -> Option<Self> {
|
||||
// TODO: def maps registered tools
|
||||
hir_def::builtin_attr::TOOL_MODULES.iter().position(|&tool| tool == name).map(Self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct Label {
|
||||
pub(crate) parent: DefWithBodyId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue