summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorima1zumi <[email protected]>2023-11-21 09:04:36 +0900
committergit <[email protected]>2023-11-21 00:04:41 +0000
commit7164715666cfbffd5540ee374eee2a5568342d2d ()
tree884e83c437c330c53fc4790e32b112a2175568a5
parenta182b2c5e1dbdbe8960912f8bac076d997a74e65 (diff)
[ruby/irb] Enable Setting Completer Type through `IRB_COMPLETOR`
(https://.com/ruby/irb/pull/771) I propose introducing the capability to set the IRB completion kinds via an environment variable, specifically `IRB_COMPLETOR=type`. This feature aims to enhance the Rails console experience by allowing Rails users to specify their preferred completion more conveniently. Currently, when using the Rails console, there's no straightforward way to globally set the type completion across a Rails application repository. It's possible to configure this setting by placing a `.irbrc` file at the project root. However, using a .irbrc file is not ideal as it allows for broad configurations and can potentially affect the production environment. My suggestion focuses on allowing users to set the completion to 'type' in a minimal. This enhancement would be particularly beneficial for teams writing RBS in their Rails applications. This type completer, integrated with RBS, would enhance completion accuracy, improving the Rails console experience. https://.com/ruby/irb/commit/032f6da25f
-rw-r--r--lib/irb/init.rb2
-rw-r--r--test/irb/test_init.rb28
2 files changed, 29 insertions, 1 deletions
@@ -76,7 +76,7 @@ module IRB # :nodoc:
@CONF[:USE_SINGLELINE] = false unless defined?(ReadlineInputMethod)
@CONF[:USE_COLORIZE] = (nc = ENV['NO_COLOR']).nil? || nc.empty?
@CONF[:USE_AUTOCOMPLETE] = ENV.fetch("IRB_USE_AUTOCOMPLETE", "true") != "false"
- @CONF[:COMPLETOR] = :regexp
@CONF[:INSPECT_MODE] = true
@CONF[:USE_TRACER] = false
@CONF[:USE_LOADER] = false
@@ -120,6 +120,34 @@ module TestIRB
IRB.conf[:USE_AUTOCOMPLETE] = orig_use_autocomplete_conf
end
def test_completor_setup_with_argv
orig_completor_conf = IRB.conf[:COMPLETOR]