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-05-01T10:38:48.350200Z

I tried to summarize some of what I know so far here https://github.com/BetterThanTomorrow/calva/issues/1162#issuecomment-830609242 Pasted it in this post too for easy access. @flowthing: Can you add the workaround that worked on your colleague’s machine to the issue?

flowthing 2021-05-01T10:45:17.351Z

Will do. 👍:skin-tone-2:

❤️ 1
borkdude 2021-05-01T11:31:57.351600Z

I left a couple of hints here: https://github.com/BetterThanTomorrow/calva/issues/1162#issuecomment-830616904 Don't give up @pez, we will win the war on quoting.

🤘 1
borkdude 2021-05-01T11:38:37.352500Z

@pez Could you explain what cmd.exe and Powershell have to do with this? Are users launching this getting started REPL manually from their shells?

pez 2021-05-01T11:45:47.356Z

I commented on that thing on the issue. Not sure it answers your question. Getting Started REPL is using Jack-in under the hood though. And almost the same thing happens when jacking in to a deps.edn project. For the latter we quite often advice people who wan to start the REPL themselves and connect instead to copy the command line echoed. Calva even has a command for copying out the jack-in command line.

borkdude 2021-05-01T11:47:14.356300Z

I reacted. I don't think you need the shell option.

pez 2021-05-01T11:51:48.357500Z

It is currently the only option where it works on my machines right now, so it will stay used until we have figured out the non-shell way of doing it.

borkdude 2021-05-01T11:52:00.357700Z

what is it

pez 2021-05-01T11:52:09.358Z

The shell option.

borkdude 2021-05-01T11:52:17.358200Z

I mean the second it

pez 2021-05-01T11:52:29.358600Z

The shell option. 😃

borkdude 2021-05-01T11:52:56.359200Z

It is currentl the only option where "the shell option" works on my machines right now?

pez 2021-05-01T11:52:59.359400Z

The third it is Getting Started REPL. 😃

pez 2021-05-01T11:53:54.361200Z

Ah, so there are more its… Hmm. 1. The shell option 2. Getting Started REPL 3. The shell option 4. Getting Started REPL

pez 2021-05-01T11:54:02.361500Z

lolz

borkdude 2021-05-01T11:54:05.361700Z

The shell option launches the default system shell to run your command. This is not necessary when you launch an executable like java. Moreover it will introduce these shell and platform-specific quoting issues, rather than solving them. But whatever you want :)

pez 2021-05-01T11:55:11.362900Z

It is not a matter of what I want. Don’t you agree that I should keep doing something that works for 90% of the cases over something that works for 0%?

borkdude 2021-05-01T11:55:32.363400Z

I don't agree with using the shell option when it's completely unnecessary.

borkdude 2021-05-01T11:55:37.363600Z

But it's your tool

pez 2021-05-01T11:56:08.364300Z

I think we don’t understand each other right now. Unnecessary?

borkdude 2021-05-01T11:56:27.364700Z

You want to launch a java subprocess. Not a shell subprocess which launches a java subprocess (with quoting issues).

pez 2021-05-01T11:56:44.365Z

Yes. Agreed. That is what I want.

pez 2021-05-01T11:56:50.365300Z

I also want it to work.

borkdude 2021-05-01T11:57:30.365700Z

Note that when you want to launch the official clojure CLI, then you do need the shell option, because powershell....

borkdude 2021-05-01T11:57:41.366100Z

but for launching java, you do not need it

pez 2021-05-01T11:57:54.366700Z

Well, I have put launcing the official Clojure CLI on hold for now.

borkdude 2021-05-01T11:58:10.367100Z

Here is an example of how to launch a binary: https://github.com/marcomorain/clojure-lint/blob/86f699258d7478d44237241ecf1f0be914170887/src/extension.ts#L55 and how to find it, in a cross platform way.

borkdude 2021-05-01T11:58:16.367400Z

Good luck, afk now.

❤️ 1
pez 2021-05-01T15:04:58.372Z

So, been at this a bit more now. I might have tried more quoting variants than any other coder ever existing. None of those worked. But all is not lost. I think I have found another solution. If I use CMD-style quoting and write the command line to a .cmd file, then execute that file, the jack-in succeeds. OnMyMachine, yes, but I don’t see why that shouldn’t work on any machine, even in a world as crazy as Windows.

2021-05-01T16:19:24.373Z

installing now

2021-05-01T16:19:43.373100Z

2021-05-01T16:19:51.373500Z

log

2021-05-01T16:19:54.373800Z

