Skip to content

Commit c2f90c4

Browse files
tompngst0012
andauthored
Fix type completor section of README (#820)
* Add missing table of content for type-based-completor * Update how to enable TypeCompletor section Add link to ruby/repl_type_completor Add how to install, (gem install, Gemfile) Add environment variable description * Fix how to enable type completor description Co-authored-by: Stan Lo <[email protected]> * Add `group: :test` to sample Gemfile description in README --------- Co-authored-by: Stan Lo <[email protected]>
1 parent 2d5a1af commit c2f90c4

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

README.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ The `irb` command from your shell will start the interpreter.
1515
- [Debugging with IRB](#debugging-with-irb)
1616
- [More about `debug.gem`](#more-about-debuggem)
1717
- [Advantages Over `debug.gem`'s Console](#advantages-over-debuggems-console)
18+
- [Type Based Completion](#type-based-completion)
19+
- [How to Enable IRB::TypeCompletor](#how-to-enable-irbtypecompletor)
20+
- [Advantage over Default IRB::RegexpCompletor](#advantage-over-default-irbregexpcompletor)
21+
- [Difference between Steep's Completion](#difference-between-steeps-completion)
1822
- [Configuration](#configuration)
1923
- [Environment Variables](#environment-variables)
2024
- [Documentation](#documentation)
@@ -242,15 +246,33 @@ IRB's default completion `IRB::RegexpCompletor` uses Regexp. IRB has another exp
242246

243247
### How to Enable IRB::TypeCompletor
244248

245-
To enable IRB::TypeCompletor, run IRB with `--type-completor` option
249+
Install [ruby/repl_type_completor](https://github.com/ruby/repl_type_completor/) with:
250+
```
251+
$ gem install repl_type_completor
252+
```
253+
Or add these lines to your project's Gemfile.
254+
```ruby
255+
gem 'irb'
256+
gem 'repl_type_completor', group: [:development, :test]
257+
```
258+
259+
Now you can use type based completion by:
260+
261+
Running IRB with the `--type-completor` option
246262
```
247263
$ irb --type-completor
248264
```
249-
Or write the code below to IRB's rc-file.
265+
266+
Or writing this line to IRB's rc-file (e.g. `~/.irbrc`)
250267
```ruby
251268
IRB.conf[:COMPLETOR] = :type # default is :regexp
252269
```
253-
You also need `gem repl_type_completor` to use this feature.
270+
271+
Or setting the environment variable `IRB_COMPLETOR`
272+
```ruby
273+
ENV['IRB_COMPLETOR'] = 'type'
274+
IRB.start
275+
```
254276

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

0 commit comments

Comments
 (0)