Fork me on GitHub
#chlorine
<
2020-06-12
>
ouvasam12:06:26

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."

ouvasam12:06:47

Any idea on what i don't do correctly. (i use atom-beta and atom-nightly

ouvasam12:06:49

Many thanks

mauricio.szabo12:06:41

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?

ouvasam13:06:27

Sorry no i have this message

mauricio.szabo13:06:07

Do you have a JS environment connected?

mauricio.szabo13:06:41

For example, if you're compiling a browser target, is the browser on the page that loads the shadow-cljs compile javascript file?

mauricio.szabo13:06:00

Or, if you're developing a node app, do you have node running the end script?

ouvasam13:06:39

No it is a browser target for cljs and a clj server (aleph)

ouvasam13:06:02

if i do clj -A:shadow-cljs browser-repl app

ouvasam13:06:28

then a browser window is launching and i can use the repl

ouvasam13:06:34

(js/alert "okok")

mauricio.szabo13:06:54

Now, can you evaluate in Chlorine, or even then, it's not working?

mauricio.szabo13:06:19

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... 😞

mauricio.szabo13:06:38

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 🙂

ouvasam13:06:05

Yes of course many thanks

ouvasam13:06:15

I think it is more something that i miss

ouvasam13:06:15

I think it is more something that i miss

ouvasam13:06:12

1. I render an html page in clojure using ring as a server on port 8080. 2. I start the project using:

mauricio.szabo13:06:41

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?

mauricio.szabo13:06:27

(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 😄)

ouvasam13:06:56

If i modify cljs file they are automatically reloaded in the browser

ouvasam13:06:20

but when i evaluate block in cljs (range 3) i have

ouvasam13:06:35

the Timeout error

mauricio.szabo14:06:29

Let me ask you one more thing... Chlorine have an option called "Enable experimental features". Do you have it enabled?

mauricio.szabo14:06:51

Also, the command (shadow/node-repl) does not connect to the browser env...

mauricio.szabo14:06:38

It loads a REPL connected to node

mauricio.szabo14:06:04

The right command is ((shadow.cljs.devtools.api/repl :app) (`:app` being the target you're watching)

mauricio.szabo14:06:47

Probably in that REPL you connected you can't run (js/alert "Hello"), for example...

mauricio.szabo14:06:14

(I really need to improve documentation on these shadow-cljs targets.... 🤔 )

ouvasam14:06:17

Yes i have Experimental features enable.

ouvasam14:06:12

Here is what i ended up :

ouvasam14:06:45

I launch (shadow/watch :app)

ouvasam14:06:02

then i launch the server

ouvasam14:06:16

i open the browser and load. the page

ouvasam14:06:41

i then launch a. repl for cljs

ouvasam14:06:23

(test1) is a function in the app.core of the cljs files and it execute correctly

ouvasam14:06:28

i did remove the experimental feature and choose cljs in evalute settings options in atom-chlorine

ouvasam14:06:34

and IT WORKS !!!!

ouvasam14:06:25

I had the wrong order of things and to be clear i didn't understand very well

ouvasam14:06:32

Many thanks for your support !

ouvasam14:06:06

@mauricio.szabo

mauricio.szabo14:06:01

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...

ouvasam14:06:31

It is 2.10.6

ouvasam14:06:40

Many thanks and have a nice weekend !

mauricio.szabo18:06:02

@ouvasam you just found a bug on Chlorine 😄

mauricio.szabo18:06:41

With Experimental Features turned on, it fails to evaluate ClojureScript 😄