ruby-debug-completion 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec CHANGED
@@ -9,10 +9,10 @@ Gem::Specification.new do |s|
9
9
  s.email = "gabriel.horner@gmail.com"
10
10
  s.homepage = "http://github.com/cldwalker/ruby-debug-completion"
11
11
  s.summary = "Mission: autocomplete ruby-debug"
12
- s.description = "Provides ruby-debug command and subcommand completion with a completion system more powerful than irb's, compliments of bond."
12
+ s.description = "Provides ruby-debug command and command arguments completion with a completion system more powerful than irb's, compliments of bond."
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
14
  s.rubyforge_project = 'tagaholic'
15
- s.add_dependency 'bond', '>= 0.2.2'
15
+ s.add_dependency 'bond', '>= 0.3.0'
16
16
  s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
17
17
  s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
18
18
  s.license = 'MIT'
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.2.0
2
+ ** Autocomplete local and instance variable methods
3
+ ** Ensure completions are based on current binding
4
+
1
5
  == 0.1.1
2
6
  ** Rescue unexpected errors from Debugger::Command#get_binding
3
7
 
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  == Description
2
2
 
3
- Provides ruby-debug command and subcommand completion with a completion system
3
+ Provides ruby-debug command and command arguments completion with a completion system
4
4
  more powerful than irb's, compliments of {bond}[http://github.com/cldwalker/bond].
5
5
 
6
6
  == Install
@@ -15,7 +15,7 @@ To have ruby-debug automatically use this gem:
15
15
 
16
16
  echo "eval require 'ruby-debug/completion'" >> ~/.rdebugrc
17
17
 
18
- To require in a script or application, place after your `require 'ruby-debug'` line:
18
+ Or to require in a script or application, place after your `require 'ruby-debug'` line:
19
19
 
20
20
  require 'ruby-debug/completion'
21
21
 
@@ -29,20 +29,53 @@ Or if using rdebug:
29
29
 
30
30
  == Usage
31
31
 
32
- In a ruby program gone far far astray:
32
+ Let's autocomplete instance and local variables of the current binding as well as ruby-debug
33
+ commands:
34
+
35
+ 186 end
36
+ 187
37
+ 188 def render
38
+ 189 body = []
39
+ 190 require 'ruby-debug'; debugger
40
+ => 191 unless @rows.length == 0
41
+ 192 setup_field_lengths
42
+ 193 body += render_header
43
+ 194 body += render_rows
44
+ 195 body += render_footer
33
45
 
34
46
  (rdb:1) [TAB]
35
- backtrace delete enable help next quit show trace
36
- break disable eval info p reload source undisplay
37
- catch display exit irb pp restart step up
38
- condition down finish list ps save thread var
39
- continue edit frame method putl set tmate where
47
+ @fields condition finish ps thread
48
+ @filter_classes continue frame putl tmate
49
+ @headers delete help quit trace
50
+ @options disable info reload undisplay
51
+ @rows display irb restart up
52
+ backtrace down list save var
53
+ body edit method set where
54
+ break enable next show
55
+ catch eval p source
56
+ completion_toggle exit pp step
57
+
58
+ (rdb:1) ca[TAB]
59
+ (rdb:1) catch
60
+
61
+ (rdb:1) @fie[TAB]
62
+ (rdb:1) @fields
63
+
64
+ (rdb:1) bo[TAB]
65
+ (rdb:1) body
66
+
67
+ Autocomplete methods of local and instance variables:
68
+
69
+ (rdb:1) @filter_classes.[TAB]
70
+ Display all 150 possibilities? (y or n)
40
71
 
41
- Note: This default completion also autocompletes instance variables and local variables in the
42
- current debugger binding.
72
+ (rdb:1) body.[TAB]
73
+ Display all 168 possibilities? (y or n)
43
74
 
44
- What info does ruby-debug provide?
45
75
 
76
+ Autocomplete ruby-debug command arguments:
77
+
78
+ # What info does ruby-debug provide?
46
79
  (rdb:1) info [TAB]
47
80
  args display global_variables locals thread
48
81
  breakpoints file instance_variables program threads
@@ -51,8 +84,7 @@ What info does ruby-debug provide?
51
84
  (rdb: 1) info d[TAB]
52
85
  (rdb: 1) info display
53
86
 
54
- What settings can I change?
55
-
87
+ # What settings can I change?
56
88
  (rdb:1) set [TAB]
57
89
  annotate autolist forcestep linetrace width
58
90
  args basename fullpath linetrace+
@@ -62,11 +94,12 @@ What settings can I change?
62
94
  (rdb:1) set d[TAB]
63
95
  (rdb:1) set debuggertesting
64
96
 
65
- Since I have autoeval on, can I autocomplete as if I were in irb?
97
+ Since I have autoeval on, why not autocomplete as if I'm in irb?
66
98
 
67
- (rdb:1) com[TAB]
68
- (rdb:1) completion_toggle
99
+ # Execute command provided by this gem
100
+ (rdb:1) completion_toggle # also aliased to ct
69
101
 
