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 2021-02-14T13:34:00.361600Z

Dear Calva friends: I’m fixing the sorry state of affairs when using Calva without a project of any kind. It should be mostly stabilizing things, but this part of the Calva code base is still brittle (one of these days we must take care of the mess properly) and I risk breaking something that currently works… There are so many permutations that my own testing is far from enough. Can I get some help testing this VSIX? https://11367-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.173-814-connect-without-project-005c54b5.vsix • Test both jack-in and connect with the projects you care about • Test both jack-in and connect with some test projects you might have • Test Connect to a running REPL server, not in your project with an “empty” VS Code window (Calva should create the REPL window file in some temp area on your machine, and if you try more times, it should reuse the same file path) • Test Connect to a running REPL server, not in your project with some projects you have (here Calva should use the regular .calva/output-window in the project. • Also, test this with remote projects if you have such (WSL2 setups, maybe?) • Also, LiveShare. @stefan.van.den.oord, pretty please? Looking forward to your testing results! ❤️

Stefan 2021-02-15T08:11:42.381100Z

Will do @pez, that’s the least we can do for all the hard work you’re putting in! I’ll let you know later today.

1
❤️ 1
pez 2021-02-15T08:24:33.381800Z

Awesome. Would be extra nice to know how/if Start a “Hello World” REPL works over LiveShare.

Stefan 2021-02-15T12:45:25.382300Z

@pez Our normal workflow works like normal 🙂 Can you clarify what you mean with “Start a “Hello World” REPL”? I haven’t been following along recently, so I’m not sure what that’s about?

Stefan 2021-02-15T12:46:13.382500Z

(“Normal workflow” meaning: one starting (tools.deps) REPL and live-sharing, the other connecting, including automatic sharing of repl port)

Stefan 2021-02-15T14:40:09.382700Z

Hmm just now I had a situation where I couldn’t run tests anymore (being the guest of a live share session). Glitch in the matrix of bug…? It said “Evaluating file: <filename>” and then nothing…

pez 2021-02-15T14:49:26.382900Z

Could be a glitch in the matrix, could be a new bug. The PR changes a bit around how the project directory is intitialized and how paths are resolved. The test runner could be a victim…

pez 2021-02-15T14:52:37.383100Z

As for Hello World REPL. There is a new command that starts a non-project REPL. So in addition to the tests mentioned in this thread, also see https://github.com/BetterThanTomorrow/calva/issues/1003#issuecomment-778859438

Cris B 2021-02-15T20:41:34.391200Z

My current daily setup is Windows + WSL, and the "Hello World" command works fine there (ie. in a remote VS Code window). But run natively (where I have java but no clojure tools installed) I get this error:

Error building classpath. java.lang.Character cannot be cast to java.util.Map$Entry
java.lang.ClassCastException: java.lang.Character cannot be cast to java.util.Map$Entry
        at clojure.core$key.invokeStatic(core.clj:1567)
        at clojure.core$merge_with$merge_entry__5962.invoke(core.clj:3060)
        at clojure.core$reduce1.invokeStatic(core.clj:944)
        at clojure.core$merge_with$merge2__5964.invoke(core.clj:3066)
        at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58)
        at clojure.core$reduce1.invokeStatic(core.clj:942)

pez 2021-02-15T20:49:06.392700Z

Thanks! What does the jack-in command look like?

Cris B 2021-02-15T20:50:58.393500Z

java -jar c:\Users\Crispin Bennett\.vscode\extensions\betterthantomorrow.calva-2.0.173-814-connect-without-project-48a9ce57\deps.clj.jar -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.8""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"

pez 2021-02-15T20:55:38.394300Z

Does regular jack-in to a deps.edn project work for you, natively? And how about the same thing in the released Calva version?

Cris B 2021-02-15T20:57:13.394700Z

Presumably I'd need to install clojure in Windows to try that?

pez 2021-02-15T21:00:07.395100Z

