class Byebug::DAP::Command::Scopes
Public Instance Methods
execute()
click to toggle source
# File lib/byebug/dap/commands/scopes.rb, line 7 def execute started! frame, thnum, frnum = resolve_frame_id(args.frameId) return unless frame scopes = [] locals = frame_local_names(frame).sort unless locals.empty? scopes << Protocol::Scope.new( name: 'Locals', presentationHint: 'locals', variablesReference: @session.save_variables(thnum, frnum, :locals, locals), namedVariables: locals.size, indexedVariables: 0, expensive: false) .validate! end globals = global_names.sort unless globals.empty? scopes << Protocol::Scope.new( name: 'Globals', presentationHint: 'globals', variablesReference: @session.save_variables(thnum, frnum, :globals, globals), namedVariables: globals.size, indexedVariables: 0, expensive: true) .validate! end respond! body: Protocol::ScopesResponseBody.new(scopes: scopes) end
Private Instance Methods
frame_local_names(frame)
click to toggle source
# File lib/byebug/dap/commands/scopes.rb, line 44 def frame_local_names(frame) locals = frame.locals locals = locals.keys unless locals == [] # BUG in Byebug? locals << :self if frame._self.to_s != 'main' locals << :$! if frame.pos == 0 && !frame.context.processor.last_exception.nil? locals end
global_names()
click to toggle source
# File lib/byebug/dap/commands/scopes.rb, line 52 def global_names global_variables - %i[$IGNORECASE $= $KCODE $-K $binding] end