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?
Will do. 👍:skin-tone-2:
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.
@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?
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.
I reacted. I don't think you need the shell option.
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.
what is it
The shell option.
I mean the second it
The shell option. 😃
It is currentl the only option where "the shell option" works on my machines right now?
The third it is Getting Started REPL. 😃
Ah, so there are more its… Hmm. 1. The shell option 2. Getting Started REPL 3. The shell option 4. Getting Started REPL
lolz
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 :)
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%?
I don't agree with using the shell option when it's completely unnecessary.
But it's your tool
I think we don’t understand each other right now. Unnecessary?
You want to launch a java subprocess. Not a shell subprocess which launches a java subprocess (with quoting issues).
Yes. Agreed. That is what I want.
I also want it to work.
Note that when you want to launch the official clojure CLI, then you do need the shell option, because powershell....
but for launching java, you do not need it
Well, I have put launcing the official Clojure CLI on hold for now.
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.
Good luck, afk now.
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.
Here is VSIX using that ^ strategy: https://13275-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.195-1162-getting-started-repl-win-514800ae.vsix Can you test it @qmstuart and @stianalmaas?
installing now
log
> 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()
Did i do something wrong?
I don’t think so. Seen it before though. Let me see if it installs cleanly on my machine….
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?
ok, i think i did do somethign stupid. I think I have .vsix associated with visual studio
installing it via plugins > add from vsix in VSCode worked
My calva now reports v2.0.195-1162-getting-started-repl-win-514800ae
same error
c:\Users\stuarts\AppData\Local\Temp\betterthantomorrow.calva\8mdqdl>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
That doesn’t look like the new version. Which version does the Extension pane say you are using?
@pez Have you also tried without the shell option?
I believe you have to use triple double quotes in cmd.exe: https://github.com/BetterThanTomorrow/calva/issues/1162#issuecomment-830616904
But without the shell option, I expect you won't need any quoting
(off topic: Now that rewrite-clj also supports CLJS I guess we could also have a cljstyle that works in the browser and nodeJS)
I have tried only without the shell option. 😃
@pez, is that screenshot showig the version you expect after installing the new vsix?
And as I said, it doesn’t look like from the new VSIX. 😃
Yes, that is the correct version. Very strange….
:thumbsup:
Should look like so.
Here's what I'm doing / seeing
Ah, but now it is the right version at least. Just that it still doesn’t work even with this strategy. Very disappointing!
And now need to go afk. Will have to investigate this further later…
This is what my Jack in dependency versions settings look like for reference
Thats the only variant I haven't tested yet. There is still hope!
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
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>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
The version numbers now have two double-quotes. As far as I can see everything is the same as for Stuart.
Thanks, @stianalmaas ! Yes, I find some comfort in that you two have the same resukt. 😀
New VSIX cookin’. Are you still awake, @qmstuart and @stianalmaas? 😃
yeah, it's ony 8:45 here 😄
It’s probably me having had a tad wine at dinner. 😃 Haha
nice, i could go a gin right now, but I'm all out 😞
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
Going for it as well
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
The version is v2.0.195-1162-getting-started-repl-win-076d5d2f
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
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
But it may be a totally different use case since it uses leiningen...
Madness.
I can see that you have been fighting this this for a long time @pez. Must be frustrating.
Hey @pez! 👋 Thanks for your patience over there on GitHub!
@stianalmaas Yeah, and I keep thinking I can win, and even that I have won, which of course helps adding frustration.
Welcome, @alexandergunnarson!
Thanks! 🙂
As you can see, the battle has many fronts. 😃
Haha yes 😂
Super appreciate you fighting the good fight ⚔️
At least the error you are experiencing probably has a solution.
Which java versions are you using, @qmstuart and @stianalmaas?
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)
I’m hoping so — it’s really quite a strange heisenbug
❯ 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)
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
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
Have you run it as many times using CIDER? (so that we know we have a model to follow).
About 3-4x in CIDER, all consistently fine
About 15+ in VSCode integrated terminal with nREPL, also consistently fine
I’ll keep doing tests
Let me try with a newer Java, I think I am at 1.8 with my windows machine.
It’s probably the case that we do something strange in Calva.
Quite possible. Right now I’m thinking it’s a timing issue but I’ll keep you posted.
Better than doing all those tests would be if you added a missing feature to Calva, that CIDER has.
Which missing feature?
CIDER has a feature for tracing the nrepl messages and responses.
Ahh nice
Should have added that to Calva long ago.
How easy to add? I don’t have much time left today to spend on editor debugging issues unfortunately
Will be more free tomorrow
There is no hurry as we have been missing the feature for years. 😃
Haha 😄
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 ->
and <-
markers.
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.
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
I can’t imagine what’s going wrong or why it spontaneously is fine sometimes
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
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)
I figured there’d be a wiki — thanks for putting it together 🙂
Success. (For some definition of success). With Java 16 I get the same error as @stianalmaas and @qmstuart get.
Thats good progress!
Always helps when you can repro on your machine
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 🤞
Indeed. Even if right now I am short of ideas. Hopefully some sleep will help replenishing.
Ah dang it. Resurfaced. Back to VSCode integrated terminal till tomorrow 😞
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.
I’ve just assumed from your name that you live in Sweden, but now checking, Slack tells me you are in the US?
(Checked because it seemed you were planning to work for a while longer even though it is late here. 😃 )
Oh haha yes, in the US 😄
My great-grandparents dropped the additional “s” from the name (Gunnarsson) when they immigrated :flag-se: → 🇺🇸
I’m sure Swedes everywhere are shocked at the name butchery 😂
Haha, there is much similar name butchery going on here as well.
😄