-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Provide Qute DAP debugger support #48962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
conditionEngine = Engine.builder().addDefaults().build(); | ||
} | ||
|
||
public static TemplateNode parseCondition(String condition) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkouba I need to evaluate Qute condition expression:
- to manage conditonal breakpoint
- evaluate a conditional expression when user evaluate an expression with debugger
Qute doesn't provide this mechanism. My hack is to create a template with #if
and get this ifNode.
} | ||
|
||
public CompletionStage<Object> evaluate(String expression) { | ||
if (expression.contains("!") || expression.contains(">") || expression.contains("gt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When user evaluate an expression with client debugger (vscode, IntelliJ, etc) it does that with a simple field.
Here I need to know if expression is a conditional expression or a simple expression to evaluate it.
} | ||
|
||
public SourceTemplateRegistry(List<String> basePaths, List<String> fileExtensions) { | ||
this.basePaths = basePaths; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Qute doesn't store the template file path, but only template id, I need to manage a mapping between template id and full file path):
- basePaths will search templates from those basePaths
- file extension
It would be super nice if Qute could manage those file path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is you don't always have a file path because templates are not necessarily backed by a file. In theory, we could record a map of ids to file paths (for file-based templates) and make it accessible via io.quarkus.qute.runtime.QuteRecorder.QuteContext
if it helps... but that won't help for Qute-standalone use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed you already explained me that. But I think if Quarkus knows the file path of the template it should fill it somewhere.
As it should work in Qute standalone mode, using QuteContext in the debugger is a bad idea.
Ideally Template should store the file path and have Template#getFilePath()
but as template can be used without file, an another idea is to add a new API in Template : Template.setAttribute / Template.getAttribute
like you did for TemplateInstance.
QuteContext could update Template with the proper file path by using Template#setAttribute with the "qute.file.path" key and debuger could trigger Template.getAttribute("qute.file.path" ). If it is null (ex: in standalone mode) debugger will switch with my current strategy.
For standalone, Qute could provide a FilePathLocator which could update Template#setAttribute.
3ecf910
to
9bf2d51
Compare
Signed-off-by: azerr <[email protected]>
9bf2d51
to
76ca333
Compare
Here a draft PR which provide Qute DAP debugger support
This PR contains a README.md (not finished) which explains how the debugger is working.
I need to clean code, write doc, write tests and improve completion, but the debugger can be used.
@mkouba I will add comments github to speak about some choice that I did because of some missing features of Qute engine (because you don't need it) like
//cc @mkouba @ia3andy @FroMage