Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type completor section of README #820

Merged
merged 4 commits into from
Dec 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ The `irb` command from your shell will start the interpreter.
- [Debugging with IRB](#debugging-with-irb)
- [More about `debug.gem`](#more-about-debuggem)
- [Advantages Over `debug.gem`'s Console](#advantages-over-debuggems-console)
- [Type Based Completion](#type-based-completion)
- [How to Enable IRB::TypeCompletor](#how-to-enable-irbtypecompletor)
- [Advantage over Default IRB::RegexpCompletor](#advantage-over-default-irbregexpcompletor)
- [Difference between Steep's Completion](#difference-between-steeps-completion)
- [Configuration](#configuration)
- [Environment Variables](#environment-variables)
- [Documentation](#documentation)
Expand Down Expand Up @@ -242,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, :test]
```

Now you can use type based completion by:

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

Or writing this line to IRB's rc-file (e.g. `~/.irbrc`)
```ruby
IRB.conf[:COMPLETOR] = :type # default is :regexp
```
You also need `gem repl_type_completor` to use this feature.

Or setting the 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