Class DebugServerAdapter

java.lang.Object
io.quarkus.qute.debug.adapter.DebugServerAdapter
All Implemented Interfaces:
org.eclipse.lsp4j.debug.services.IDebugProtocolServer

public class DebugServerAdapter extends Object implements org.eclipse.lsp4j.debug.services.IDebugProtocolServer
Debug Adapter Protocol (DAP) server implementation for Qute debugging.

This adapter connects the DebuggeeAgent (responsible for template execution debugging) with an external DAP client, such as VS Code or IntelliJ. It translates events and requests between Qute's internal debugging system and the standardized DAP interface.

It supports breakpoints, stack traces, variable inspection, evaluation, stepping, pausing, resuming, and other typical debugging features.

  • Field Summary

    Fields inherited from interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer

    SCHEMA_VERSION
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new DebugServerAdapter and registers listeners to forward debugger events to the DAP client.
  • Method Summary

    Modifier and Type
    Method
    Description
    Attaches to a running debug session.
    CompletableFuture<org.eclipse.lsp4j.debug.CompletionsResponse>
    completions(org.eclipse.lsp4j.debug.CompletionsArguments args)
    Provides code completions for the given context.
    void
    connect(org.eclipse.lsp4j.debug.services.IDebugProtocolClient client)
    Associates a DAP client with this adapter and configures the appropriate JavaSourceResolver based on the client type.
    CompletableFuture<org.eclipse.lsp4j.debug.ContinueResponse>
    continue_(org.eclipse.lsp4j.debug.ContinueArguments args)
    Resumes execution of a specific thread or all threads.
    disconnect(org.eclipse.lsp4j.debug.DisconnectArguments args)
    Disconnects the debug client and disables the agent.
    CompletableFuture<org.eclipse.lsp4j.debug.EvaluateResponse>
    evaluate(org.eclipse.lsp4j.debug.EvaluateArguments args)
    Evaluates an expression in the context of a given stack frame.
    void
    Handles a terminate event and notifies the client.
    void
    Handles a thread event and notifies the client.
    CompletableFuture<org.eclipse.lsp4j.debug.Capabilities>
    initialize(org.eclipse.lsp4j.debug.InitializeRequestArguments args)
    Initializes the debug session, returning supported capabilities.
    next(org.eclipse.lsp4j.debug.NextArguments args)
     
    pause(org.eclipse.lsp4j.debug.PauseArguments args)
    CompletableFuture<org.eclipse.lsp4j.debug.ScopesResponse>
    scopes(org.eclipse.lsp4j.debug.ScopesArguments args)
    Returns the variable scopes for a given stack frame.
    CompletableFuture<org.eclipse.lsp4j.debug.SetBreakpointsResponse>
    setBreakpoints(org.eclipse.lsp4j.debug.SetBreakpointsArguments args)
    Sets breakpoints in a given source file.
    CompletableFuture<org.eclipse.lsp4j.debug.SetExceptionBreakpointsResponse>
    setExceptionBreakpoints(org.eclipse.lsp4j.debug.SetExceptionBreakpointsArguments args)
    Required by DAP but not used in this implementation.
    CompletableFuture<org.eclipse.lsp4j.debug.SourceResponse>
    source(org.eclipse.lsp4j.debug.SourceArguments args)
     
    CompletableFuture<org.eclipse.lsp4j.debug.StackTraceResponse>
    stackTrace(org.eclipse.lsp4j.debug.StackTraceArguments args)
    Returns the stack trace for a given thread.
    stepIn(org.eclipse.lsp4j.debug.StepInArguments args)
    stepOut(org.eclipse.lsp4j.debug.StepOutArguments args)
    terminate(org.eclipse.lsp4j.debug.TerminateArguments args)
    Terminates the current debugging session.
    CompletableFuture<org.eclipse.lsp4j.debug.ThreadsResponse>
    Returns the list of threads currently being debugged.
    CompletableFuture<org.eclipse.lsp4j.debug.VariablesResponse>
    variables(org.eclipse.lsp4j.debug.VariablesArguments args)
    Returns the variables for a given variable reference.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer

    breakpointLocations, cancel, configurationDone, dataBreakpointInfo, disassemble, exceptionInfo, goto_, gotoTargets, launch, loadedSources, locations, modules, readMemory, restart, restartFrame, reverseContinue, setDataBreakpoints, setExpression, setFunctionBreakpoints, setInstructionBreakpoints, setVariable, stepBack, stepInTargets, terminateThreads, writeMemory
  • Constructor Details

    • DebugServerAdapter

      public DebugServerAdapter(DebuggeeAgent agent)
      Creates a new DebugServerAdapter and registers listeners to forward debugger events to the DAP client.
      Parameters:
      agent - the Qute debugging agent
  • Method Details

    • initialize

      public CompletableFuture<org.eclipse.lsp4j.debug.Capabilities> initialize(org.eclipse.lsp4j.debug.InitializeRequestArguments args)
      Initializes the debug session, returning supported capabilities.
      Specified by:
      initialize in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the initialization request arguments
      Returns:
      a future providing the supported capabilities
    • connect

      public void connect(org.eclipse.lsp4j.debug.services.IDebugProtocolClient client)
      Associates a DAP client with this adapter and configures the appropriate JavaSourceResolver based on the client type.
      Parameters:
      client - the connected DAP client
    • attach

      public CompletableFuture<Void> attach(Map<String,Object> args)
      Attaches to a running debug session.
      Specified by:
      attach in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - attachment arguments
      Returns:
      a future that completes when the client is notified
    • setBreakpoints

      public CompletableFuture<org.eclipse.lsp4j.debug.SetBreakpointsResponse> setBreakpoints(org.eclipse.lsp4j.debug.SetBreakpointsArguments args)
      Sets breakpoints in a given source file.
      Specified by:
      setBreakpoints in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the breakpoints configuration
      Returns:
      a future providing the resolved breakpoints
    • setExceptionBreakpoints

      public CompletableFuture<org.eclipse.lsp4j.debug.SetExceptionBreakpointsResponse> setExceptionBreakpoints(org.eclipse.lsp4j.debug.SetExceptionBreakpointsArguments args)
      Required by DAP but not used in this implementation.
      Specified by:
      setExceptionBreakpoints in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the exception breakpoints arguments
      Returns:
      an empty response
    • threads

      public CompletableFuture<org.eclipse.lsp4j.debug.ThreadsResponse> threads()
      Returns the list of threads currently being debugged.
      Specified by:
      threads in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Returns:
      a future containing the threads
    • stackTrace

      public CompletableFuture<org.eclipse.lsp4j.debug.StackTraceResponse> stackTrace(org.eclipse.lsp4j.debug.StackTraceArguments args)
      Returns the stack trace for a given thread.
      Specified by:
      stackTrace in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the stack trace request arguments
      Returns:
      a future containing the stack trace
    • scopes

      public CompletableFuture<org.eclipse.lsp4j.debug.ScopesResponse> scopes(org.eclipse.lsp4j.debug.ScopesArguments args)
      Returns the variable scopes for a given stack frame.
      Specified by:
      scopes in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the scopes request arguments
      Returns:
      a future containing the scopes
    • variables

      public CompletableFuture<org.eclipse.lsp4j.debug.VariablesResponse> variables(org.eclipse.lsp4j.debug.VariablesArguments args)
      Returns the variables for a given variable reference.
      Specified by:
      variables in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the variables request arguments
      Returns:
      a future containing the variables
    • terminate

      public CompletableFuture<Void> terminate(org.eclipse.lsp4j.debug.TerminateArguments args)
      Terminates the current debugging session.
      Specified by:
      terminate in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the terminate arguments
      Returns:
      a future that completes when the session is terminated
    • disconnect

      public CompletableFuture<Void> disconnect(org.eclipse.lsp4j.debug.DisconnectArguments args)
      Disconnects the debug client and disables the agent.
      Specified by:
      disconnect in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the disconnect arguments
      Returns:
      a future that completes when the disconnection is done
    • stepIn

      public CompletableFuture<Void> stepIn(org.eclipse.lsp4j.debug.StepInArguments args)
      Specified by:
      stepIn in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • stepOut

      public CompletableFuture<Void> stepOut(org.eclipse.lsp4j.debug.StepOutArguments args)
      Specified by:
      stepOut in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • pause

      public CompletableFuture<Void> pause(org.eclipse.lsp4j.debug.PauseArguments args)
      Specified by:
      pause in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • next

      public CompletableFuture<Void> next(org.eclipse.lsp4j.debug.NextArguments args)
      Specified by:
      next in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • continue_

      public CompletableFuture<org.eclipse.lsp4j.debug.ContinueResponse> continue_(org.eclipse.lsp4j.debug.ContinueArguments args)
      Resumes execution of a specific thread or all threads.
      Specified by:
      continue_ in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the continue request arguments
      Returns:
      a future containing the response
    • evaluate

      public CompletableFuture<org.eclipse.lsp4j.debug.EvaluateResponse> evaluate(org.eclipse.lsp4j.debug.EvaluateArguments args)
      Evaluates an expression in the context of a given stack frame.
      Specified by:
      evaluate in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the evaluation arguments
      Returns:
      a future containing the evaluation result
    • completions

      public CompletableFuture<org.eclipse.lsp4j.debug.CompletionsResponse> completions(org.eclipse.lsp4j.debug.CompletionsArguments args)
      Provides code completions for the given context.
      Specified by:
      completions in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
      Parameters:
      args - the completions request arguments
      Returns:
      a future containing the completion results
    • source

      public CompletableFuture<org.eclipse.lsp4j.debug.SourceResponse> source(org.eclipse.lsp4j.debug.SourceArguments args)
      Specified by:
      source in interface org.eclipse.lsp4j.debug.services.IDebugProtocolServer
    • handleThreadChanged

      public void handleThreadChanged(ThreadEvent event)
      Handles a thread event and notifies the client.
      Parameters:
      event - the thread event
    • handleTerminate

      public void handleTerminate()
      Handles a terminate event and notifies the client.
    • onJavaSourceResolved

      public CompletableFuture<Void> onJavaSourceResolved(JavaSourceLocationEventResponse response)