summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authortomoya ishida <[email protected]>2024-10-06 20:10:09 +0900
committergit <[email protected]>2024-10-06 11:10:12 +0000
commit98620f6c5246d27fed440b8d61cdb31cd915eafa ()
tree5710416c6e8402d7774c630dbfbdbd1449521ec9 /lib/irb/context.rb
parenta6383fbe1628bdaa9ec6a30b3baa60dd7430b461 (diff)
[ruby/irb] Change default completor from regexp to auto, try
TypeCompletor and fallback to RegexpCompletor. (https://.com/ruby/irb/pull/1010) https://.com/ruby/irb/commit/bb6a99d815
-rw-r--r--lib/irb/context.rb14
1 files changed, 10 insertions, 4 deletions
@@ -176,11 +176,17 @@ module IRB
private def build_completor
completor_type = IRB.conf[:COMPLETOR]
case completor_type
when :regexp
return RegexpCompletor.new
when :type
- completor = build_type_completor
return completor if completor
else
warn "Invalid value for IRB.conf[:COMPLETOR]: #{completor_type}"
@@ -189,17 +195,17 @@ module IRB
RegexpCompletor.new
end
- private def build_type_completor
if RUBY_ENGINE == 'truffleruby'
# Avoid SyntaxError. truffleruby does not support endless method definition yet.
- warn 'TypeCompletor is not supported on TruffleRuby yet'
return
end
begin
require 'repl_type_completor'
rescue LoadError => e
- warn "TypeCompletor requires `gem repl_type_completor`: #{e.message}"
return
end