Class: Byebug::DAP::Command::BreakpointLocations
- Inherits:
-
Byebug::DAP::Command
- Object
- Byebug::DAP::Command
- Byebug::DAP::Command::BreakpointLocations
- Defined in:
- lib/byebug/dap/commands/breakpoint_locations.rb
Constant Summary
Constants inherited from Byebug::DAP::Command
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
Constructor Details
This class inherits a constructor from Byebug::DAP::Command
Instance Method Details
#execute ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# 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 |