summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorIgor Khanin <igor@khanin.biz>2025-05-28 16:41:35 +0300
committerGitHub <noreply@github.com>2025-05-28 13:41:35 +0000
commit9ac21b8524632c70ab9e090488a70085eabe4189 (patch)
treee6dc6c3efe3a49141344633faea40d9a4e052b4b /crates
parent9bbfa5ae0593333b1f0afffd71fec198d61742a6 (diff)
Fix tracing of most field call expressions (#6234)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-eval/src/call.rs7
-rw-r--r--crates/typst-ide/src/tooltip.rs7
2 files changed, 13 insertions, 1 deletions
diff --git a/crates/typst-eval/src/call.rs b/crates/typst-eval/src/call.rs
index 6a57c85e..fa968341 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 e5e4cc19..528f679c 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("(..) => ..");
+ }
}