aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/completion.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-04-28 07:47:33 +0900
committeraycabta <aycabta@gmail.com>2019-05-25 03:30:01 +0900
commit559dca509d2a98584b09c7d9a6d74749ce793ad7 (patch)
tree35f42973d84fe4b4231b5a9da1ca34f4eda0529b /lib/irb/completion.rb
parent260235ce871c3e7718af8d612f1a8ed400b56070 (diff)
downloadruby-559dca509d2a98584b09c7d9a6d74749ce793ad7.tar.gz
Show documents when completion
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r--lib/irb/completion.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 289180a3b2..573f2ed3e6 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -8,6 +8,7 @@
#
require "readline"
+require "rdoc"
module IRB
module InputCompletor # :nodoc:
@@ -197,6 +198,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[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]