Set the kernel to Deno. (Seems to be ~/.deno/bin/deno.)
Enter the following code:
console.log("1");
console.log("2");
console.log("3");
throw new Error("fail");
The output is a stack trace:
Stack trace:
Error: fail
at <anonymous>:5:7
So this is off by 1.
But this gets worse for classes:
class Camera {
constructor(public x: number, public y: number, public dir: number) {}
get pos(): [number, number] {
return [this.x, this.y];
}
get dirVector(): [number, number] {
return [Math.cos(this.dir * Math.PI / 180), Math.sin(this.dir * Math.PI / 180)];
}
get left(): [number, number] {
const half_width = params.camera_width / 2;
const dir = (this.dir - half_width) * Math.PI / 180;
return [Math.cos(dir), Math.sin(dir)];
}
get right(): [number, number] {
const half_width = params.camera_width / 2;
const dir = (this.dir + half_width) * Math.PI / 180;
return [Math.cos(dir), Math.sin(dir)];
}
}
throw new Error("fail");
The stack trace I get is:
Stack trace:
Error: fail
at <anonymous>:40:7
The actual line number is 25. I suspect the JavaScript line number isn't getting run through a sourcemap to get the TypeScript line number?
(Also, this is more of a feature request, but it would be friendlier to reproduce the source code in the error message like Python does, since cells don't have line numbers turned on by default.)
To reproduce:
The output is a stack trace:
So this is off by 1.
But this gets worse for classes:
The stack trace I get is:
The actual line number is 25. I suspect the JavaScript line number isn't getting run through a sourcemap to get the TypeScript line number?
(Also, this is more of a feature request, but it would be friendlier to reproduce the source code in the error message like Python does, since cells don't have line numbers turned on by default.)