class Byebug::DAP::Command::BreakpointLocations

Public Instance Methods

execute() click to toggle source
# File lib/byebug/dap/commands/breakpoint_locations.rb, line 7
def execute
  return unless path = can_read_file!(args.source.path)
  lines = potential_breakpoint_lines(path) { |e|
    respond! success: false, message: "Failed to resolve breakpoints for #{path}"
    return
  }

  unless args.endLine
    if lines.include?(args.line)
      respond! body: { breakpoints: [{ line: args.line }] }
    else
      respond! body: { breakpoints: [] }
    end
    return
  end

  range = [args.line..args.endLine]
  lines.filter! { |l| range.include?(l) }
  respond! body: { breakpoints: lines.map { |l| { line: l } } }
end