class PryNav::Tracer

def tracer(event, file, _line, _id, binding, _klass)

def tracer(event, file, _line, _id, binding, _klass)
  # Ignore traces inside pry-nav code
  return if file && TRACE_IGNORE_FILES.include?(File.expand_path(file))
  case event
  when 'line'
    # Are we stepping? Or continuing by line ('next') and we're at the right
    # frame? Then decrement our line counter cause this line counts.
    if !@frames_when_stepping || @frames == @frames_when_stepping
      @step_in_lines -= 1
      @step_in_lines = -1 if @step_in_lines < 0
    # Did we go up a frame and not break for a 'next' yet?
    elsif @frames < @frames_when_stepping
      @step_in_lines = 0   # Break right away
    end
    # Break on this line?
    Pry.start(binding, @pry_start_options) if @step_in_lines.zero?
  when 'call', 'class'
    @frames += 1         # Track entering a frame
  when 'return', 'end'
    @frames -= 1         # Track leaving a stack frame
    @frames = 0 if @frames < 0
  end
end