Sha256: f17094f3510519faa2e76761fb6dc7d50e62a236fce660d3d241c97a2939aaf4

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

module Byebug::DAP
  class Command::BreakpointLocations < Command
    # "The ‘breakpointLocations’ request returns all possible locations for source breakpoints in a given range.

    register!

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
byebug-dap-0.1.4 lib/byebug/dap/commands/breakpoint_locations.rb
byebug-dap-0.1.3 lib/byebug/dap/commands/breakpoint_locations.rb