diff options
author | Stan Lo <[email protected]> | 2024-01-03 13:47:47 +0000 |
---|---|---|
committer | git <[email protected]> | 2024-01-03 13:47:51 +0000 |
commit | 66e0d92de571c357ebc50f11edffa3b65271e55c (patch) | |
tree | d42945dcd121e67b451d5b42e408e0a5cfbddf3b /lib/irb/completion.rb | |
parent | 73fb9c35efd64f0935bce52b18a38c2a500a972f (diff) |
[ruby/irb] Avoid completing empty input
(https://github.com/ruby/irb/pull/832)
The candidate list for empty input is all methods + all variables +
all constants + all keywords. It's a long list that is not useful.
https://github.com/ruby/irb/commit/812dc2df7b
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r-- | lib/irb/completion.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index af3b69eb27..7b9c1bbbdd 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -406,7 +406,13 @@ module IRB else select_message(receiver, message, candidates.sort) end - + when /^\s*$/ + # empty input + if doc_namespace + nil + else + [] + end else if doc_namespace vars = (bind.local_variables | bind.eval_instance_variables).collect{|m| m.to_s} |