1

E.g., the equivalent of pry over IRB in Ruby.

The BREPL provided when you run lein figwheel doesn't even support command history (^P, ^[[A) or minimal emacs-type bindings such as ^A or ^E for beginning-/end-of-line.

These are pretty minor at first blush but but it would be nice to be able to iteratively develop functions in the running namespace without having to maintain a separate buffer of command history and other bits that you would expect to have available to you in any modern CLI prompt.

Is there anything like this for the CLJS/Reagent ecosystem?

bright-star
  • 6,016
  • 6
  • 42
  • 81

2 Answers2

4

There are two possible solutions.

  1. Use the rlwrap package to give your repl readline support, which will give you history and command line editing facilities. Most Linux distros have it and you can install it on OSX with homebrew. Don't know about windows. All you need to do is run

    $ rlwrap lein figwheel
    
  2. If your an emacs user, you can configure figwheel so that it starts an nrepl and then use cider to connect to it. You then have all the emacs history, completion etc. An example can be found in the luminus template and the docs has info on how you connect and run the repl from emacs. This is my preferred approach.

It should also be noted that if your using figwheel, then you can actually just experiment inside your cljs file as figwheel will automatically re-load the file whenever you save it. I find I usually only use the repl when trying to diagnose problems - for example, print out bits of my reagent state atom or run component functions to view the output etc. The rest of the time, I develop in the code file itself and just let figwheel load the file and provide me with error details etc.

bright-star
  • 6,016
  • 6
  • 42
  • 81
Tim X
  • 4,158
  • 1
  • 20
  • 26
0

The nREPL that is provided by boot repl and used as default in tenzing turns out to support these things in the usual expected way.

I moved to tenzing from the default lein new reagent environment (bringing needed deps with me), and expect to use it in the future.

bright-star
  • 6,016
  • 6
  • 42
  • 81