mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
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:
commit
22b6f9679d
7 changed files with 163 additions and 12 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue