debugger-completion 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemspec +19 -0
- data/CHANGELOG.md +18 -0
- data/LICENSE.txt +22 -0
- data/README.md +146 -0
- data/Rakefile +35 -0
- data/deps.rip +2 -0
- data/lib/debugger/completion.rb +70 -0
- metadata +87 -0
data/.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'rubygems' unless Object.const_defined?(:Gem)
|
3
|
+
require File.dirname(__FILE__) + "/lib/debugger/completion"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "debugger-completion"
|
7
|
+
s.version = Debugger::Completion::VERSION
|
8
|
+
s.authors = ["Gabriel Horner"]
|
9
|
+
s.email = "gabriel.horner@gmail.com"
|
10
|
+
s.homepage = "http://github.com/cldwalker/debugger-completion"
|
11
|
+
s.summary = "Mission: autocomplete debugger"
|
12
|
+
s.description = "Provides debugger with command and command arguments completion, compliments of bond."
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
14
|
+
s.add_dependency 'bond', '>= 0.4.2'
|
15
|
+
s.add_dependency 'debugger', '~> 1.1'
|
16
|
+
s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc,md} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
|
17
|
+
s.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
18
|
+
s.license = 'MIT'
|
19
|
+
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## 1.0.0
|
2
|
+
* Renamed gem to debugger-completion
|
3
|
+
* Only to be used on debugger (and thus 1.9)
|
4
|
+
* Dropped support for ruby-debug
|
5
|
+
|
6
|
+
## 0.2.1
|
7
|
+
** Ensure clean completion setup with Bond.restart
|
8
|
+
** Play nicely with Bond completion in ruby consoles
|
9
|
+
|
10
|
+
## 0.2.0
|
11
|
+
** Autocomplete local and instance variable methods
|
12
|
+
** Ensure completions are based on current binding
|
13
|
+
|
14
|
+
## 0.1.1
|
15
|
+
** Rescue unexpected errors from Debugger::Command#get_binding
|
16
|
+
|
17
|
+
## 0.1.0
|
18
|
+
** Initial release!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT LICENSE
|
2
|
+
|
3
|
+
Copyright (c) 2010 Gabriel Horner
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
## Description
|
2
|
+
|
3
|
+
Provides debugger with command and command arguments completion compliments of
|
4
|
+
[bond](http://github.com/cldwalker/bond).
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
Install the gem with:
|
9
|
+
|
10
|
+
gem install debugger-completion
|
11
|
+
|
12
|
+
## Setup
|
13
|
+
|
14
|
+
To have debugger automatically use this gem:
|
15
|
+
|
16
|
+
echo "eval require 'debugger/completion'" >> ~/.rdebugrc
|
17
|
+
|
18
|
+
Or to require in a script or application, place after your `require 'debugger'` line:
|
19
|
+
|
20
|
+
require 'debugger/completion'
|
21
|
+
|
22
|
+
Or if you like to debug with one-liners:
|
23
|
+
|
24
|
+
require 'debugger/completion'; debugger
|
25
|
+
|
26
|
+
Or if using rdebug:
|
27
|
+
|
28
|
+
rdebug -r debugger/completion FILE
|
29
|
+
|
30
|
+
To start manually in environments with bond completion already setup i.e. irb:
|
31
|
+
|
32
|
+
require 'debugger/completion'
|
33
|
+
Debugger::Completion.start
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Let's autocomplete instance and local variables of the current binding as well as debugger
|
38
|
+
commands:
|
39
|
+
|
40
|
+
186 end
|
41
|
+
187
|
42
|
+
188 def render
|
43
|
+
189 body = []
|
44
|
+
190 require 'debugger'; debugger
|
45
|
+
=> 191 unless @rows.length ## 0
|
46
|
+
192 setup_field_lengths
|
47
|
+
193 body += render_header
|
48
|
+
194 body += render_rows
|
49
|
+
195 body += render_footer
|
50
|
+
|
51
|
+
(rdb:1) [TAB]
|
52
|
+
@fields condition finish ps thread
|
53
|
+
@filter_classes continue frame putl tmate
|
54
|
+
@headers delete help quit trace
|
55
|
+
@options disable info reload undisplay
|
56
|
+
@rows display irb restart up
|
57
|
+
backtrace down list save var
|
58
|
+
body edit method set where
|
59
|
+
break enable next show
|
60
|
+
catch eval p source
|
61
|
+
completion_toggle exit pp step
|
62
|
+
|
63
|
+
(rdb:1) ca[TAB]
|
64
|
+
(rdb:1) catch
|
65
|
+
|
66
|
+
(rdb:1) @fie[TAB]
|
67
|
+
(rdb:1) @fields
|
68
|
+
|
69
|
+
(rdb:1) bo[TAB]
|
70
|
+
(rdb:1) body
|
71
|
+
|
72
|
+
Autocomplete methods of local and instance variables:
|
73
|
+
|
74
|
+
(rdb:1) @filter_classes.[TAB]
|
75
|
+
Display all 150 possibilities? (y or n)
|
76
|
+
|
77
|
+
(rdb:1) body.[TAB]
|
78
|
+
Display all 168 possibilities? (y or n)
|
79
|
+
|
80
|
+
|
81
|
+
Autocomplete debugger command arguments:
|
82
|
+
|
83
|
+
# What info does debugger provide?
|
84
|
+
(rdb:1) info [TAB]
|
85
|
+
args display global_variables locals thread
|
86
|
+
breakpoints file instance_variables program threads
|
87
|
+
catch files line stack variables
|
88
|
+
|
89
|
+
(rdb: 1) info d[TAB]
|
90
|
+
(rdb: 1) info display
|
91
|
+
|
92
|
+
# What settings can I change?
|
93
|
+
(rdb:1) set [TAB]
|
94
|
+
annotate autolist forcestep linetrace width
|
95
|
+
args basename fullpath linetrace+
|
96
|
+
autoeval callstyle history listsize
|
97
|
+
autoirb debuggertesting keep-frame-bindings trace
|
98
|
+
|
99
|
+
(rdb:1) set d[TAB]
|
100
|
+
(rdb:1) set debuggertesting
|
101
|
+
|
102
|
+
Since I have autoeval on, why not autocomplete as if I'm in irb?
|
103
|
+
|
104
|
+
# Execute command provided by this gem
|
105
|
+
(rdb:1) completion_toggle # also aliased to ct
|
106
|
+
|
107
|
+
# irb-like completion has been enabled
|
108
|
+
(rdb:1) [TAB]
|
109
|
+
Display all 347 possibilities? (y or n)
|
110
|
+
|
111
|
+
(rdb:1) De[TAB]
|
112
|
+
(rdb:1) Debugger
|
113
|
+
(rdb:1) Debugger.[TAB]
|
114
|
+
Display all 137 possibilities? (y or n)
|
115
|
+
|
116
|
+
(rdb:1) require 'ab[TAB]
|
117
|
+
(rdb:1) require 'abbrev.rb'
|
118
|
+
|
119
|
+
Huh? Argument autocompletion?
|
120
|
+
See [bond](http://github.com/cldwalker/bond) for all that you can autocomplete.
|
121
|
+
|
122
|
+
Can I go back to basic debugger completion?
|
123
|
+
|
124
|
+
# Invoke completion_toggle again
|
125
|
+
(rdb:1) completion_toggle
|
126
|
+
|
127
|
+
(rdb:1) [TAB]
|
128
|
+
@fields condition finish ps thread
|
129
|
+
@filter_classes continue frame putl tmate
|
130
|
+
@headers delete help quit trace
|
131
|
+
@options disable info reload undisplay
|
132
|
+
@rows display irb restart up
|
133
|
+
backtrace down list save var
|
134
|
+
body edit method set where
|
135
|
+
break enable next show
|
136
|
+
catch eval p source
|
137
|
+
completion_toggle exit pp step
|
138
|
+
|
139
|
+
Please, can I just quit quickly without a prompt?
|
140
|
+
|
141
|
+
(rdb:1) q [TAB]
|
142
|
+
(rdb:1) q unconditionally
|
143
|
+
|
144
|
+
## Bugs/Issues
|
145
|
+
|
146
|
+
Please report them [on github](http://github.com/cldwalker/debugger-completion/issues).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
def gemspec
|
5
|
+
@gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Build the gem"
|
9
|
+
task :gem=>:gemspec do
|
10
|
+
sh "gem build .gemspec"
|
11
|
+
FileUtils.mkdir_p 'pkg'
|
12
|
+
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Install the gem locally"
|
16
|
+
task :install => :gem do
|
17
|
+
sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Generate the gemspec"
|
21
|
+
task :generate do
|
22
|
+
puts gemspec.to_ruby
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Validate the gemspec"
|
26
|
+
task :gemspec do
|
27
|
+
gemspec.validate
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Run tests'
|
31
|
+
task :test do |t|
|
32
|
+
sh 'bacon -q -Ilib -I. test/*_test.rb'
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
data/deps.rip
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'debugger'
|
2
|
+
require 'bond'
|
3
|
+
|
4
|
+
module Debugger
|
5
|
+
module Completion
|
6
|
+
extend self
|
7
|
+
VERSION = '1.0.0'
|
8
|
+
COMMANDS = [ "backtrace", "break", "catch", "condition", "continue",
|
9
|
+
"delete", "disable", "display", "down", "edit", "enable", "eval", "exit",
|
10
|
+
"finish", "frame", "help", "info", "irb", "jump", "list", "method", "next",
|
11
|
+
"p", "pp", "ps", "putl", "quit", "reload", "restart", "save", "set",
|
12
|
+
"show", "source", "step", "thread", "tmate", "trace", "undisplay",
|
13
|
+
"up", "var", "where"
|
14
|
+
]
|
15
|
+
|
16
|
+
def start
|
17
|
+
Bond.restart(:eval_binding=>lambda { Debugger::Completion.current_binding },
|
18
|
+
:default_mission=>lambda {|e| Debugger::Completion.default_action }) do
|
19
|
+
complete(:methods=>%w{catch cat}) { objects_of(Class).select {|e| e < StandardError } }
|
20
|
+
complete(:methods=>%w{disable enable}) { %w{breakpoints display} }
|
21
|
+
complete(:methods=>['help', 'h']) { Debugger::Completion.commands }
|
22
|
+
complete(:method=>'info') { %w{args breakpoints catch display file files} +
|
23
|
+
%w{global_variables instance_variables line locals program stack thread} +
|
24
|
+
%w{threads variables}
|
25
|
+
}
|
26
|
+
complete(:methods=>%w{set show}) { %w{annotate args autoeval autolist autoirb} +
|
27
|
+
%w{basename callstyle debuggertesting forcestep fullpath history} +
|
28
|
+
%w{keep-frame-bindings linetrace+ linetrace listsize trace width}
|
29
|
+
}
|
30
|
+
complete(:methods=>%w{quit exit q}) { %w{unconditionally} }
|
31
|
+
complete(:methods=>%w{save source}, :action=>:files)
|
32
|
+
complete(:methods=>%w{thread th}) { %w{list stop resume switch current} }
|
33
|
+
complete(:methods=>%w{trace tr}) { %w{on off var} }
|
34
|
+
complete(:methods=>%w{var v}) { %w{class const global instance local} }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def commands; COMMANDS; end
|
39
|
+
|
40
|
+
def default_action
|
41
|
+
completions = commands + ['completion_toggle']
|
42
|
+
completions += @irb_completion ? Bond::DefaultMission.completions + Object.constants :
|
43
|
+
Bond::Mission.current_eval("local_variables | instance_variables")
|
44
|
+
completions - ['__dbg_verbose_save']
|
45
|
+
end
|
46
|
+
|
47
|
+
def current_binding
|
48
|
+
(cmd = first_object(Debugger::Command)) && cmd.send(:get_binding) rescue nil
|
49
|
+
end
|
50
|
+
|
51
|
+
def first_object(klass)
|
52
|
+
ObjectSpace.each_object(klass) {|e| return e }
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
|
56
|
+
def toggle_irb_completion
|
57
|
+
@irb_completion = !@irb_completion
|
58
|
+
end
|
59
|
+
|
60
|
+
module Command
|
61
|
+
def completion_toggle
|
62
|
+
Completion.toggle_irb_completion
|
63
|
+
end
|
64
|
+
alias_method :ct, :completion_toggle
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Object.send :include, Debugger::Completion::Command
|
70
|
+
Debugger::Completion.start unless Bond.started?
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: debugger-completion
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gabriel Horner
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bond
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.4.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.4.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: debugger
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.1'
|
46
|
+
description: Provides debugger with command and command arguments completion, compliments
|
47
|
+
of bond.
|
48
|
+
email: gabriel.horner@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files:
|
52
|
+
- README.md
|
53
|
+
- LICENSE.txt
|
54
|
+
files:
|
55
|
+
- lib/debugger/completion.rb
|
56
|
+
- LICENSE.txt
|
57
|
+
- CHANGELOG.md
|
58
|
+
- README.md
|
59
|
+
- deps.rip
|
60
|
+
- Rakefile
|
61
|
+
- .gemspec
|
62
|
+
homepage: http://github.com/cldwalker/debugger-completion
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.3.6
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.8.24
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: ! 'Mission: autocomplete debugger'
|
87
|
+
test_files: []
|