From 9ac21b8524632c70ab9e090488a70085eabe4189 Mon Sep 17 00:00:00 2001 From: Igor Khanin Date: Wed, 28 May 2025 16:41:35 +0300 Subject: [PATCH] Fix tracing of most field call expressions (#6234) --- crates/typst-eval/src/call.rs | 7 ++++++- crates/typst-ide/src/tooltip.rs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/typst-eval/src/call.rs b/crates/typst-eval/src/call.rs index 6a57c85e8..fa9683416 100644 --- a/crates/typst-eval/src/call.rs +++ b/crates/typst-eval/src/call.rs @@ -37,7 +37,12 @@ impl Eval for ast::FuncCall<'_> { let target = access.target(); let field = access.field(); match eval_field_call(target, field, args, span, vm)? { - FieldCall::Normal(callee, args) => (callee, args), + FieldCall::Normal(callee, args) => { + if vm.inspected == Some(callee_span) { + vm.trace(callee.clone()); + } + (callee, args) + } FieldCall::Resolved(value) => return Ok(value), } } else { diff --git a/crates/typst-ide/src/tooltip.rs b/crates/typst-ide/src/tooltip.rs index e5e4cc19a..528f679cf 100644 --- a/crates/typst-ide/src/tooltip.rs +++ b/crates/typst-ide/src/tooltip.rs @@ -371,4 +371,11 @@ mod tests { test(&world, -2, Side::Before).must_be_none(); test(&world, -2, Side::After).must_be_text("This star imports `a`, `b`, and `c`"); } + + #[test] + fn test_tooltip_field_call() { + let world = TestWorld::new("#import \"other.typ\"\n#other.f()") + .with_source("other.typ", "#let f = (x) => 1"); + test(&world, -4, Side::After).must_be_code("(..) => .."); + } }