dgrnbrg / vim-redl

A better Vim integration story for Clojure
106 stars 8 forks source link

Figwheel and cljs-repl? #29

Open au-phiware opened 7 years ago

au-phiware commented 7 years ago

Is it possible to run figwheel-sidecar.repl-api/cljs-repl from redl? What can be done to make this work? Here's what I've tried:

  1. Running cljs-repl from the :Repl buffer.
user=> (figwheel-sidecar.repl-api/fig-status)
Figwheel System Status
----------------------------------------------------
Watching builds: [app]
Client Connections
     app: 1 connection
----------------------------------------------------
nil
user=> (figwheel-sidecar.repl-api/cljs-repl)
Launching ClojureScript REPL for build: app
...snip...
Prompt will show when Figwheel connects to your application
!!! Can't set!: *cljs-repl-env* from non-binding thread
java.lang.Exception: Failed to launch Figwheel CLJS REPL: nREPL connection found but unable to load piggieback.
This is commonly caused by
 A) not providing piggieback as a dependency and/or
 B) not adding piggieback middleware into your nrepl middleware chain.
...snip...
             repl.clj:166 figwheel-sidecar.repl/eval26177[fn]
         MultiFn.java:233 clojure.lang.MultiFn.invoke
             repl.clj:305 figwheel-sidecar.repl/repl
             repl.clj:303 figwheel-sidecar.repl/repl
          RestFn.java:436 clojure.lang.RestFn.invoke
           system.clj:520 figwheel-sidecar.system/start-figwheel-repl
           system.clj:511 figwheel-sidecar.system/start-figwheel-repl
           system.clj:584 figwheel-sidecar.system/figwheel-cljs-repl*
           system.clj:582 figwheel-sidecar.system/figwheel-cljs-repl*
           system.clj:605 figwheel-sidecar.system/cljs-repl*
...snip...
  1. Running :Piggieback (figwheel-sidecar.repl-api/repl-env) and then the above (same result).

The cpp et. al. commands don't seem to work either:

clojure.lang.ExceptionInfo: No such namespace: rs3000.dashboard.server, could n
ot locate rs3000/dashboard/server.cljs, rs3000/dashboard/server.cljc, or JavaSc
ript source providing "rs3000.dashboard.server" in file <cljs repl> {:tag :cljs
/analysis-error}
        at clojure.core$ex_info.invokeStatic(core.clj:4617)
        at clojure.core$ex_info.invoke(core.clj:4617)
        at cljs.analyzer$error.invokeStatic(analyzer.cljc:697)
        at cljs.analyzer$error.invoke(analyzer.cljc:693)
        at cljs.analyzer$error.invokeStatic(analyzer.cljc:695)
        at cljs.analyzer$error.invoke(analyzer.cljc:693)
        at cljs.analyzer$analyze_deps.invokeStatic(analyzer.cljc:2122)
        at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:2096)
        at cljs.analyzer$ns_side_effects.invokeStatic(analyzer.cljc:3461)
        at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:3456)
        at cljs.analyzer$analyze_STAR_$fn__2944.invoke(analyzer.cljc:3580)
...snip...
        at cemerick.piggieback$evaluate.invokeStatic(piggieback.clj:259)
        at cemerick.piggieback$evaluate.invoke(piggieback.clj:255)
        at clojure.lang.Var.invoke(Var.java:379)
        at cemerick.piggieback$wrap_cljs_repl$fn__35123$fn__35125$fn__35126.inv
oke(piggieback.clj:291)
        at cemerick.piggieback$enqueue$fn__35109.invoke(piggieback.clj:247)
        at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__24682
.invoke(interruptible_eval.clj:190)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor
.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecuto
r.java:617)
        at java.lang.Thread.run(Thread.java:748)

Note that running lein repl :connect and then cljs-repl works just fine.

Any ideas?

dgrnbrg commented 7 years ago

I'm sorry, but I'm not a user of figwheel.

My guess is that the code on this line which sets up the REPL doesn't work on figwheel. I know that Redl itself uses JVM features to enable the interactive pausing while debugging, so that's probably part of what makes it fail.

I'd be happy to accept/shepherd a PR to address this!