mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
use the included file as the source of expanded include macro
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
This commit is contained in:
parent
a0ed87ff56
commit
3bb9efb6b7
5 changed files with 107 additions and 28 deletions
|
@ -124,6 +124,7 @@ pub fn expand_eager_macro(
|
|||
subtree: Arc::new(parsed_args.clone()),
|
||||
krate,
|
||||
call: call_id,
|
||||
included_file: None,
|
||||
}
|
||||
});
|
||||
let arg_file_id: MacroCallId = arg_id.into();
|
||||
|
@ -143,9 +144,15 @@ pub fn expand_eager_macro(
|
|||
if let MacroDefKind::BuiltInEager(eager, _) = def.kind {
|
||||
let res = eager.expand(db, arg_id, &subtree);
|
||||
|
||||
let (subtree, fragment) = diagnostic_sink.expand_result_option(res)?;
|
||||
let eager =
|
||||
EagerCallLoc { def, fragment, subtree: Arc::new(subtree), krate, call: call_id };
|
||||
let expanded = diagnostic_sink.expand_result_option(res)?;
|
||||
let eager = EagerCallLoc {
|
||||
def,
|
||||
fragment: expanded.fragment,
|
||||
subtree: Arc::new(expanded.subtree),
|
||||
krate,
|
||||
call: call_id,
|
||||
included_file: expanded.included_file,
|
||||
};
|
||||
|
||||
Ok(db.intern_eager_expansion(eager))
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue