Hi all,
I am trying to use chlorine with Atom but i can't evaluate anything in cljs. I use shadow-cljs and start it like this:
clj -A:shadow-cljs watch app
I connect the repl in atom and then use connect embeded but while trying to evaluate seomthing in a cljs file, i've got:
clojure.lang.ExceptionInfo:"Timeout while waiting for REPL result."
Any idea on what i don't do correctly. (i use atom-beta and atom-nightly
Many thanks
Hi, can you evaluate something with shadow-cljs' clojurescript REPL? Like, if you run clj -A:shadow-cljs cljs-repl app
, do you get a REPL, and can you evaluate things on it?
Yes
Sorry no i have this message
Do you have a JS environment connected?
For example, if you're compiling a browser target, is the browser on the page that loads the shadow-cljs compile javascript file?
Or, if you're developing a node app, do you have node running the end script?
No it is a browser target for cljs and a clj server (aleph)
if i do clj -A:shadow-cljs browser-repl app
then a browser window is launching and i can use the repl
(js/alert "okok")
Now, can you evaluate in Chlorine, or even then, it's not working?
Ok, so, let me check: when you watch the build, it creates a javascript file somewhere.
1. Are you importing it on a html file?
2. Do you have a server connected that serves both the JS and the HTML?
3. Is the browser window opened in that path?
4. If the browser is opened, if you enable devtools do you see something like "Shadow-CLJS Websocket Connected" on the devtools console?
5. Can you evaluate code in the REPL that appears when you run clj -A:shadow-cljs cljs-repl app
?
If all of the above are working, Chlorine should be able to evaluate CLJS files. I don't really know what browser-repl
option does, to be honest... 😞
Can you do this checklist, and tell me if there's any problem with any of then? Maybe we can debug together too, or add some missing documentation to the plug-in 🙂
Yes of course many thanks
I think it is more something that i miss
1. I render an html page in clojure using ring as a server on port 8080. 2. I start the project using:
Yeah, ClojureScript is quite weird in some ways, and also depending on the way you develop on it, some rules change (like Figwheel is different from Figwheel-Main that's different from Lumo/Plank that's also different from shadow-cljs and so on) 😄
Ok, now can you open your browser on localhost:8080
? And open devtools, and see if some message appeared that you're connected to shadow-cljs?
(I'm remembering right now that I had some troubles once with some CORS-related stuff on my dev environment, but let's check if it's indeed the case 😄)
If i modify cljs file they are automatically reloaded in the browser
but when i evaluate block in cljs (range 3) i have
and then
the Timeout error
Let me ask you one more thing... Chlorine have an option called "Enable experimental features". Do you have it enabled?
Also, the command (shadow/node-repl)
does not connect to the browser env...
It loads a REPL connected to node
The right command is ((shadow.cljs.devtools.api/repl :app)
(`:app` being the target you're watching)
Probably in that REPL you connected you can't run (js/alert "Hello")
, for example...
(I really need to improve documentation on these shadow-cljs targets.... :thinking_face: )
Yes i have Experimental features enable.
Here is what i ended up :
I launch (shadow/watch :app)
then i launch the server
i open the browser and load. the page
i then launch a. repl for cljs
(test1) is a function in the app.core of the cljs files and it execute correctly
i did remove the experimental feature and choose cljs in evalute settings options in atom-chlorine
and IT WORKS !!!!
🙂
I had the wrong order of things and to be clear i didn't understand very well
Many thanks for your support !
Ok, glad it worked. But I'm not really sure why 😄
To be honest, Chlorine should work without you needing to connect the CLJS REPL inside Shadow (basically, it runs the same command that you ran: (shadow.cljs.devtools.api/repl :app)
internally, and then uses the result to connect to REPL).
I imagine it's something wrong on experimental features - I was experimenting on using some internal Shadow APIs to make things more configurable. What's the version of shadow that you're using? Maybe I can also debug things here...
It is 2.10.6
Many thanks and have a nice weekend !
@ouvasam you just found a bug on Chlorine 😄
With Experimental Features turned on, it fails to evaluate ClojureScript 😄