Skip to content

Commit

Permalink
Update how to enable TypeCompletor section
Browse files Browse the repository at this point in the history
Add link to ruby/repl_type_completor
Add how to install, (gem install, Gemfile)
Add environment variable description
  • Loading branch information
tompng committed Dec 21, 2023
1 parent e6cbf0e commit 78c16b0
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,33 @@ IRB's default completion `IRB::RegexpCompletor` uses Regexp. IRB has another exp

### How to Enable IRB::TypeCompletor

To enable IRB::TypeCompletor, run IRB with `--type-completor` option
Install [ruby/repl_type_completor](https://github.com/ruby/repl_type_completor/) with:
```
$ gem install repl_type_completor
```
Or add these lines to your project's Gemfile.
```ruby
gem 'irb'
gem 'repl_type_completor', group: :development
```

Now you can use type based completion by:

Run IRB with `--type-completor` option
```
$ irb --type-completor
```
Or write the code below to IRB's rc-file.

Or write this line to IRB's rc-file
```ruby
IRB.conf[:COMPLETOR] = :type # default is :regexp
```
You also need `gem repl_type_completor` to use this feature.

Or use environment variable `IRB_COMPLETOR`
```ruby
ENV['IRB_COMPLETOR'] = 'type'
IRB.start
```

To check if it's enabled, type `irb_info` into IRB and see the `Completion` section.
```
Expand Down

0 comments on commit 78c16b0

Please sign in to comment.