mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Support $crate
in item and expr place.
This commit is contained in:
parent
8cd23a4fb8
commit
2ecb126f5c
14 changed files with 268 additions and 37 deletions
|
@ -58,6 +58,17 @@ impl HirFileId {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the crate which the macro lives in, if it is a macro file.
|
||||
pub(crate) fn macro_crate(self, db: &impl AstDatabase) -> Option<Crate> {
|
||||
match self.0 {
|
||||
HirFileIdRepr::File(_) => None,
|
||||
HirFileIdRepr::Macro(macro_file) => {
|
||||
let loc = macro_file.macro_call_id.loc(db);
|
||||
Some(loc.def.krate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_or_expand_query(
|
||||
db: &impl AstDatabase,
|
||||
file_id: HirFileId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue