diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-07-09 11:17:17 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-07-09 11:17:17 +0000 |
commit | af064b04b1622897995fe1177aabfb60db90e6f7 (patch) | |
tree | 326cb343c08c55d2d93fa5223c01f940d3591f8b /lib/irb/completion.rb | |
parent | 93602810e93b5da1c7161fb4b5c1a4025434a9ce (diff) |
* irb 0.9
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r-- | lib/irb/completion.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 01dcbd2219..a350013e8e 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -1,6 +1,6 @@ # # irb/completor.rb - -# $Release Version: 0.7.1$ +# $Release Version: 0.9$ # $Revision$ # $Date$ # by Keiju ISHITSUKA([email protected]) @@ -36,6 +36,9 @@ module IRB CompletionProc = proc { |input| bind = IRB.conf[:MAIN_CONTEXT].workspace.binding + +# puts "input: #{input}" + case input when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp @@ -61,11 +64,11 @@ module IRB candidates = Proc.instance_methods(true) | Hash.instance_methods(true) select_message(receiver, message, candidates) - when /^(:[^:]*)$/ + when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) sym = $1 - candidates = Symbol.all_symbols.collect{|s| s.id2name} + candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} candidates.grep(/^#{sym}/) else [] @@ -88,7 +91,7 @@ module IRB end candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} - when /^(:[^.]+)\.([^.]*)$/ + when /^(:[^:.]+)\.([^.]*)$/ # Symbol receiver = $1 message = Regexp.quote($2) @@ -108,6 +111,9 @@ module IRB end select_message(receiver, message, candidates) + when /^(\$[^.]*)$/ + candidates = global_variables.grep Regexp.new(Regexp.quote($1)) + # when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ when /^((\.?[^.]+)+)\.([^.]*)$/ # variable @@ -132,7 +138,8 @@ module IRB # func1.func2 candidates = [] ObjectSpace.each_object(Module){|m| - next if /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name candidates.concat m.instance_methods } candidates.sort! @@ -174,4 +181,8 @@ module IRB end end +if Readline.respond_to?("basic_word_break_characters=") + Readline.basic_word_break_characters= "\t\n\"\\'`><=;|&{(" +end +Readline.completion_append_character = nil Readline.completion_proc = IRB::InputCompletor::CompletionProc |