Sha256: b20e2a622b3eb7633ab0de8f5c811650d930d5bab83dcd78dd3e23f6367243ca

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

module Byebug::DAP
  class Command::Variables < Command
    # "Retrieves all child variables for the given variable reference.
    # "An optional filter can be used to limit the fetched children to either named or indexed children

    include ValueHelpers

    register!

    def execute
      started!

      thnum, frnum, named, indexed = resolve_variables_reference(args.variablesReference)

      case args.filter
      when 'named'
        indexed = []
      when 'indexed'
        named = []
      end

      vars = named + indexed

      first = args.start || 0
      last = args.count ? first + args.count : vars.size
      last = vars.size unless last < vars.size

      variables = vars[first...last].map { |var, get| prepare_value_response(thnum, frnum, :variable, name: var) { get.call(var) } }

      respond! body: Protocol::VariablesResponseBody.new(variables: variables)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
byebug-dap-0.1.4 lib/byebug/dap/commands/variables.rb