Module: Debugger::Completion
Defined Under Namespace
Modules: Command
Constant Summary collapse
- VERSION =
'0.2.1'
- COMMANDS =
[ "backtrace", "break", "catch", "condition", "continue", "delete", "disable", "display", "down", "edit", "enable", "eval", "exit", "finish", "frame", "help", "info", "irb", "list", "method", "next", "p", "pp", "ps", "putl", "quit", "reload", "restart", "save", "set", "show", "source", "step", "thread", "tmate", "trace", "undisplay", "up", "var", "where" ]
Instance Method Summary collapse
- #commands ⇒ Object
- #current_binding ⇒ Object
- #default_action ⇒ Object
- #first_object(klass) ⇒ Object
- #start ⇒ Object
- #toggle_irb_completion ⇒ Object
Instance Method Details
#commands ⇒ Object
39 |
# File 'lib/ruby-debug/completion.rb', line 39 def commands; COMMANDS; end |
#current_binding ⇒ Object
48 49 50 |
# File 'lib/ruby-debug/completion.rb', line 48 def current_binding (cmd = first_object(Debugger::Command)) && cmd.send(:get_binding) rescue nil end |
#default_action ⇒ Object
41 42 43 44 45 46 |
# File 'lib/ruby-debug/completion.rb', line 41 def default_action completions = commands + ['completion_toggle'] completions += @irb_completion ? Bond::DefaultMission.completions + Object.constants : Bond::Mission.current_eval("local_variables | instance_variables") completions - ['__dbg_verbose_save'] end |
#first_object(klass) ⇒ Object
52 53 54 55 |
# File 'lib/ruby-debug/completion.rb', line 52 def first_object(klass) ObjectSpace.each_object(klass) {|e| return e } nil end |
#start ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby-debug/completion.rb', line 17 def start Bond.restart(:eval_binding=>lambda { Debugger::Completion.current_binding }, :default_mission=>lambda {|e| Debugger::Completion.default_action }) do complete(:methods=>%w{catch cat}) { objects_of(Class).select {|e| e < StandardError } } complete(:methods=>%w{disable enable}) { %w{breakpoints display} } complete(:methods=>['help', 'h']) { Debugger::Completion.commands } complete(:method=>'info') { %w{args breakpoints catch display file files} + %w{global_variables instance_variables line locals program stack thread} + %w{threads variables} } complete(:methods=>%w{set show}) { %w{annotate args autoeval autolist autoirb} + %w{basename callstyle debuggertesting forcestep fullpath history} + %w{keep-frame-bindings linetrace+ linetrace listsize trace width} } complete(:methods=>%w{quit exit q}) { %w{unconditionally} } complete(:methods=>%w{save source}, :action=>:files) complete(:methods=>%w{thread th}) { %w{list stop resume switch current} } complete(:methods=>%w{trace tr}) { %w{on off var} } complete(:methods=>%w{var v}) { %w{class const global instance local} } end end |
#toggle_irb_completion ⇒ Object
57 58 59 |
# File 'lib/ruby-debug/completion.rb', line 57 def toggle_irb_completion @irb_completion = !@irb_completion end |