Nope. 😃

Cris B 2021-02-15T21:00:40.395300Z

I'll give it a go

❤️ 1
Cris B 2021-02-15T21:09:17.396200Z

Both Calva versions (this test one & most recent release) fail because of the space in the path (my user name) to the jar file. ie.

java -jar c:\Users\Crispin Bennett\.vscode\extensions\betterthantomorrow.calva-2.0.170\deps.clj.jar -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.8""}}}" -A:test -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error: Unable to access jar
file c:\Users\Crispin

Cris B 2021-02-15T21:10:26.396400Z

Having been more of a linux/mac user in recent years I never even thought to use the non-remote version before

pez 2021-02-15T21:12:44.396800Z

OK. So not a regression at least. Can you file an issue about this with spaces in the user name? Also, does clojure-lsp work?

Cris B 2021-02-15T21:18:46.397Z

Will do a bit later (have to dash now). And, yes, clojure-lsp is working. I'm half thinking now I perhaps should stoop to installing clojure natively. I assume there are fewer Windows users in the Clojure community so it might be of some service in finding & reporting issues. OTOH with WSL2, will anyone ever use native Windows dev tools again (I wonder)?

pez 2021-02-15T21:37:11.397500Z

Calva will not use clojure on Windows anyway. It bundles deps.clj and tries to dodge that install mess by using that on Windows. Once we fix this user name thing it should start working for you and others using full user names like that.

Bees 2021-02-16T06:58:34.415300Z

@cb.lists, :man-raising-hand: I have used WSL2, but right now I'm using a https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows install. Your comment helped me recognize that my installed version is a revision behind, but based on what @pez wrote, this doesn't really matter. I'm getting a similar failure as you without having a space in my user name, so I suspect there is more to this error.

pez 2021-02-14T13:39:02.361700Z

Tips: To start a REPL server with the dependencies Calva needs you can open a project of yours and use the Copy Jack-in Command to Clipboard command and then use the copied command from a terminal outside VS Code.

pez 2021-02-14T13:41:28.361900Z

Tips: Even quicker is to issue something like

bb --nrepl-server 1337
(Assuming you have babashska installed, which I’m sure you do.)

ej 2021-02-14T20:57:19.363700Z

When I format code with tab, I've noticed that nested vectors in Hiccup are only indented with one space. Is this considered proper style in Clojure? I am just getting started, and this looks a little ... cramped to me.

ej 2021-02-14T20:57:24.363900Z

An example:

ej 2021-02-14T20:58:58.365400Z

From the fn to the div there are two spaces of indentation, whereas within div and to the paragraph, there's only one space.

seancorfield 2021-02-14T20:59:55.366Z

"Semantic indentation" -- depends on the context. So this is "correct" for that.

ej 2021-02-14T21:00:40.366700Z

Thanks, Sean! I will just have to adjust 🙂

seancorfield 2021-02-14T21:01:51.367400Z

For example:

(let [a 42
      b 13]
  (+ a
     b))

pez 2021-02-14T21:31:14.371400Z

Calva mostly uses cljfmt defaults, which makes it follow the https://github.com/bbatsov/clojure-style-guide pretty well. See https://calva.io/formatting for how to configure it. If you keep the formatting config in the project, the config hot reloads as you save it, so you can quickly get a feel for how the indentation rules work. (The defaults are nice, though. You’ll quickly learn to love that hiccup indentation. 😄 )

pez 2021-02-14T23:32:15.374900Z

Updates on my PR for Standalond REPL start and Standalone Connect. I’ve added standalone REPL start now. Two commands, actually. One is a Hello World option that I hope should make the start with a Calva powered REPL extra quick. Please help me test it, friends. • VSIX: https://11398-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.173-814-connect-without-project-48a9ce57.vsix • Docs added to this issue comment: https://github.com/BetterThanTomorrow/calva/issues/1003#issuecomment-778859438 See also my post a few comments above.