redhat-developer / quarkus-ls

Language server for Quarkus tooling
Eclipse Public License 2.0
43 stars 15 forks source link

[Qute] Debugging Qute template #190

Open angelozerr opened 4 years ago

angelozerr commented 4 years ago

It should be very nice if we could debug with breakpoint a Qute template by using https://microsoft.github.io/debug-adapter-protocol/

@maxandersen @mkouba what you think with this idea?

maxandersen commented 4 years ago

if Qute ends up generating bytecode for all its code rather than just interpret it then this should "just work" assuming we can generate proper source maps.... for now I believe Qute does interpret its while/for loops rather than generate it... question for @mkouba how far away this is.

mkouba commented 4 years ago

Indeed, we don't compile the templates into bytecode. Instead, we parse a template into a tree of Java objects (nodes) and then execute these nodes when rendering the template at runtime. Also note that Qute resolves the nodes/expressions asynchronously and once everything is ready we synchronously build the output.

angelozerr commented 4 years ago

Indeed, we don't compile the templates into bytecode.

Great, so we will able to do like the old FreeMarker debugger support https://github.com/apache/freemarker/tree/a03a1473b65d9819674b285a0538fed824f37478/src/main/java/freemarker/debug

The basic idea is to add/remove a BreakPoint in the Template and when template is rendered, the debugger suspend the process until debugger is re-run.

Also note that Qute resolves the nodes/expressions asynchronously and once everything is ready we synchronously build the output.

We will need to experiment how to support that.

@maxandersen @mkouba do you like this idea about debugging Qute template?

angelozerr commented 2 years ago

@maxandersen @mkouba do you like this idea about debugging Qute template?

mkouba commented 2 years ago

It might be useful but IMO a low priority feature...

angelozerr commented 2 years ago

I have started to write a POC in my spare time, and for the moment I can stop to the defined breakpoint:

image