Cannot start a remote ClojureScript bREPL (it says "Unable to resolve symbol...")

292 views Asked by At

ClojureScript noob here.

I'm following the following ClojureScript tutorial using Boot: https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-02.md#browser-repl-brepl

I can follow it and connect a command line/boot repl to my site by running boot repl -c andn then (start-repl), but I'd like to connect to the site using a richer text editor based REPL.

I've downloaded the ProtoRepl for the atom text editor. I can connect to the repl just fine by giving it the repl's host + port, but when I try to run (start-repl) it throws the error:

(start-repl)
=> CompilerException java.lang.RuntimeException: Unable to resolve symbol: start-repl in this context, compiling:(C:\Users\Zain\AppData\Local\Temp\boot.user4327288409706217009.clj:1:1)

It seems like I'm missing some ClojureScript/boot specific imports, but I'm not sure what to add or how to add it.

Here's some additional debugging info:

Running (def start-repl) on the working boot repl connection, vs the failing proto-repl connection:

Boot repl:

cljs.user=> (def start-repl)
#'cljs.user/start-repl

Proto-repl:

(def start-repl)
=>
#'user/start-repl
2

There are 2 answers

1
gtoast On BEST ANSWER

The start-repl command is provided by the adzerk boot-cljs-repl library. If you're in the cljs.user namespace, the command is going to be:

(adzerk.boot-cljs-repl/start-repl)

If this is your first time entering the bREPL, Proto-REPL is going throw an error on every keystroke. This is Proto-REPL trying and failing to validate/autocomplete your clojure expressions. The quickest way to get rid of these errors is to just disable autocomplete:

  1. Go to Atom's Preferences
  2. click on "Packages"
  3. search for "proto-repl" under "Installed Packages"
  4. click on "Settings" under the "proto-repl" box
  5. scroll down to the "Enable Autocompletion" setting and unclick the checkbox
  6. restart Atom

Run through the steps to start the Brepl again and you should have a decently working browser repl.

0
Jason Gilman On

It looks like from the tutorial that the start-repl function is in the boot.user namespace. Proto REPL uses the user namespace by default. Try (boot.user/start-repl)