module DEBUGGER__::UI_CDP

def add_line_breakpoint req, b_id, path

def add_line_breakpoint req, b_id, path
  cond = req.dig('params', 'condition')
  line = req.dig('params', 'lineNumber')
  src = get_source_code path
  end_line = src.lines.count
  line = end_line  if line > end_line
  if cond != ''
    SESSION.add_line_breakpoint(path, line + 1, cond: cond)
  else
    SESSION.add_line_breakpoint(path, line + 1)
  end
  # Because we need to return scriptId, responses are returned in SESSION thread.
  req['params']['scriptId'] = path
  req['params']['lineNumber'] = line
  req['params']['breakpointId'] = b_id
  @q_msg << req
end