summaryrefslogtreecommitdiff
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
parent260235ce871c3e7718af8d612f1a8ed400b56070 (diff)
Show documents when completion
-rw-r--r--lib/irb/completion.rb9
-rw-r--r--lib/irb/input-method.rb1
-rw-r--r--lib/rdoc/ri/paths.rb2
-rw-r--r--lib/rubygems.rb1
4 files changed, 12 insertions, 1 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[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index bb0930495f..412edcce24 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -222,6 +222,7 @@ module IRB
end
Reline.completion_append_character = nil
Reline.completion_proc = IRB::InputCompletor::CompletionProc
+ Reline.dig_perfect_match_proc = IRB::InputCompletor::PerfectMatchedProc
end
def check_termination(&block)
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
index d41e610591..f76721d318 100644
--- a/lib/rdoc/ri/paths.rb
+++ b/lib/rdoc/ri/paths.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rdoc/ri'
+require 'rdoc/rdoc'
##
# The directories where ri data lives. Paths can be enumerated via ::each, or
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 21af9ac8f8..193e8d3539 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -18,6 +18,7 @@ require 'rubygems/compatibility'
require 'rubygems/defaults'
require 'rubygems/deprecate'
require 'rubygems/errors'
+require 'rubygems/path_support'
##
# RubyGems is the Ruby standard for publishing and managing third party