diff options
author | aycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-20 08:51:20 +0000 |
---|---|---|
committer | aycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-20 08:51:20 +0000 |
commit | 7f273ac6d0f05208b5b228da95205e20c0e8286c (patch) | |
tree | bfec81d78d487c6d8015f26fd6a5740cfef63d31 /lib/irb/completion.rb | |
parent | 91faab7f1477c65f71aee8324cdeca7b6f19434a (diff) |
IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r-- | lib/irb/completion.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 390e7254dd..a8f462f2fd 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -8,11 +8,10 @@ # require "readline" +require "rdoc" module IRB module InputCompletor # :nodoc: - - # Set of reserved words used by Ruby, you should not use these for # constants or variables ReservedWords = %w[ @@ -195,6 +194,14 @@ module IRB end } + RDocRIDriver = RDoc::RI::Driver.new + PerfectMatchedProc = proc { |matched| + begin + RDocRIDriver.display_name(matched) + rescue RDoc::RI::Driver::NotFoundError + end + } + # Set of available operators in Ruby Operators = %w[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~] @@ -242,3 +249,4 @@ if Readline.respond_to?("basic_word_break_characters=") end Readline.completion_append_character = nil Readline.completion_proc = IRB::InputCompletor::CompletionProc +Readline.dig_perfect_match_proc = IRB::InputCompletor::PerfectMatchedProc |