calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
pez 2020-12-05T00:43:35.085800Z

I have this situation now, since upgrading to MacOS Big Sur. Totally annoying.

Tao Lin 2020-12-05T03:15:35.089500Z

Calva isn't evaluating for me. I'm using WSL2, and my project uses legacy figwheel (lein reagent template). I get "jack in done", but whenever I try to evaluate something, nothing happens. When I hover code, it says "loading". I tried a regular clojure lein project as well, and the same thing happened. Calva used to work on my system a few months ago, but now it doesn't.

2020-12-05T14:21:15.092400Z

Hi! I'm trying to transition from my old, tired Mac to a new shiny desktop that is running windows. I'm trying to follow the instructions to get a luminus project running in VSCode. I created a luminus project with lein new luminus box2box +re-frame +postgres +shadow-cljs and then from VSCode did the C-A-C C-A-J thing and selected Server + Client. In the output.calva-repl window I get the following exception:

2020-12-05T14:22:28.092900Z

✅ 1
2020-12-05T14:27:12.094100Z

Not sure where to go from here - I can't seem to get to the clj.user namespace to call (start) manually.

clj::cljs.user=> (start)
nil
; No available JS runtime.
; See <https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting>
clj::cljs.user=&gt; (ns clj.user)
nil
; No available JS runtime.; See <https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting>
clj::cljs.user=&gt; (in-ns clj.user)
nil
; No available JS runtime.
; See <https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting>
clj::cljs.user=&gt; 

2020-12-05T14:36:22.095Z

For some reason Calva tries to evaluate (start) in cljs repl. Thus it fails.

pez 2020-12-05T14:39:45.097100Z

I’l have a look @zelark. The reason it runs start is that it is configured as afterCLJReplJackInCode in the connect sequence. To get past that blocker for now you can just remove the afterCLJReplJackInCode entry from the workspace settings.

👌 2
pez 2020-12-05T14:42:14.099100Z

You’ll need to figure out how to start the luminus server, though. And once you figure that out you can probably figure out what that settings should be now, in case you still want it started as part of jack in.

2020-12-05T14:44:51.101100Z

Thanks! I don't mind starting it any which way, I was just trying to follow the various tutorials I found. Appreciate the pointer to afterCLJReplJackInCode.

2020-12-05T14:46:45.101900Z

@pez but why it runs start in cljs repl? It says “`afterCLJReplJackInCode`: Here you can give Calva some Clojure code to evaluate in the CLJ REPL, once it has been created.”

2020-12-05T14:49:20.103200Z

@zelark Why do you think it's trying to run (start) in the CLJS repl? The ouptut says it's connected to the CLJ repl... then the stack trace, then finally it says creating the cljs repl -- after the stack trace.

2020-12-05T14:50:00.103900Z

Oh, I think you're looking at the second bit I pasted? That was just me noodling around. The error is in the snippet above.

pez 2020-12-05T14:51:39.104700Z

Oh, now I see that it is @credulous reporting the problem. 😃

2020-12-05T14:53:11.106700Z

If you look at the status bar, you can see that the current repl is cljs. Also, if you start just a server, it works fine, and start is evaluated.

2020-12-05T14:54:17.107200Z

I just reproduced it locally.

pez 2020-12-05T14:54:46.107800Z

@brandon.ringe could it be something with how we have changed the repl connect code some months ago, you think?

2020-12-05T14:56:23.109100Z

@zelark My status bar says cljc/clj

pez 2020-12-05T14:56:45.110Z

@zelark since you have it up and running. Can you test if it works to switch to the clj repl and evaluate (start) even when starting both the client and the server?

2020-12-05T14:56:48.110200Z

Oh, sorry then, but mine is cljs

2020-12-05T14:57:04.110600Z

but my prompt shows I'm in the cljs.user namespace. I can't seem to switch to the clj.user namespace, which was the second bit I pasted.

2020-12-05T14:57:30.111300Z

I'm sure this is all operator error - I'm a total newb to this environment. Vim/Fireplace is where i've done my work in the past

2020-12-05T14:58:17.111600Z

I'm assuming this is what we mean by the status bar?

pez 2020-12-05T14:58:58.112600Z

You can switch to the clj repl using the Calva: Toggle REPL Connection used for cljc files

2020-12-05T14:59:13.113300Z

@pez sure, it works, but I need to do (in-ns ’user) first

pez 2020-12-05T15:00:15.114100Z

Iirc, I added a custom command snippet to that project to start the server. If I did, can you try if that one wokrs?

pez 2020-12-05T15:00:42.114600Z

I’ll need to go afk now. Sorry for abandoning you, friends!

2020-12-05T15:04:48.116Z

@credulous I found a workaround to that. You can just set afterCLJReplJackInCode to "(user/start)" . It works for me.

