Fork me on GitHub
#calva
<
2019-11-27
>
pez10:11:57

Do I have any regex experts in here? I have a thing in our Clojure lexing/tokenizing that I want to fix. I almost succeed, but to the price that other things break...

Michael Mossinsohn18:11:50

I'm trying to use Calva with shadow-cljs, read quite a bit, and did a lot of experimentation, but can't get the workflow right. I'm trying to evaluate code in the context of a running :app which has a browser as the target.

Michael Mossinsohn18:11:08

Should the localhost be open before I jack-in? Should I connect to the (cljs) :app repl or the browser repl?

Michael Mossinsohn18:11:49

I get the "no application..." message, and no hot code reload.

Michael Mossinsohn18:11:22

Any help would be greatly appreciated! 🙂

Michael Mossinsohn18:11:06

At the moment my workflow is - Jack-in Selecting :app at the prompt. I wait until the build has been configured and the compilation is done. I select :app (or browser repl, I tried both) at the second prompt. I get a "no application..." prompt whether the localhost is open in the browser or not. What am I missing?

Michael Mossinsohn18:11:21

The cider dependancy is present in the config.edn file. My shadow-cljs.edn file is: {:source-paths ["src"] :dependencies [[datascript "0.18.5"] [org.clojure/core.async "0.4.500"] [rum "0.11.3"] [net.ofnir/antizer "3.23.4-0"]] ; [antizer "0.3.1"] ;; Only used when developing using VS-Code with Calva: ;; [cider/cider-nrepl "0.22.4"] :builds {:app {:target :browser ; May come in handy, for a production release. ; :compiler-options {:infer-externs :auto} :output-dir "public/js" :asset-path "/js" :modules {:main ;; <- becomes public/js/main.js {:entries [my-aaplication.core]}} ;; start a development http server on http://localhost:8020 :devtools {:http-root "public" :http-port 8020}}}}

Michael Mossinsohn18:11:00

My goal is to be able to evaluate datascript queries at the repl, and have the code reloaded properly after each compilation.

pez18:11:58

That should work. Just, you'll need to access the app in the browser before Calva can connect to its REPL.

pez18:11:20

And you should connect to the :app build.

Michael Mossinsohn19:11:38

My CLJS repl says: REPL connected. user =>

Michael Mossinsohn19:11:45

But I can't seem to use vars from my app, even if I explicitly load the namespace and/or evaluate the current file.

Michael Mossinsohn19:11:37

Plus, the browser says, at the console, it reloads the namespaces after re-compilation, but I have to reload each time to see any changes. I think something is wrong with my setup, but I can't figure out what...

pez19:11:19

Unfortunately Calva's REPL prompt lies about being connected sometimes, especially with shadow-cljs.

pez19:11:43

The hot reload issue seems very strange though. If you can make a public project reproducing the problem, I can have a look.

Michael Mossinsohn19:11:47

Cool, Thanks! I'll fiddle with it a bit more, and if I can't get it to work I'll try to reproduce the problem. Thank you!

Michael Mossinsohn19:11:27

Ohh, one last thing (for now). The project used to include a deps.edn file, which was removed. Could it be an after-effect? is there a way to clean house for the configuration?

pez21:11:39

Hard to tell…

pez21:11:29

One more thing, though, @consistent1, this:

;; Only used when developing using VS-Code with Calva:
 ;; [cider/cider-nrepl "0.22.4"]

pez21:11:08

It’s not needed with Calva if you use Jack-in.

Michael Mossinsohn22:11:32

Good to know. Another thing I noticed is that after the browser reloads my core.js file Calve complains: "shadow-cljs: reloading code but no :after-load hooks are configured!" May provide a hint... I'll do some more reading and try to minimize the project to see if I can get better results.

pez22:11:01

I think that is shadow-cljs that complains. Calva has no knowledge about hot reloading.