I am using https://github.com/rustwasm/console_error_panic_hook + Chrome
On panic, we get a number of lines of the form (in the JS Console)
I want these lines to be click able. Upon clicking on the line, I want the entire string to be sent out of the browser (calling a system program, making an AJAX call, … I don’t care).
I just need to get the string out so I can parse it with an external program and tell IntelliJ to jump to the right file / line.
I have no idea how to do this. I think others also want this. Suggestions?
This is usually achieved with a source map.
It’s sometimes PITA to set up. I see there has been some work done on this:
@kornel : How does the above work? I was under the impression that sourcemaps were NOT supported yet for rust on targedt wasm32-unknown-unknown .
What I am asking is much more light weight (compared to setting up source maps) – the information is already there, I just want a way to make the line of text in JS console clickable.
In particular, what I am requesting can be done entirely as a Chrome plugin, whereas sourcemaps requires deep compiler black magicery.
I haven’t used source maps with WASM, but source maps from other languages give exactly the clickability you want.
Other than that there are no good options for making things clickable in the console. You could log URLs with a custom URL scheme like “web+rust://localhost/file.rs” and set up a handler that handles these URLs.
I have used SourceMaps in other languages (CLJS in particular).
I acan not get SourceMaps to work with WASM.
It’s not clear how to get SourceMaps to work with Rustc.
On the other hand, I think there’s a short + simple solution to the problem I have described