This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-19
Channels
- # admin-announcements (2)
- # aws-lambda (3)
- # beginners (66)
- # boot (61)
- # cider (1)
- # cljs-dev (17)
- # clojure (100)
- # clojure-austin (4)
- # clojure-brasil (1)
- # clojure-canada (8)
- # clojure-quebec (6)
- # clojure-russia (48)
- # clojure-sg (6)
- # clojure-spec (37)
- # clojure-uk (61)
- # clojure-ukraine (2)
- # clojurescript (80)
- # core-async (13)
- # cursive (20)
- # datascript (37)
- # datomic (2)
- # defnpodcast (4)
- # emacs (5)
- # funcool (3)
- # hoplon (11)
- # jobs (7)
- # juxt (26)
- # lein-figwheel (48)
- # leiningen (3)
- # luminus (3)
- # om (34)
- # om-next (5)
- # onyx (5)
- # protorepl (6)
- # re-frame (10)
- # reagent (9)
- # rethinkdb (16)
- # ring-swagger (5)
- # spacemacs (14)
- # specter (54)
- # untangled (36)
- # vim (75)
- # yada (1)
@juhoteperi: I also see :Source
printed to browser console.
Hm, from the chestnut repl, when I run (cljs.repl/source om.dom/h1)
I see it both printed in the browser and outputted to the repl.
I think maybe that this PR with piggieback doesn't capture the output for some reason.
Also worth noting that vimscript: echo fireplace#client().eval('(cljs.repl/source om.dom/h1)', {})
returns {'status': ['done'], 'id': 'fireplace-hostnames-1468910433-46', 'session': ['c09f9597-5a6f-4b9e-8b30-f20d0f32e4f1'], 'ns': 'cljs.user', 'value': 'nil'}
So the eval implementation isn't picking up the result for whatever reason. Might be a difference between a repl-env and figwheel, unsure.
Funny enough, if I open the figwheel repl cli, and then go back to fireplace to run source
I see the output there.
Eval response nil is okay, because source prints the result and returns nothing
There is some problem with Figwheel Repl println redirection, not sure yet what
{'status': ['done'], 'id': 'fireplace-hostname-1468910433-55', 'out': '(gen-react-dom-inline-fns) ', 'session': ['d937ad03-f2d3-46d4-bded-47d0fcef0200'], 'ns': 'user', 'value': 'nil'}
This is from clojure for example. Which is what we'd expect. No idea how figwheel is supposed to work.
Figwheel should always redirect the output to both browser console and nrepl
Cljs repls work differently
I think
Both Weasel and Figwheel print the redirected output to \out\ at the point of repl creation
{'status': ['done'], 'id': 'fireplace-hostname-1468860905-76', 'out': '(defn atom (fn-body))', 'session': ['66da3ad2-a4e6-4638-ac9a-7d78b48d0997'], 'ns': 'cljs.user', 'value': 'nil'}
But their raw nrepl op eval, returns an out
key.
Aha, something to do how Piggienback catches the output
Or cider-nrepl, because I think that's only thing that is catching the output and adding it to the response
https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/out.clj
But why would this work with weasel but not figwheel
Maybe it's piggieback that it works with? Figwheel implements it's own cljs-repl
"thingy"
No, Figwheel uses Piggieback
It replaces Weasel
Piggieback is the nrepl middleware which needs to be used to provide eval-op support for cljs repls
Weasel is WebSocket Repl server & client
Figwheel has it's own Repl server & client
server in this case = http server with web socket
Editor sends eval command -> Cider nrepl wraps it (sets \out\ to specific value) -> Piggieback sends it to active Repl which is built using figwheel or weasel env -> Sends command to the browser over WS -> Browsers evals the stuff -> Sends response over WS back to the server (and sends outputs over WS to the server) -> Cider nrepl adds catched output to the response
:Source
works if I do boot dev
instead of boot cider dev
. I agree this is a CIDER problem.
Hmm what does cider task do?
Do you have cider middleware setup at profile.boot?
I wonder if the order of middlewares could matter...
https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/out.clj#L105
I thought this means that out middleware requires piggieback
Which plugin? Cider?
Yes, CIDER. Although I did disable refactor-nrepl also, so it's possible that's a culprit.
Aha, tools.nrepl also takes care of output: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/session.clj
With cemerick.piggieback/wrap-cljs-repl
before and after the cider.nrepl.middleware.out/wrap-out
middleware, I am unable to run :Source
Not working reliably without cider-nrepl for me
I think it worked once, can't reproduce
Hmm, strange. Maybe it's below cider then, and cider reading *out*
just triggers the underlying problem.
If we figure out a way to get it to work, it might be worth checking the value of *print-fn*
, to see who owns it.
https://github.com/bhauman/lein-figwheel/blob/42f2dbef234e6476bd24386bcd69f60666603df3/support/src/figwheel/client.cljs#L21 might be worth following this code path (as it's the print-fn)
Afaik that works, you can check websocket connection from dev tools and you should see that Figwheel sends the message from browser to repl server
and figwheel server code receives the message and prints it, I have debugged this far, for some reason it prints to wrong buffer
it is supposed to print to special buffer created by Cider which redirects output to other buffers
Or Tools.nrepl if Cider is not used
Piggieback! (cemerick.piggieback/cljs-repl (adzerk.boot-cljs-repl/repl-env))
works seamlessly, which is nice.
https://gist.github.com/SevereOverfl0w/4b173fad16e7d13b2210555604fda8f6 I can talk to figwheel programatically, and it works.
That implies something that vim expects is incorrect. I am completely stuck on what though
Works with fireplace's python library also. No way am I releasing this ugly-ass code though.
Piggieback (adzerk.boot-cljs-repl/repl-env)
works fine also