You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-4Lines changed: 31 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,7 @@
1
1
# ReplCompletion
2
2
3
-
TODO: Delete this and the text below, and describe your gem
4
-
5
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/repl_completion`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+
ReplCompletion is a type based completor for REPL.
4
+
It uses RBS type information, performs static type analytics, uses dynamic runtime information from binding.
6
5
7
6
## Installation
8
7
@@ -18,7 +17,25 @@ If bundler is not being used to manage dependencies, install the gem by executin
18
17
19
18
## Usage
20
19
21
-
TODO: Write usage instructions here
20
+
Require the library
21
+
```ruby
22
+
require'repl_completion'
23
+
```
24
+
25
+
Load RBS with one of these. It will load core library signatures, `./rbs_collection.yaml` and `./sig/**/*.rbs`.
26
+
```ruby
27
+
ReplCompletion.preload_rbs # Recommended. Preload using thread
28
+
ReplCompletion.load_rbs # Could take a seconds in large projects
29
+
```
30
+
31
+
Now you can get completion candidates.
32
+
```ruby
33
+
array = [1, 2, 3]
34
+
classString; defupupup; end; end
35
+
result =ReplCompletion.analyze('array.map do str = _1.chr; str.up', binding)
0 commit comments