Fork me on GitHub
#calva
<
2021-02-14
>
pez13:02:00

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! ❤️

pez13:02:02

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.

pez13:02:28

Tips: Even quicker is to issue something like

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

Stefan08:02:42

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

❤️ 1
calva 1
pez08:02:33

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

Stefan12:02:25

@U0ETXRFEW 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?

Stefan12:02:13

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

Stefan14:02:09

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…

pez14:02:26

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…

pez14:02:37

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 B20:02:34

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)

pez20:02:06

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

Cris B20:02:58

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

pez20:02:38

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 B20:02:13

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

pez21:02:07

Nope. 😃

Cris B21:02:40

I'll give it a go

❤️ 1
Cris B21:02:17

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 B21:02:26

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

pez21:02:44

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 B21:02:46

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

pez21:02:11

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.

Bees06:02:34

@UUDGHH2J1, :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 @U0ETXRFEW 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.

endrejoh20:02:19

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.

endrejoh20:02:24

An example:

endrejoh20:02:58

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

seancorfield20:02:55

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

endrejoh21:02:40

Thanks, Sean! I will just have to adjust 🙂

seancorfield21:02:51

For example:

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

pez21:02:14

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

pez23:02:15

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.