Auto merge of #16439 - wasd96040501:feat/gotodef3, r=Veykril

feat: Support for GOTO def from *inside* files included with include! macro

close #14937
Try to implement goto def from *inside* files included with include! macro.
This implementation has two limitations:
1. Only **one** file which calls include! will be tracked. (I think multiple file be included is a rare case and we may let it go for now)
2. Mapping token from included file to macro call file (semantics.rs:646~658) works fine but I am not sure is this the correct way to implement.
This commit is contained in:
bors 2024-01-30 11:27:18 +00:00
commit 22b6f9679d
7 changed files with 163 additions and 12 deletions

View file

@ -523,6 +523,24 @@ impl MacroCallLoc {
}
}
}
pub fn include_file_id(
&self,
db: &dyn ExpandDatabase,
macro_call_id: MacroCallId,
) -> Option<FileId> {
if self.def.is_include() {
if let Some(eager) = &self.eager {
if let Ok(it) =
builtin_fn_macro::include_input_to_file_id(db, macro_call_id, &eager.arg)
{
return Some(it);
}
}
}
None
}
}
impl MacroCallKind {