Wire evaluate request into DapDebugSession

Add HandleEvaluate() that delegates expression evaluation to the
DapVariableProvider, keeping all masking centralized.

Changes:
- Register 'evaluate' in the command dispatch switch
- HandleEvaluate resolves frame context and delegates to
  DapVariableProvider.EvaluateExpression()
- Set SupportsEvaluateForHovers = true in capabilities so DAP
  clients enable hover tooltips and the Watch pane

No separate feature flag — the debugger is already gated by
EnableDebugger on the job context.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Francesco Renzi
2026-03-12 09:51:45 +00:00
committed by GitHub
parent 1573e36a44
commit f31e1c7c43

View File

@@ -124,6 +124,7 @@ namespace GitHub.Runner.Worker.Dap
"stackTrace" => HandleStackTrace(request),
"scopes" => HandleScopes(request),
"variables" => HandleVariables(request),
"evaluate" => HandleEvaluate(request),
"continue" => HandleContinue(request),
"next" => HandleNext(request),
"setBreakpoints" => HandleSetBreakpoints(request),
@@ -179,7 +180,7 @@ namespace GitHub.Runner.Worker.Dap
// All other capabilities are false for MVP
SupportsFunctionBreakpoints = false,
SupportsConditionalBreakpoints = false,
SupportsEvaluateForHovers = false,
SupportsEvaluateForHovers = true,
SupportsStepBack = false,
SupportsSetVariable = false,
SupportsRestartFrame = false,
@@ -366,6 +367,20 @@ namespace GitHub.Runner.Worker.Dap
});
}
private Response HandleEvaluate(Request request)
{
var args = request.Arguments?.ToObject<EvaluateArguments>();
var expression = args?.Expression ?? string.Empty;
var frameId = args?.FrameId ?? CurrentFrameId;
Trace.Info($"Evaluate request: '{expression}' (frame: {frameId}, context: {args?.Context ?? "unknown"})");
var context = GetExecutionContextForFrame(frameId);
var result = _variableProvider.EvaluateExpression(expression, context);
return CreateResponse(request, true, body: result);
}
private Response HandleContinue(Request request)
{
Trace.Info("Continue command received");