Closed aljazerzen closed 1 week ago
Actually, this PR is combination of the two things you've suggested.
--debug-log=my_log.json
will create a JSON file with all of the AST reprs emitted. This file could probably be read back and rendered to the HTML output,compile
invocation produces all that you need. ATM, we are 80% there.Actually, this PR is combination of the two things you've suggested.
Yes! My musing was whether splitting it up made sense (but really just a musing and maybe not that useful..)
More refinement:
I tried this out — really really cool! Very impressive you could pull together a UI so quickly!
FWIW when I try I don't get the highlights across the different stages (like in your query) unless I select the whole query, but possibly that's because the spans aren't serialized yet.
Other small thoughts (obv you are the owner and so only consider these if they're useful, am strongly not trying to say these are necessarily good)
integrate with playground? Maybe that's more work than it saves though. Mostly similar goals (would want a check-box to show / hide, similar to what we have with outputting PL & RQ now)
Yes, this is possible to do. We just need to expose the --debug-log argument to JS bindings somehow. We'd probably change the type signature, so the debug log is returned instead of written into a file.
minor but it would be v nice to have the stages in each column, so we can see across them — i.e. "what RQ comes from this expression"
This is easy to do! Newer versions are somewhat easier to parse visually, so it might not even be needed, but yes, can be done.
Adds a framework for capturing debug information during the compilation process.
First stab at #4636
The result can be serialized into JSON or rendered into HTML (image below). Current display is not much better than plain terminal output, but this has potential for better visualization of what is going on in the compiler.