Description

Provides ruby-debug command and subcommand completion with a completion system more powerful than irb’s, compliments of bond.

Install

Install the gem with:

sudo gem install ruby-debug-completion

Setup

Add this after your ‘require ’ruby-debug’‘ line:

require 'ruby-debug/completion'

Or if you like to debug with one-liners:

require 'ruby-debug/completion'; debugger

Or if using rdebug:

rdebug -r ruby-debug/completion FILE

Usage

In a ruby program gone far far astray:

(rdb:1) [TAB]
backtrace  delete     enable     help       next       quit       show       trace
break      disable    eval       info       p          reload     source     undisplay
catch      display    exit       irb        pp         restart    step       up
condition  down       finish     list       ps         save       thread     var
continue   edit       frame      method     putl       set        tmate      where

Note: This default completion also autocompletes instance variables and local variables in the current debugger binding.

What info does ruby-debug provide?

(rdb:1) info [TAB]
args                display             global_variables    locals              thread
breakpoints         file                instance_variables  program             threads
catch               files               line                stack               variables

(rdb: 1) info d[TAB]
(rdb: 1) info display

What settings can I change?

(rdb:1) set [TAB]
annotate             autolist             forcestep            linetrace            width
args                 basename             fullpath             linetrace+           
autoeval             callstyle            history              listsize             
autoirb              debuggertesting      keep-frame-bindings  trace                

(rdb:1) set d[TAB]
(rdb:1) set debuggertesting

Since I have autoeval on, can I autocomplete as if I were in irb?

(rdb:1) com[TAB]
(rdb:1) completion_toggle

(rdb:1) [TAB]
Display all 347 possibilities? (y or n)

(rdb:1) De[TAB]
(rdb:1) Debugger
(rdb:1) Debugger.[TAB]
Display all 137 possibilities? (y or n)

(rdb:1) require 'ab[TAB]
(rdb:1) require 'abbrev.rb'

Huh? Argument autocompletion? See bond for all that you can autocomplete.

Can I go back to basic ruby-debug completion?

# Invoke completion_toggle again
(rdb:1)  ct     # alias for completion_toggle
(rdb:1) [TAB]
backtrace  delete     enable     help       next       quit       show       trace
break      disable    eval       info       p          reload     source     undisplay
catch      display    exit       irb        pp         restart    step       up
condition  down       finish     list       ps         save       thread     var
continue   edit       frame      method     putl       set        tmate      where

Please, can I just quit quickly without a prompt?

(rdb:1) q [TAB]
(rdb:1) q unconditionally

Limitations

This gem doesn’t have ruby-debug as a dependency since ruby-debug is split across two gems (ruby-debug and ruby-debug19), dependent on ruby versions. This gem will work with either one.

Todo

  • Completion of local variable methods

Bugs/Issues

Please report them on github.