chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
2020-06-12T12:56:26.153800Z

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

2020-06-12T12:56:47.154300Z

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

2020-06-12T12:56:49.154500Z

Many thanks

mauricio.szabo 2020-06-12T12:57:41.155600Z

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?

2020-06-12T13:12:04.155900Z

Yes

2020-06-12T13:14:27.156700Z

Sorry no i have this message

2020-06-12T13:14:58.157200Z

mauricio.szabo 2020-06-12T13:15:07.157700Z

Do you have a JS environment connected?

mauricio.szabo 2020-06-12T13:15:41.158600Z

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

mauricio.szabo 2020-06-12T13:16:00.159100Z

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

2020-06-12T13:16:39.159900Z

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

2020-06-12T13:17:02.160300Z

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

2020-06-12T13:17:28.160900Z

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

2020-06-12T13:17:34.161100Z

(js/alert "okok")

mauricio.szabo 2020-06-12T13:18:54.162Z

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

2020-06-12T13:20:35.162300Z

mauricio.szabo 2020-06-12T13:27:19.166800Z

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.szabo 2020-06-12T13:34:38.169300Z

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 🙂

2020-06-12T13:36:05.169600Z

Yes of course many thanks

2020-06-12T13:36:15.169900Z

I think it is more something that i miss

2020-06-12T13:40:12.171900Z

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

2020-06-12T13:40:21.172Z

mauricio.szabo 2020-06-12T13:40:55.172400Z

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

mauricio.szabo 2020-06-12T13:41:41.173200Z

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.szabo 2020-06-12T13:42:27.174Z

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

2020-06-12T13:43:11.174100Z

2020-06-12T13:43:56.174900Z

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

2020-06-12T13:45:57.175Z

2020-06-12T13:48:09.175400Z

2020-06-12T13:49:36.175800Z

2020-06-12T13:50:20.176600Z

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

2020-06-12T13:50:21.176700Z

2020-06-12T13:50:28.177200Z

and then

2020-06-12T13:50:35.177400Z

the Timeout error

2020-06-12T13:51:05.177500Z

mauricio.szabo 2020-06-12T14:04:29.178600Z

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

mauricio.szabo 2020-06-12T14:04:51.179Z

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

mauricio.szabo 2020-06-12T14:05:38.179300Z

It loads a REPL connected to node

mauricio.szabo 2020-06-12T14:06:04.179900Z

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

mauricio.szabo 2020-06-12T14:06:47.180400Z

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

mauricio.szabo 2020-06-12T14:09:14.180900Z

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

2020-06-12T14:13:17.181200Z

Yes i have Experimental features enable.

2020-06-12T14:28:12.181500Z

Here is what i ended up :

2020-06-12T14:28:16.181600Z

2020-06-12T14:28:45.182500Z

I launch (shadow/watch :app)

2020-06-12T14:29:02.182900Z

then i launch the server

2020-06-12T14:29:16.183300Z

i open the browser and load. the page

2020-06-12T14:29:41.183900Z

i then launch a. repl for cljs

2020-06-12T14:30:23.184800Z

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

2020-06-12T14:32:28.185700Z

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

2020-06-12T14:32:34.186Z

and IT WORKS !!!!

2020-06-12T14:32:37.186200Z

🙂

2020-06-12T14:33:25.187Z

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

2020-06-12T14:33:32.187300Z

Many thanks for your support !

2020-06-12T14:34:06.187500Z

@mauricio.szabo

mauricio.szabo 2020-06-12T14:39:01.189900Z

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

2020-06-12T14:47:31.190200Z

It is 2.10.6

2020-06-12T14:47:40.190500Z

Many thanks and have a nice weekend !

mauricio.szabo 2020-06-12T18:00:02.190800Z

@ouvasam you just found a bug on Chlorine 😄

👍 1
mauricio.szabo 2020-06-12T18:00:41.191500Z

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

mauricio.szabo 2020-06-12T18:02:27.191700Z

https://github.com/mauricioszabo/atom-chlorine/issues/200