> 01/05/2021 17:19:19 - Microsoft VSIX Installer > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:19 - vsixinstaller.exe version: > 01/05/2021 17:19:19 - 16.9.1028 > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:19 - Command line parameters: > 01/05/2021 17:19:19 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\stuarts\Downloads\calva-2.0.195-1162-getting-started-repl-win-514800ae.vsix > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:19 - Microsoft VSIX Installer > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:25 - Initializing Install... > 01/05/2021 17:19:25 - Microsoft.VisualStudio.ExtensionManager.InvalidExtensionManifestException: Element 'Identity' has invalid value for attribute 'Version' ---> System.FormatException: Input string was not in a correct format. > at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument) > at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent) > at System.Version.TryParseVersion(String version, VersionResult& result) > at System.Version.Parse(String input) > at System.Version..ctor(String version) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.<>c.<ExtractManifestData>b__67_1(String s) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.VerifyStringValue[T](String value, ErrorInfo info, Func`2 selector, Boolean isRequired, Int32 maxLength, T defaultValue) > --- End of inner exception stack trace --- > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.VerifyStringValue[T](String value, ErrorInfo info, Func`2 selector, Boolean isRequired, Int32 maxLength, T defaultValue) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.ExtractManifestData(PackageManifest manifest) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.ReadPackageManifest(XmlReader reader) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.ReadManifest(Stream manifestStream) > at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl.ReadVSIXManifestFromPackage(Stream stream, CultureInfo preferredCulture) > at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl..ctor(String path, CultureInfo preferredCulture) > at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CreateInstallableExtension(String extensionPath, CultureInfo preferredCulture) > at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CreateInstallableExtension(String extensionPath) > at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData) > at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported) > at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported) > at VSIXInstaller.App.Initialize(Boolean isRepairSupported) > at VSIXInstaller.App.Initialize() > at System.Threading.Tasks.Task`1.InnerInvoke() > at System.Threading.Tasks.Task.Execute()

2021-05-01T16:20:05.374Z

Did i do something wrong?

pez 2021-05-01T16:20:49.374700Z

I don’t think so. Seen it before though. Let me see if it installs cleanly on my machine….

pez 2021-05-01T16:22:55.375700Z

Hmmm, no problem here. As I said, I think I have seen similar before. Don’t remember who it was… Maybe try downloading it again?

2021-05-01T16:24:42.376100Z

ok, i think i did do somethign stupid. I think I have .vsix associated with visual studio

2021-05-01T16:24:54.376400Z

installing it via plugins > add from vsix in VSCode worked

2021-05-01T16:25:13.376600Z

My calva now reports v2.0.195-1162-getting-started-repl-win-514800ae

2021-05-01T16:25:56.376800Z

same error

2021-05-01T16:25:59.377200Z

c:\Users\stuarts\AppData\Local\Temp\betterthantomorrow.calva\8mdqdl&gt;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

pez 2021-05-01T16:26:43.377900Z

That doesn’t look like the new version. Which version does the Extension pane say you are using?

2021-05-01T16:27:08.378Z

borkdude 2021-05-01T16:27:20.378500Z

@pez Have you also tried without the shell option?

borkdude 2021-05-01T16:28:26.378900Z

I believe you have to use triple double quotes in cmd.exe: https://github.com/BetterThanTomorrow/calva/issues/1162#issuecomment-830616904

borkdude 2021-05-01T16:28:48.379500Z

But without the shell option, I expect you won't need any quoting

borkdude 2021-05-01T16:29:13.379700Z

(off topic: Now that rewrite-clj also supports CLJS I guess we could also have a cljstyle that works in the browser and nodeJS)

pez 2021-05-01T16:30:26.380100Z

I have tried only without the shell option. 😃

borkdude 2021-05-01T16:31:15.381Z

@pez :) Then why does @qmstuart print output like 'c:\Users\stuarts\AppData\Local\Temp\betterthantomorrow.calva\8mdqdl>'. That looks like a shell to me

2021-05-01T16:31:36.381400Z

@pez, is that screenshot showig the version you expect after installing the new vsix?

pez 2021-05-01T16:33:12.381600Z

And as I said, it doesn’t look like from the new VSIX. 😃

pez 2021-05-01T16:33:39.382200Z

Yes, that is the correct version. Very strange….

borkdude 2021-05-01T16:33:56.382300Z

:thumbsup:

pez 2021-05-01T16:34:50.382700Z

Should look like so.

2021-05-01T16:35:56.383100Z

Here's what I'm doing / seeing

pez 2021-05-01T16:37:22.384200Z

Ah, but now it is the right version at least. Just that it still doesn’t work even with this strategy. Very disappointing!

pez 2021-05-01T16:39:05.384800Z

And now need to go afk. Will have to investigate this further later…

2021-05-01T16:39:22.385200Z

This is what my Jack in dependency versions settings look like for reference

pez 2021-05-01T16:52:57.386300Z

Thats the only variant I haven't tested yet. There is still hope!

borkdude 2021-05-01T17:01:05.386500Z

if that doesn't work, can you also try execFile like here? https://github.com/marcomorain/clojure-lint/blob/86f699258d7478d44237241ecf1f0be914170887/src/extension.ts#L55 No processing of the args, just pass them raw

stianalmaas 2021-05-01T17:26:37.388100Z

Hello guys. I have also tested the new version and I have exactly the same behaviour as Stuart. Which is good, I think. Our machines behave the same way. .calva\jack-in.cmd c:\Users\stian\AppData\Local\Temp\betterthantomorrow.calva\sqv3zo&gt;java -jar .calva\deps.clj.jar -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.26.0""}}}" -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.26.0}}}": java.lang.NumberFormatException: Invalid number: 0.8.3 Jack-in process exited. Status: 1

stianalmaas 2021-05-01T17:29:36.389600Z

The version numbers now have two double-quotes. As far as I can see everything is the same as for Stuart.

pez 2021-05-01T17:36:58.390700Z

Thanks, @stianalmaas ! Yes, I find some comfort in that you two have the same resukt. 😀

😁 1
pez 2021-05-01T19:45:02.391500Z

New VSIX cookin’. Are you still awake, @qmstuart and @stianalmaas? 😃

2021-05-01T19:46:02.391800Z

yeah, it's ony 8:45 here 😄

pez 2021-05-01T19:51:52.392200Z

It’s probably me having had a tad wine at dinner. 😃 Haha

2021-05-01T19:52:38.393300Z

nice, i could go a gin right now, but I'm all out 😞

pez 2021-05-01T19:52:56.393700Z

Here it is, I give it a 100% success prediction: (Yeah, like with the last try, but anyway). https://13280-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.195-1162-getting-started-repl-win-076d5d2f.vsix

stianalmaas 2021-05-01T19:53:08.393900Z

Going for it as well

stianalmaas 2021-05-01T19:56:52.394500Z

Hmm, I'm afraid I'm getting the same result: java -jar .calva\deps.clj.jar -Sdeps {:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}} -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.26.0}}}": java.lang.NumberFormatException: Invalid number: 0.8.3 Jack-in process exited. Status: 1

stianalmaas 2021-05-01T19:57:30.394900Z

The version is v2.0.195-1162-getting-started-repl-win-076d5d2f

2021-05-01T19:58:23.395400Z

me too

java -jar .calva\deps.clj.jar -Sdeps {:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}  -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.26.0}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1
Version: v2.0.195-1162-getting-started-repl-win-076d5d2f

stianalmaas 2021-05-01T20:01:51.396200Z

I can see that you've commented on this already @pez, but it seems the same problem is there for cider as well: https://github.com/clojure-emacs/cider/issues/2963

stianalmaas 2021-05-01T20:02:28.396800Z

But it may be a totally different use case since it uses leiningen...

pez 2021-05-01T20:05:29.398300Z

Madness.

stianalmaas 2021-05-01T20:05:31.398400Z

I can see that you have been fighting this this for a long time @pez. Must be frustrating.

2021-05-01T20:06:12.399700Z

Hey @pez! 👋 Thanks for your patience over there on GitHub!

👋 1
pez 2021-05-01T20:06:46.400500Z

@stianalmaas Yeah, and I keep thinking I can win, and even that I have won, which of course helps adding frustration.

😃 1
pez 2021-05-01T20:07:18.401200Z

Welcome, @alexandergunnarson!

2021-05-01T20:07:24.401400Z

Thanks! 🙂

pez 2021-05-01T20:08:05.401900Z

As you can see, the battle has many fronts. 😃

2021-05-01T20:08:27.402300Z

Haha yes 😂

2021-05-01T20:08:52.402900Z

Super appreciate you fighting the good fight ⚔️

2
pez 2021-05-01T20:10:44.403800Z

At least the error you are experiencing probably has a solution.

🙏 1
pez 2021-05-01T20:11:58.404700Z

Which java versions are you using, @qmstuart and @stianalmaas?

stianalmaas 2021-05-01T20:12:35.405Z

java version "16" 2021-03-16 Java(TM) SE Runtime Environment (build 16+36-2231) Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)

2021-05-01T20:12:42.405100Z

I’m hoping so — it’s really quite a strange heisenbug

2021-05-01T20:13:01.405700Z

❯ java --version
java 15.0.2 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

2021-05-01T20:13:41.405900Z

I’ve done literally the same steps 5 times in the past few minutes and have gotten different results each time. One time Calva spontaneously seemed to be doing just fine. The other times Calva broke in the places it has usually broken for me, but at different points

2021-05-01T20:14:18.406100Z

Trying to see if there’s some really subtle inconsistency on my end, like a timing issue or like having a file open in two places in VSCode or whatever

pez 2021-05-01T20:15:19.406400Z

Have you run it as many times using CIDER? (so that we know we have a model to follow).

2021-05-01T20:15:50.406900Z

About 3-4x in CIDER, all consistently fine

2021-05-01T20:16:06.407400Z

About 15+ in VSCode integrated terminal with nREPL, also consistently fine

2021-05-01T20:16:22.407900Z

I’ll keep doing tests

pez 2021-05-01T20:16:24.408200Z

Let me try with a newer Java, I think I am at 1.8 with my windows machine.

pez 2021-05-01T20:17:12.408300Z

It’s probably the case that we do something strange in Calva.

2021-05-01T20:17:46.408500Z

Quite possible. Right now I’m thinking it’s a timing issue but I’ll keep you posted.

pez 2021-05-01T20:17:48.408700Z

Better than doing all those tests would be if you added a missing feature to Calva, that CIDER has.

2021-05-01T20:18:00.408900Z

Which missing feature?

pez 2021-05-01T20:18:20.409100Z

CIDER has a feature for tracing the nrepl messages and responses.

2021-05-01T20:18:28.409400Z

Ahh nice

pez 2021-05-01T20:18:35.409600Z

Should have added that to Calva long ago.

2021-05-01T20:18:59.409800Z

How easy to add? I don’t have much time left today to spend on editor debugging issues unfortunately

2021-05-01T20:19:05.410100Z

Will be more free tomorrow

pez 2021-05-01T20:19:29.410400Z

There is no hurry as we have been missing the feature for years. 😃

2021-05-01T20:19:34.410600Z

Haha 😄

pez 2021-05-01T20:21:25.410800Z

I think it should be reasonably easy. There is oen place where messages are sent, and one where they are received. CIDER prints it nicely with -&gt; and &lt;- markers.

pez 2021-05-01T20:22:13.411Z

Every time I’ve needed it I have debugged printed instead. But it would be so much better to be able to ask the users for a log like that instead.

2021-05-01T20:25:04.411600Z

Ah man, this really is a true heisenbug — this time I made sure to connect Calva only after the server-REPL finished evaluating and loading some stuff. Then I evaluated, using Calva commands, the same files as before (which are in the same position in the same VSCode windows), in the same order

2021-05-01T20:25:24.411800Z

I can’t imagine what’s going wrong or why it spontaneously is fine sometimes

2021-05-01T20:25:50.412Z

Yeah probably time to debug this stuff using what you’re describing. I’m not sure how to hack on Calva or what’s involved. I’ll have to do some reading

pez 2021-05-01T20:28:32.412200Z

See the wiki for “How to Hack on Calva”. It is quite easy, I think. (But I do it all the time, so maybe not the best judge)

2021-05-01T20:29:04.412400Z

I figured there’d be a wiki — thanks for putting it together 🙂

pez 2021-05-01T20:35:37.413400Z

Success. (For some definition of success). With Java 16 I get the same error as @stianalmaas and @qmstuart get.

2021-05-01T20:35:55.413600Z

Thats good progress!

2021-05-01T20:36:04.414Z

Always helps when you can repro on your machine

2021-05-01T20:37:45.415400Z

I’ll dive into it tomorrow, but for this REPL session the heisenbug has not surfaced and I’m just going to run with that for now 🤞

pez 2021-05-01T20:37:47.415600Z

Indeed. Even if right now I am short of ideas. Hopefully some sleep will help replenishing.

2021-05-01T20:40:28.417200Z

Ah dang it. Resurfaced. Back to VSCode integrated terminal till tomorrow 😞

pez 2021-05-01T20:41:21.418300Z

I wonder why I didn’t suspect java version problems until now… But whatever happens, I’ve been able to simplify the construction of the jack-in command line as a result of this latest ghost chase, which makes me think it was worth it.

🎉 1
pez 2021-05-01T20:43:13.418400Z

I’ve just assumed from your name that you live in Sweden, but now checking, Slack tells me you are in the US?

pez 2021-05-01T20:44:15.418700Z

(Checked because it seemed you were planning to work for a while longer even though it is late here. 😃 )

🌘 1
2021-05-01T21:08:55.418900Z

Oh haha yes, in the US 😄

2021-05-01T21:09:21.419100Z

My great-grandparents dropped the additional “s” from the name (Gunnarsson) when they immigrated :flag-se:🇺🇸

2021-05-01T21:11:56.419600Z

I’m sure Swedes everywhere are shocked at the name butchery 😂

pez 2021-05-01T21:29:28.420900Z

Haha, there is much similar name butchery going on here as well.

2021-05-01T21:29:56.421100Z

😄