diff options
author | aycabta <aycabta@gmail.com> | 2019-11-28 15:15:41 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-11-28 15:22:38 +0900 |
commit | 7d75e94ea967a47e1ca1083f6d1090eaac7ca58e (patch) | |
tree | 4b979aa5bf96422f36cecb24179b71aa2f46346d /lib/irb | |
parent | 8b4ee5d6ba92a385eedc9235ce0a2d5618deecf0 (diff) | |
download | ruby-7d75e94ea967a47e1ca1083f6d1090eaac7ca58e.tar.gz |
Fix regexp to complete complex literal
IRB completion logic always needed exponential notation for complex literal
such as 3e6i but it's bug. I fixed to support complex literal without
exponential notation such as 3i.
Diffstat (limited to 'lib/irb')
-rw-r--r-- | lib/irb/completion.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 232929efe7..3536e8ec87 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -42,9 +42,7 @@ module IRB retrieve_completion_data(input).compact.map{ |i| i.encode(Encoding.default_external) } } - def self.retrieve_completion_data(input, doc_namespace = false) - bind = IRB.conf[:MAIN_CONTEXT].workspace.binding - + def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding, doc_namespace: false) case input when /^((["'`]).*\2)\.([^.]*)$/ # String @@ -145,7 +143,7 @@ module IRB select_message(receiver, message, candidates, sep) end - when /^(?<num>-?(0[dbo])?[0-9_]+(\.[0-9_]+)?([eE][+-]?[0-9]+i?|r)?)(?<sep>\.|::)(?<mes>[^.]*)$/ + when /^(?<num>-?(0[dbo])?[0-9_]+(\.[0-9_]+)?(([eE][+-]?[0-9]+)?i?|r)?)(?<sep>\.|::)(?<mes>[^.]*)$/ # Numeric receiver = $~[:num] sep = $~[:sep] @@ -277,7 +275,7 @@ module IRB end return end - namespace = retrieve_completion_data(matched, true) + namespace = retrieve_completion_data(matched, doc_namespace: true) return unless matched if namespace.is_a?(Array) out = RDoc::Markup::Document.new |