Class: Byebug::DAP::Command::Threads

Inherits:
Byebug::DAP::Command show all
Defined in:
lib/byebug/dap/commands/threads.rb

Constant Summary

Constants inherited from Byebug::DAP::Command

EVAL_ERROR

Instance Method Summary collapse

Methods inherited from Byebug::DAP::Command

command, execute, #execute_on_thread, #initialize, #log, register!, resolve!, #safe_execute, #started!, #stopped!

Methods included from SafeHelpers

#safe

Constructor Details

This class inherits a constructor from Byebug::DAP::Command

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/byebug/dap/commands/threads.rb', line 7

def execute
  started!

  respond! body: Protocol::ThreadsResponseBody.new(
    threads: Byebug
      .contexts
      .filter { |ctx| !ctx.thread.is_a?(::Byebug::DebugThread) }
      .map { |ctx| Protocol::Thread.new(
        id: ctx.thnum,
        name: ctx.thread.name || "Thread ##{ctx.thnum}"
      ).validate! })
end