This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-17
Channels
- # 100-days-of-code (5)
- # announcements (13)
- # beginners (98)
- # boot (19)
- # cider (10)
- # cljdoc (32)
- # clojure (142)
- # clojure-dev (37)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-spec (30)
- # clojure-uk (18)
- # clojurescript (28)
- # cursive (8)
- # datomic (25)
- # duct (18)
- # editors (5)
- # emacs (39)
- # events (4)
- # figwheel (7)
- # figwheel-main (5)
- # fulcro (38)
- # graphql (19)
- # jobs-discuss (1)
- # jobs-rus (7)
- # keechma (1)
- # lumo (47)
- # off-topic (28)
- # om-next (3)
- # parinfer (3)
- # re-frame (18)
- # reagent (37)
- # reitit (8)
- # shadow-cljs (101)
- # specter (7)
- # tools-deps (8)
- # vim (1)
i was just giving a try to lumo -n 5555 -D kitchen-async:0.1.0-SNAPSHOT
using a tubular socket repl client from cursive eap8.
my main use-case would be exploring http apis interactively, which is why i pulled in kitchen-async, hoping to ease the experience, but it breaks badly at the boundaries and im not sure what to do about it.
when an expression evaluates to a Promise
i wont see what it resolves to.
if i tuck a (p/then the-promise-im-interested-in prn)
, then it will be printed on the terminal (but not always :/) where i started lumo, instead of the socket repl client, in the cursive repl window
ah, yeah, the multi-line expressions are also printing a bunch of secondary prompts but after it appears in the cursive console and all on one line, so the output is quite a mess. i was looking at the source hoping to replace the prompt strings, but it seems the repl.js:prompt() function is not exposed in the cljs context.
im envisioning something like an automatic wrapper around promise return values with automatic printing of the resolved value, a timeout and a default .catch
...
@onetom what is p
in p/then
, it's usually (-> a-promise (.then (fn [res] ..do smth..))). Did you try enabling dumb-terminal for the console logs, does it make a difference?
flag:
-d, --dumb-terminal
I guess then it's better to start the client in cursive, instead of socket-repl client. But not unlikely that you can transfer the logs over the socket, don't remember how it was, but I think stdout is transfered and stderr messages not. But let's see if someone else knows a better way.
I'm not a cursive user, but I mean, skipping the -n 5555
and just start lumo with shell command from within the cursive terminal (I suppose there's one there?)
I should use the word IntelliJ* as Cursive is just a plugin. But do note that there's quite small support for lumo in text editors, even in Emacs where all we have is inf-clojure mode.
yeah, you can start it in a terminal, but that doesn't have any integration with the file editor area, so i can't send forms over to it... 😕
i was trying the custom socket repl accept function in lumo 1.9.0-alpha, but it seems to be ignored:
cljs.user=> dusty:lumo onetom$ lumo -n '{"port":5559, "accept":"XXX"}'
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.10.1
...
Lumo socket REPL listening at localhost:5559.
cljs.user=>
then when i connect to it i get the usual repl behaviour:
dusty:lumo onetom$ nc localhost 5559
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.10.1
...
cljs.user=> 123
123
cljs.user=>
i was expecting to see an error, since XXX
is obviously a bogus function reference.
i was trying with lumo -n '{"port":5559, "accept":"ethlib.repl/accept"}'
originally of course, where
src/ethlib/repl.cljs
is :
(ns ethlib.repl)
(defn accept [socket & args]
(.end socket (str "\nHello friend.\nYou gave me the following args: " args "\n\n")))
which i copied from https://github.com/anmonteiro/lumo/blob/master/examples/socketAccept/hello/world.cljsi thought i would debug it by building my custom lumo, but it depends on the 5.90 GB Xcode... <sigh>
@onetom you can run lumo in development without compiling the C++ code
as long as you have Node.js installed
btw I’m sorry the workflow is so rough
but I don’t really use IntelliJ so I can’t really help
wrt to your latest question though, have you included the folder where the ethlib.repl
namespace is in the classpath?
it's in the src/
dir, which i would guess is in the class path, but i tried it with lumo -c src/ -n ...
and it makes no difference
you can run the development version with boot dev
as long as you have Node.js installed
i just tried an earlier lumo (installed with brew install lumo
) and it doesn't complain about the bogus accept function either:
dusty:lumo onetom$ lumo -n '{"port":5559, "accept":"XXX"}'
Lumo 1.8.0
ClojureScript 1.9.946
Node.js v9.2.0
...
Lumo socket REPL listening at localhost:5559.
cljs.user=>
because the function hasn’t been run
it’ll probably fail if you telnet localhost 5559
that said, it looks like 1.9.0-alpha has a bug where it doesn’t run the accept function
mind opening an issue?
the function is only run when you connect to it
im getting these circular dependency messages when i run boot dev
:
...
Copying jar:file:/Users/onetom/.m2/repository/com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar!/com/cognitect/transit.js to /Users/onetom/.boot/cache/tmp/Users/onetom/github.com/anmonteiro/lumo/akl/fluhj4/main.out/com/cognitect/transit.js
Applying optimizations :simple to 82 sources
Optimizing with Google Closure Compiler, elapsed time: 19665.113763 msecs
Optimizing 82 sources, elapsed time: 20218.912582 msecs
Sifting output files...
Sifting output files...
Sifting output files...
Sifting output files...
Sifting output files...
Writing target dir(s)...
yarn run v1.10.1
$ node scripts/bundle.js --dev
Building development bundle...
Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/cljs.js
Circular dependency: src/js/cli.js -> src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cli.js
Circular dependency: src/js/repl.js -> src/js/socketRepl.js -> src/js/repl.js
Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cljs.js
Done in 4.50s.
Elapsed time: 54.387 sec
JS can have circular deps
yeah, i read the docs on the nodejs circular dependency handling the other week... it a weird choice how they just ignore it... 😕
i really wanted to debug this, but i guess i will just try to use the older version first, since that works
I managed to run the development version with node target/bundle.js -c target/
after starting boot dev
.
i think it worth mentioning it in the README, because it's not very obvious
@onetom there’s yarn dev
which you can run to start lumo in dev
or npm run dev
found https://github.com/anmonteiro/lumo/blob/master/CONTRIBUTING.md as i was making a pull request and yarn dev
is mentioned there