fix: Fix nested includes resolving from the wrong base file

This commit is contained in:
Lukas Wirth 2024-01-11 12:41:47 +01:00
parent d5366b5c19
commit 215ede8497
3 changed files with 54 additions and 2 deletions

View file

@ -318,6 +318,7 @@ pub trait MacroFileIdExt {
fn expansion_level(self, db: &dyn ExpandDatabase) -> u32;
/// If this is a macro call, returns the syntax node of the call.
fn call_node(self, db: &dyn ExpandDatabase) -> InFile<SyntaxNode>;
fn parent(self, db: &dyn ExpandDatabase) -> HirFileId;
fn expansion_info(self, db: &dyn ExpandDatabase) -> ExpansionInfo;
@ -353,6 +354,9 @@ impl MacroFileIdExt for MacroFileId {
};
}
}
fn parent(self, db: &dyn ExpandDatabase) -> HirFileId {
self.macro_call_id.lookup(db).kind.file_id()
}
/// Return expansion information if it is a macro-expansion file
fn expansion_info(self, db: &dyn ExpandDatabase) -> ExpansionInfo {