102
+ # irb-like completion has been enabled
70
103
  (rdb:1) [TAB]
71
104
  Display all 347 possibilities? (y or n)
72
105
 
@@ -84,13 +117,19 @@ See {bond}[http://github.com/cldwalker/bond] for all that you can autocomplete.
84
117
  Can I go back to basic ruby-debug completion?
85
118
 
86
119
  # Invoke completion_toggle again
87
- (rdb:1) ct # alias for completion_toggle
120
+ (rdb:1) completion_toggle
121
+
88
122
  (rdb:1) [TAB]
89
- backtrace delete enable help next quit show trace
90
- break disable eval info p reload source undisplay
91
- catch display exit irb pp restart step up
92
- condition down finish list ps save thread var
93
- continue edit frame method putl set tmate where
123
+ @fields condition finish ps thread
124
+ @filter_classes continue frame putl tmate
125
+ @headers delete help quit trace
126
+ @options disable info reload undisplay
127
+ @rows display irb restart up
128
+ backtrace down list save var
129
+ body edit method set where
130
+ break enable next show
131
+ catch eval p source
132
+ completion_toggle exit pp step
94
133
 
95
134
  Please, can I just quit quickly without a prompt?
96
135
 
@@ -102,10 +141,6 @@ Please, can I just quit quickly without a prompt?
102
141
  This gem doesn't have ruby-debug as a dependency since ruby-debug is split across two gems
103
142
  (ruby-debug and ruby-debug19), dependent on ruby versions. This gem will work with either one.
104
143
 
105
- == Todo
106
-
107
- * Completion of local variable methods
108
-
109
144
  == Bugs/Issues
110
145
 
111
146
  Please report them {on github}[http://github.com/cldwalker/ruby-debug-completion/issues].
data/deps.rip CHANGED
@@ -1 +1 @@
1
- bond >=0.2.2
1
+ bond >=0.3.0
@@ -4,7 +4,7 @@ require 'bond'
4
4
  module Debugger
5
5
  module Completion
6
6
  extend self
7
- VERSION = '0.1.1'
7
+ VERSION = '0.2.0'
8
8
  COMMANDS = [ "backtrace", "break", "catch", "condition", "continue",
9
9
  "delete", "disable", "display", "down", "edit", "enable", "eval", "exit",
10
10
  "finish", "frame", "help", "info", "irb", "list", "method", "next",
@@ -15,7 +15,8 @@ module Debugger
15
15
  COMMANDS << ['jump'] if RUBY_VERSION >= '1.9'
16
16
 
17
17
  def start
18
- Bond.start(:default_mission=>lambda {|e| Debugger::Completion.default_action }) do
18
+ Bond.start(:eval_binding=>lambda { Debugger::Completion.current_binding },
19
+ :default_mission=>lambda {|e| Debugger::Completion.default_action }) do
19
20
  complete(:methods=>%w{catch cat}) { objects_of(Class).select {|e| e < StandardError } }
20
21
  complete(:methods=>%w{disable enable}) { %w{breakpoints display} }
21
22
  complete(:methods=>['help', 'h']) { Debugger::Completion.commands }
@@ -39,24 +40,18 @@ module Debugger
39
40
 
40
41
  def default_action
41
42
  completions = commands + ['completion_toggle']
42
- if @irb_completion
43
- eval_string = "methods | private_methods | local_variables | " +
44
- "self.class.constants | instance_variables"
45
- completions += debugger_eval(eval_string) | Object.constants |
46
- Bond::DefaultMission::ReservedWords
47
- else
48
- completions += debugger_eval("local_variables | instance_variables")
49
- end
50
- completions
43
+ completions += @irb_completion ? Bond::DefaultMission.completions + Object.constants :
44
+ Bond::Mission.current_eval("local_variables | instance_variables")
45
+ completions - ['__dbg_verbose_save']
51
46
  end
52
47
 
53
- def debugger_eval(string)
54
- bdg = (cmd = first_object(Debugger::Command)) && cmd.send(:get_binding) rescue nil
55
- eval string, bdg || TOPLEVEL_BINDING
48
+ def current_binding
49
+ (cmd = first_object(Debugger::Command)) && cmd.send(:get_binding) rescue nil
56
50
  end
57
51
 
58
52
  def first_object(klass)
59
53
  ObjectSpace.each_object(klass) {|e| return e }
54
+ nil
60
55
  end
61
56
 
62
57
  def toggle_irb_completion
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-completion
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabriel Horner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-20 00:00:00 -04:00
18
+ date: 2010-09-27 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -29,12 +29,12 @@ dependencies:
29
29
  hash: 19
30
30
  segments:
31
31
  - 0
32
- - 2
33
- - 2
34
- version: 0.2.2
32
+ - 3
33
+ - 0
34
+ version: 0.3.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
- description: Provides ruby-debug command and subcommand completion with a completion system more powerful than irb's, compliments of bond.
37
+ description: Provides ruby-debug command and command arguments completion with a completion system more powerful than irb's, compliments of bond.
38
38
  email: gabriel.horner@gmail.com
39
39
  executables: []
40
40