A RemoteStackFrame corresponds to the evaluation of a TemplateNode
during the rendering of a Qute template. It encapsulates the current execution context,
including variables, scopes, and the source template being processed.
This class integrates with the Debug Adapter Protocol (DAP) through
StackFrame, enabling external debuggers (like VSCode or IntelliJ)
to display Qute stack frames, inspect variables, and evaluate expressions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.eclipse.lsp4j.debug.StackFrame[]Represents an empty array of stack frames. -
Constructor Summary
ConstructorsConstructorDescriptionRemoteStackFrame(io.quarkus.qute.trace.ResolveEvent event, RemoteStackFrame previousFrame, SourceTemplateRegistry sourceTemplateRegistry, VariablesRegistry variablesRegistry, RemoteThread remoteThread) Creates a newRemoteStackFrame. -
Method Summary
Modifier and TypeMethodDescriptionio.quarkus.qute.EvalContextcreateEvalContext(Object base) Creates a newEvalContextfor the given base object.Evaluates an arbitrary Qute expression in the current frame context.evaluateCondition(io.quarkus.qute.TemplateNode ifNode, boolean ignoreError) Evaluates the given Quteifnode in the current context.evaluateConditionInRenderThread(io.quarkus.qute.TemplateNode ifNode, boolean ignoreError) Evaluates a parsed conditional expression within the render thread context.io.quarkus.qute.Engineio.quarkus.qute.trace.ResolveEventgetEvent()Returns the list of scopes for this frame.Methods inherited from class org.eclipse.lsp4j.debug.StackFrame
equals, getCanRestart, getColumn, getEndColumn, getEndLine, getId, getInstructionPointerReference, getLine, getModuleId, getName, getPresentationHint, hashCode, setCanRestart, setColumn, setEndColumn, setEndLine, setId, setInstructionPointerReference, setLine, setModuleId, setModuleId, setModuleId, setName, setPresentationHint, setSource, toString
-
Field Details
-
EMPTY_STACK_FRAMES
public static final org.eclipse.lsp4j.debug.StackFrame[] EMPTY_STACK_FRAMESRepresents an empty array of stack frames.
-
-
Constructor Details
-
RemoteStackFrame
public RemoteStackFrame(io.quarkus.qute.trace.ResolveEvent event, RemoteStackFrame previousFrame, SourceTemplateRegistry sourceTemplateRegistry, VariablesRegistry variablesRegistry, RemoteThread remoteThread) Creates a newRemoteStackFrame.- Parameters:
event- the resolve event describing the current executionpreviousFrame- the previous stack frame, may benullsourceTemplateRegistry- registry for mapping templates to debug sourcesvariablesRegistry- registry for managing variablesremoteThread- the owning remote thread
-
-
Method Details
-
getTemplateId
- Returns:
- the template ID associated with this frame
-
getTemplateUri
- Returns:
- the template URI associated with this frame, or
nullif unavailable
-
getSource
- Overrides:
getSourcein classorg.eclipse.lsp4j.debug.StackFrame
-
getPrevious
- Returns:
- the previous stack frame, or
nullif none exists
-
getScopes
Returns the list of scopes for this frame.Scopes include:
- Locals — variables specific to the current template
- Globals — shared Qute global variables
- Namespace resolvers — registered resolvers for
namespace:expression
- Returns:
- a collection of
RemoteScope
-
evaluate
Evaluates an arbitrary Qute expression in the current frame context.If the expression looks like a conditional (e.g.
user.age > 18), it is parsed and evaluated as a conditional expression. Otherwise, it is evaluated as a simple Qute value expression.- Parameters:
expression- the Qute expression or condition to evaluate- Returns:
- a
CompletableFutureresolving to the evaluation result
-
evaluateConditionInRenderThread
public CompletableFuture<Object> evaluateConditionInRenderThread(io.quarkus.qute.TemplateNode ifNode, boolean ignoreError) Evaluates a parsed conditional expression within the render thread context.This is used for conditional breakpoints: before suspending execution, the condition must be evaluated safely inside the render thread.
Calling
evaluateConditionInRenderThread()from a suspended state ensures the evaluation is scheduled on the render thread asynchronously (viaRemoteThread.evaluateInRenderThread(java.util.concurrent.Callable)), avoiding deadlocks or premature resumption.- Parameters:
ifNode- the parsedTemplateNoderepresenting the conditionignoreError- whether to ignore evaluation errors and returnfalse- Returns:
- a future resolving to
trueorfalse
-
evaluateCondition
public CompletableFuture<Object> evaluateCondition(io.quarkus.qute.TemplateNode ifNode, boolean ignoreError) Evaluates the given Quteifnode in the current context.This method converts the Qute
TemplateNoderesult into a boolean value. If evaluation fails andignoreErroristrue, it returnsfalseinstead of throwing an exception.This method runs synchronously inside the render thread. It is typically called by
evaluateConditionInRenderThread(TemplateNode, boolean). -
getEngine
public io.quarkus.qute.Engine getEngine()- Returns:
- the current Qute engine
-
getEvent
public io.quarkus.qute.trace.ResolveEvent getEvent()- Returns:
- the current
ResolveEventassociated with this frame
-
createEvalContext
Creates a newEvalContextfor the given base object.
-