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`.
bringe 2021-04-30T04:14:07.297300Z

https://github.com/BetterThanTomorrow/calva/issues/1049 You may find some info here helpful

az 2021-04-30T05:33:37.297600Z

Thank you @brandon.ringe Iโ€™m going to be following this.

๐Ÿ‘ 1
2021-04-30T13:44:21.300Z

Trying to open the get started repl on windows and seeing this error.

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1
I click nREPL in the bottom bar. Click Fire up the "Getting started" REPL Click use Existing Temp Directory The REPL Output window shows:
; Jacking in...
; Starting Jack-in Terminal: java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
THen the terminal shows the error:
java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1

2021-04-30T13:44:54.300200Z

Calva is v2.0.194

alexmiller 2021-04-30T13:47:30.301Z

that "Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3}, ..." looks like the "" is not escaping and just getting removed so it's trying to parse 0.8.3 as a number in the data

2021-04-30T13:48:09.301500Z

Something I have wrong possibly in a config file or something?

alexmiller 2021-04-30T13:48:27.302100Z

well it's something to do with quoting/escaping of the command line for sure

2021-04-30T13:48:27.302200Z

I didn't think the getting started repl used things in my project, i thought it was standalone

2021-04-30T13:49:45.303900Z

Tried in a different proejct, and same error. Yet that same project I can connect to a normal repl fine. hmmm

stianalmaas 2021-04-30T13:50:15.305100Z

I have the exact same problem. I was inspired to try calva after a presentation Pez had a couple of days ago. It looks like it is an issue with powershell. It is only affecting a few people.

stianalmaas 2021-04-30T13:50:39.305600Z

I found this issue : https://github.com/BetterThanTomorrow/calva/issues/387

stianalmaas 2021-04-30T13:51:16.306100Z

Haven't had time to look into it yet.

alexmiller 2021-04-30T13:51:22.306300Z

it would probably be useful to know which version of the clojure cli is installed

alexmiller 2021-04-30T13:52:14.307200Z

clojure --version will work on newer versions (`clojure -Sdescribe` on older if that doesn't work)

2021-04-30T13:52:40.307400Z

Clojure CLI version 1.10.2.796

2021-04-30T13:56:53.308500Z

If I go to nREPL in toolbar, then click "Start your project with a REPL Server and connect (aka jack-in)" Then choose Leinegen (since this project is a project.clj project) It works fine and I get a repl The terminal for this says

cmd.exe /d /c lein update-in :dependencies conj [nrepl,"0.8.3"] -- update-in :plugins conj [cider/cider-nrepl,"0.25.11"] -- update-in [:repl-options,:nrepl-middleware] conj '["cider.nrepl/cider-middleware"]' -- repl :headless
nREPL server started on port 19008 on host 127.0.0.1 - <nrepl://127.0.0.1:19008>

2021-04-30T13:57:08.308700Z

Seems just to be the getting started repl

pez 2021-04-30T14:19:27.311400Z

We will probably never see the end of quoting issues with powershell. ๐Ÿ˜ž @borkdude and I was at it for weeks straight and it seemed we had it nailed. BTW, the getting started REPL is special. It uses a bundled jar of deps.clj and not the โ€œofficialโ€ CLI tools.

pez 2021-04-30T14:20:20.312300Z

@qmstuart can you report an issue on Calva from within VS Code? Then it will attach some system info.

2021-04-30T14:22:12.313200Z

How, do I do this? Do you mean this window?

stianalmaas 2021-04-30T14:22:24.313700Z

@pez I have the same issue. How do I report this in VS Code?

borkdude 2021-04-30T14:24:41.314100Z

@pez This doesn't seem an issue with deps.clj itself but with how your tool is calling the jar? > java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}" -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"

borkdude 2021-04-30T14:26:29.314600Z

where is the code that calls this jar?

borkdude 2021-04-30T14:30:48.315Z

When shelling out to something on Windows there's usually some escaping that needs to be done for quotes. Are you shelling out from JS/node?

pez 2021-04-30T14:41:35.318Z

@borkdude I didnโ€™t mean to imply that it was a problem in deps.clj. Yes, shelling out from node. Yes, I know there is quoting going on. Tell me about it. ๐Ÿ˜€ I might have spent a couple of msn months on it in total.

borkdude 2021-04-30T14:44:02.318700Z

@pez The "standard" fix I usually apply is this one: https://github.com/babashka/process/blob/eba04e6c35814296e5bb383804f801aee912cba1/src/babashka/process.clj#L152

borkdude 2021-04-30T14:44:38.319600Z

This is usually needed when args are JSON or EDN (because of embedded strings)

pez 2021-04-30T14:45:00.320100Z

I might try it. Don't want to break it everywhere it works though.

borkdude 2021-04-30T14:45:47.320400Z

Only apply this on Windows

pez 2021-04-30T14:49:09.321300Z

Haha, yes, of course. But it works on every windows machine I can bring up.

pez 2021-04-30T14:49:32.321800Z

I even bought a machine, remember? ๐Ÿ˜€

flowthing 2021-04-30T15:00:51.323Z

I bumped into that quoting issue setting up Calva for a colleague. I don't have a Windows machine handy so I can't test, but one workaround is to modify the "Jack In Dependency Versions" Calva setting such that every value in the PowerShell invocation is triple-quoted.

flowthing 2021-04-30T15:01:32.323400Z

At least, that's what worked on my colleague's machine. :man-shrugging::skin-tone-2:

flowthing 2021-04-30T15:02:10.324Z

That is, e.g. {:mvn/version """0.8.3"""} etc.

pez 2021-04-30T15:12:01.325400Z

Awesome. Thanks for sharing!

2021-04-30T15:12:27.325800Z

You mean this?

2021-04-30T15:13:19.326200Z

I get same error ๐Ÿ˜ž

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,"""0.8.3"""},cider/cider-nrepl {:mvn/version,"""0.25.11"""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1

2021-04-30T15:13:36.326500Z

bloody windows huh ๐Ÿ˜„

pez 2021-04-30T15:15:40.327400Z

You must json quote the quotes there.

2021-04-30T15:23:06.327800Z

Yeah, still same problem. Tried single quotes, double quotes, triple quotes

2021-04-30T15:23:42.328100Z

If you get a potential fix for it, let me know I can help you test it

pez 2021-04-30T15:37:25.329200Z

I'll take you up on that offer, @qmstuart. It's invaluable to have a machine where we can reproduce.

pez 2021-04-30T15:42:42.335400Z

Meanwhile, two things. 1. Maybe try with borkdude's backslash quoting as well? And all things on that command line are not equal so pay close attention to what param the error messages complain about. Then you'll need to add all quoting together. ๐Ÿ˜€ 2. If it is mainly the getting started REPL you want to try out, and you have the CLI tools set up. You can fork and clone the dram repository and jack in to it with the regular command.

flowthing 2021-04-30T15:59:24.337700Z

I could check the exact format next week, but I realize thatโ€™s a bit late... anyway, the objective is to try to convey the triple quotes into the command-line invocation.

flowthing 2021-04-30T16:00:08.338700Z

Oh, I see now that that did happen. No idea why that doesnโ€™t work, then. :man-shrugging::skin-tone-2:

borkdude 2021-04-30T16:00:36.339300Z

This all depends whether you are invoking this yourself from a shell, or if Calva is invoking this from node. In the latter case this doesn't have to do anything with your shell.

borkdude 2021-04-30T16:01:04.339800Z

So please give a good repro with a lot of details, else I don't think it's actionable.

pez 2021-04-30T16:36:59.339900Z

Please give this some :calva: emojies, dear friends. (In the #news-and-articles channel).

pez 2021-04-30T16:40:05.342Z

@borkdude I think all these attempts have been using the Calva Getting Started REPL command. The super strange and extra tricky thing here is that it behaves so differently on different WIndows machines.

pez 2021-04-30T16:43:34.344600Z

For now, I take the win that @flowthing highlights here. That there is at least some workarounds possible by the fact that the injected dependencies are configurable via settings.

flowthing 2021-04-30T16:47:13.345700Z

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,"""0.8.3"""},cider/cider-nrepl {:mvn/version,"""0.25.11"""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
That doesn't work because of the nested double quotes, right?

flowthing 2021-04-30T16:47:35.346300Z

So maybe -Sdeps '{:deps ,,,}' might work (single quotes).

flowthing 2021-04-30T16:47:45.346900Z

Or no, not in PowerShell maybe... don't remember.

alexmiller 2021-04-30T16:48:02.347500Z

yeah, I don't think single quotes are what you want in powershell

flowthing 2021-04-30T16:48:06.347700Z

Yeah.

flowthing 2021-04-30T16:48:31.348600Z

I'll check the exact invocation Calva makes on my colleague's laptop next week.

borkdude 2021-04-30T20:30:09.349600Z

Single quotes do work in PowerShell. Use them as follows: -Sdeps '{:deps {medley/medley {:mvn/version \"1.3.0\"}}}' cc @flowthing

borkdude 2021-04-30T20:30:22.349900Z

Note that the double quotes have to be escaped.