2020-12-05T15:05:37.116700Z

It lives in &lt;your-project&gt;/.vscode/settings.json

2020-12-05T15:07:32.117100Z

Appreciate the help guys - I had to dash because Parenting

2020-12-05T15:07:56.117400Z

will try this in a couple hours. Thanks!!!

2020-12-05T16:02:53.117700Z

@zelark Thanks for that, sadly didn't work for me:

2020-12-05T16:03:02.117800Z

pez 2020-12-05T16:14:51.119900Z

That error could be because previous failed attempts has leftt something in a bad state. See if it helps closing the project and opening it again.

2020-12-05T16:16:03.120700Z

Yes, actually it ran user/start as the stacktrace says, but then down the road something bad happened

mount.core/start-without (core.cljc:403)
user/start (user.clj:22)

pez 2020-12-05T16:24:01.121500Z

For me it worked using this start code: (in-ns 'user) (start).

pez 2020-12-05T16:24:39.121900Z

Haven’t tried the original one yet, will do that now.

pez 2020-12-05T16:26:52.123500Z

Nope. With that it fails as in @credulous first report. That probably means that something in shadow-cljs has changed since I configured the template, making it start in some other ns. I’ll update the template.

2020-12-05T16:31:25.123900Z

@pez what about this WA, does it work for you?

pez 2020-12-05T16:33:09.124200Z

Since it didn’t work for you, I didn’t try. Will do that in a moment.

2020-12-05T16:36:40.125100Z

It works for me. @https://app.slack.com/team/U0LJ1RNS0 got an error, but I believe it’s something different

pez 2020-12-05T16:38:35.125600Z

Oh, I interpreted this as you ran into troubles later: > but then down the road something bad happened

pez 2020-12-05T16:39:41.126800Z

But you were referring to the logs, I understand now. In any case, I think it is better to change ns first, because that is what has changed.

pez 2020-12-05T16:42:01.127700Z

Tried it with (user/start) now, and that works too for me.

👍 1
2020-12-05T16:54:50.128300Z

Btw, I found another way to fix that, I believe the right one.

2020-12-05T16:56:37.129500Z

As the docs says one can put init-ns in a config file. So I put :init-ns user in project.clj and it fixed the problem.

2020-12-05T16:58:43.130300Z

Is that a top level entry?

2020-12-05T16:59:13.130700Z

No, it’s under :shadow-cljs key

:shadow-cljs
  {:nrepl {:port 7002 :init-ns user}

2020-12-05T17:02:08.131800Z

I'm getting the same error as I got before... this is clearly a problem with my local configuration. I really appreciate you guys digging in! I'm going to try to figure out what's borked on my end.

2020-12-05T17:11:18.132800Z

@credulous make sure that your database is running, probably it’s the cause

2020-12-05T17:12:34.133700Z

I got exactly the same exception when I uncommented :database-url in my dev-config.edn

2020-12-05T17:12:38.133900Z

@zelark <BLUSH>

2020-12-05T17:13:16.134800Z

just found the same thing. It's working now, and I can continue my day knowing I wasted the time of two very helpful people

2020-12-05T17:13:56.135300Z

postgresql wasn't running in the WSL universe

2020-12-05T17:14:23.135600Z

No problem, at least we found a place to fix.

bringe 2020-12-05T17:18:59.136Z

Wow, sorry I'm late to this!

bringe 2020-12-05T17:19:08.136400Z

> I found a workaround to that. You can just set `afterCLJReplJackInCode` to `"(user/start)"` . It works for me. Yes, I've found this issue and solution before

bringe 2020-12-05T17:19:19.136700Z

I should have documented it somewhere - I don't think I did

bringe 2020-12-05T17:19:34.137200Z

Awesome!

bringe 2020-12-05T21:23:48.140300Z

Calva friends, if you want to get a taste of some clojure-lsp integration, here's a vsix for the branch that's a WIP: https://8915-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.135-feat-lsp-client-853d7c2e.vsix There are indeed rough edges, but I think we can sort them out in time. Feel free to comment on anything unusual/broken on this PR: https://github.com/BetterThanTomorrow/calva/pull/572

bringe 2020-12-05T21:26:51.142700Z

With this vsix, go to definition works a bit better (and without a repl connection!), code lens for references exist, and if you click them you can peek the references. You may will see duplicate completions when you have a repl connection. I've yet to get to that, but there's some work to be done there on the lsp side, I think. You may also see some linting of the .calva-repl file, another thing I haven't gotten to, but I think this is a matter of configuration of kondo through lsp.

bringe 2020-12-05T21:27:07.142900Z

Also, there's no way to disable code lens for references yet. We'll need to add a setting, as other language clients have done.

pez 2020-12-05T21:57:28.143300Z

Here we go!!!

🚀 5