Fork me on GitHub

Hey Guys! How do I build the calva extension from source on my local system and test it? Is there any guide for building?


Hi @punit-naik! Yes there is a page about it on the wiki. How to contribute or something, iirc.

👍 4

@johnjelinek, and other windows users (and Mac and Linux users as well, actually). I need help testing this build. It fixes an issue where clojure.ps1 is not installed and CLJ/CLI projects fail in jack-in. I've changed the strategy of trying to find the executable (`lein`, clojure, etc) in the user's path before executing it. (Seems the OS already takes care of that, so not sure why it is done like that to begin with). I can still start Leiningen, CLJ/CLI, and shadow-cljs projects on my Mac. But I don't know if things still work on Windows and Linux (it really should still work on Linux), or even if it now works for the case the fix is for. Gold stars in heaven (as we say in Sweden) for everyone helping to test this.

✹ 4


> Executing task in folder yellowtheme: powershell.exe clojure -Sdeps "{:deps {nrepl {:mvn/version \`"0.6.0\`"} cider/cider-nrepl {:mvn/version \`"0.21.1\`"}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

Missing closing '}' in statement block or type definition.
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace


Can you try it using cmd as your default vscode terminal shell?


same error:

> Executing task in folder yellowtheme: powershell.exe clojure -Sdeps "{:deps {nrepl {:mvn/version \`"0.6.0\`"} cider/cider-nrepl {:mvn/version \`"0.21.1\`"}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

Missing closing '}' in statement block or type definition.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingEndCurlyBrace
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.


I think you should get rid of those backticks in the command


new error if you remove the backticks:

>powershell.exe clojure -Sdeps "{:deps {nrepl {:mvn/version \"0.6.0\"} cider/cider-nrepl {:mvn/version \"0.21.1\"}}}" -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Unknown option: "-i"
Unknown option: "-n"
Unknown option: "-p"
Unknown option: "-u"
Unknown option: "-t"
Unknown option: "-F"
Unknown option: "-o"
Unknown option: "-r"
Unknown option: "-m"
Unknown option: "-a"
Unknown option: "-t"
Unknown option: "-o"
Unknown option: "-u"
Unknown option: "-t"
Unknown option: "-p"
Unknown option: "-u"
Unknown option: "-t"
Unknown option: "-F"
Unknown option: "-o"
Unknown option: "-r"
Unknown option: "-m"
Unknown option: "-a"
Unknown option: "-t"


Powershell quoting is tricky as hell. It seems it is different between clojure.ps1 and the clojure command provided by that module.


What shell was the default vscode she'll for you before you made the last experiment?


For leiningen we cheat by temporarily switching to . Maybe we can do something similar for this, switching to powershell. Because the quoting gets extra crazy when executing powershell.exe from to run the clojure command.


Maybe @U051BLM8F has some advice?


Unfortunately I don’t. I haven’t used Windows actively in a very long time.


@U0ETXRFEW: this is how I usually do it from powershell:

clj -Sdeps '{:deps {nrepl {:mvn/version \"0.6.0\"}}}' -m nrepl.cmdline


my default shell was pwsh (the open source impl of powershell)


> clj -Sdeps '{:deps {nrepl {:mvn/version \"0.6.0\"}}}' -m nrepl.cmdline

nREPL server started on port 51518 on host - 


I've not figured out the quote magic to get this to work from command prompt via the powershell.exe command


@U0ETXRFEW: there's some vigorous discussion in #clj-on-windows on this topic. The official answer is: dump cmd; only powershell is supported


looks like someone made a wrapper to fix this problem for command prompt:


Thanks @U051BLM8F, that link helps! ❀


I don't think I can bundle a wrapper like that, @johnjelinek. But I can maybe pick up some clues from the source.


New build for you to test, @johnjelinek. (And anyone else who wants to be kind enough to help me check if I have broken something with jack-in.)


> Executing task in folder yellowtheme: clojure -Sdeps "'{:deps {nrepl {:mvn/version ""0.6.0""} cider/cider-nrepl {:mvn/version ""0.21.1""}}}'"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

'clojure' is not recognized as an internal or external command,
operable program or batch file.
The terminal process terminated with exit code: 1


if I change default terminal to pwsh instead of cmd, I get:

> Executing task in folder yellowtheme: clojure -Sdeps '{:deps {nrepl {:mvn/version ""0.6.0""} cider/cider-nrepl {:mvn/version ""0.21.1""}}}'  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

Error while parsing option "--config-data {:deps {nrepl {:mvn/version 0.6.0} cider/cider-nrepl 
{:mvn/version 0.21.1}}}": java.lang.NumberFormatException: Invalid number: 0.6.0


I think your command needs to look more like this:

clj -Sdeps '{:deps {nrepl {:mvn/version \"0.6.0\"}}}' -m nrepl.cmdline


@U0ETXRFEW: you wanna try a build with \s?


@johnjelinek sorry for the radio silence. I've been traveling and haven't been able to make any new tests. Now back at home and will make another attempt to make my poor computer run a virtual win10 machine. Your test results indicate that the switching to powershell doesn't work yet, so that is the first thing I need to fix. Then we'll get to the quoting. But reading the docs it seems we should be able to use unescaped double quotes inside single quotes, which would be awesome, because then we can use the same quoting for bash and powershell.


cmd calling powershell.exe does not work and that's a known issue and WONTFIX according to #clj-on-windows. If powershell is the default vscode shell, it works if you fix the quoting


Except that it doesn't. 😃 And except that running powershell.exe through cmd works for a lot of Calva users today. But, anyway, if you look at the command line of the latest test build is using, it is not using powershell.exe. I've ran a few experiments with this today and find that clj -Sdeps '{:deps {nrepl {:mvn/version \"0.6.0\"}}}' -m nrepl.cmdline as well as clj -Sdeps '{:deps {nrepl {:mvn/version ""0.6.0""}}}' -m nrepl.cmdline work if I run them manually in the integrated powershell in VS Code. But when running them through the VS Code Task, with the shell set to powershell, neither of them work. Both of them renders the same error (the version number is somehow stripped of the double quotes).


This looks to me as a VS Code + Powershell thing, but I have yet to figure out how to work it.


does clojure -Sdeps '{:deps {nrepl {:mvn/version """0.6.0"""}}}' -m nrepl.cmdline with powershell as default shell work for you?


Not really. 😃 I think triple quoting is for when you have double quotes around the string. With single quotes around the string then two double quotes around the version number suffices.


No, I was wrong. Using single quotes around the string I get the same result writing the double quotes around the version number like \", "", and """ (they all work). Quite odd. But this is all manually executing the command. Doing it through a VS Code Task, they all fail (in the same way).

😱 4

is it that same error? java.lang.NumberFormatException: Invalid number: 0.6.0


alternatively -- you could make a thing that makes sure these deps are in the deps.edn of your clojure installation and change the command to clojure -m nrepl.cmdline


That would defeat the whole jack-in thing. 😃


Anyway. I get it to work if I use seven (7!) double quotes. Like so: clojure -Sdeps '{:deps {nrepl {:mvn/version """""""0.6.0"""""""} cider/cider-nrepl {:mvn/version """""""0.21.1"""""""}}}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]". A new build coming your way soon.


See if that one works for you as well.


😆 how did you come up with SEVEN "? I'll be able to check it when I get home tonight


I got frustrated and tried with 50 something. The error message from that gave me a clue. 😎

😼 4

I 👏 your persistence -- what was the error with 50-something "?


> Executing task: clojure -Sdeps '{:deps {nrepl {:mvn/version """"""""""""""""""""""""""""""""""""""""""""""""""""""""0.6.0""""""""""""""""""""""""""""""""""""""""""""""""""""""""} cider/cider-nrepl {:mvn/version """"""""""""""""""""""""""""""""""""""""""""""""""""""""0.21.1""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}'  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

Error while parsing option "--config-data {:deps {nrepl {:mvn/version \"\"\"\"\"\"\"\"\"0.6.0\"\"\"\"\"\"\"\"\"} cider/cider-nrepl {:mvn/version \"\"\"\"\"\"\"\"\"0.21.1\"\"\"\"\"\"\"\"\"}}}": java.lang.IllegalArgumentException: Duplicate key:

👍 4

@U0ETXRFEW: MAGIC 🎉 you did it!


it works great now


@U0ETXRFEW: is there something about your latest change that is pinning my vscode to powershell terminal? I can't select any others now.


That sounds like it could be my change. Can you describe the problem a bit more, so that I can try reproduce it.


@U0ETXRFEW: I select a different default terminal and no matter what I pick, when I open a new terminal, it's powershell


I can't get to git bash, WSL bash, cmd, or pwsh(powershell core)


Thanks. I think I know what is going on. It is some confusion between user and workspace settings. While I look for a way to not create that problem I think you can clean up your settings.json files to get your shell selection back.


I think my settings.json looks clean already, anything specific you want me to look at?

pez16:07:35 in your workspace settings.

👍 4

Sorry for the late reply. Had missed the question...


Also, in the new test build that I posted in #calva-dev , I have completely changed the implemantation, so not fiddling with default shell or anything. (And we're back to two " for escaping. 😃 )


waow! can't wait to see the PR!


k, here's my settings.json now:

    "window.titleBarStyle": "native",
    "editor.cursorStyle": "block",
    "editor.cursorBlinking": "solid",
    "editor.rulers": [
    "window.zoomLevel": 2,
    "terminal.integrated.rendererType": "dom",
    "calva.jokerPath": "C:\\Program Files\\Joker\\joker",
    "calva.lintOnSave": true


if I tell it to change the default shell, it adds the last line here:

    "window.titleBarStyle": "native",
    "editor.cursorStyle": "block",
    "editor.cursorBlinking": "solid",
    "editor.rulers": [
    "window.zoomLevel": 2,
    "terminal.integrated.rendererType": "dom",
    "calva.jokerPath": "C:\\Program Files\\Joker\\joker",
    "calva.lintOnSave": true,
    "": "C:\\Program Files\\Git\\bin\\bash.exe"


and when I open a new terminal with the + button, it still opens in powershell


@U0ETXRFEW: this is with the latest vsix (4)


Jack-In looks like it doesn't work though:

> Executing task in folder yellowtheme: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe clojure -Sdeps '{:deps {nrepl {:mvn/version ""0.6.0""} cider/cider-nrepl {:mvn/version ""0.21.1""}}}'  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

nREPL server started on port 51954 on host - 

Start the REPL with the command *Start Project REPL and connect (aka Jack-in)*.
Default keybinding for Jack-in: ctrl+alt+c ctrl+alt+j
Jacking in...
No nrepl port file found. (Calva does not start the nrepl for you, yet.) You might need to adjust "calva.projectRootDirectory" in Workspace Settings.
Jack-in done.
Use the VS Code task management UI to control the life cycle of the Jack-in task.


tried again and it connected this time ... dunno what the issue was


still can't use different terminals though


I think the default shell is changed in the workspace settings (by fix-3). It overrides the user/global settings. You should have a .vscode/settings.json in the root of your project. Remove the setting from that one and you should get back the control of this.


Regarding that ”No nrepl port file found” message. I get that too at times. Feels like a race condition. Strange because it happens in the file change watcher that triggers when that file is created... Please keep me informed about how frequently it happens for you.


oic, it was hiding in my workspace file


@U0ETXRFEW: ya, so first jack-in always fails to connect now, but restarting task succeeds


Thanks. I see what is happening now. On Windows I get two events for the nrepl port file, and on Mac only one. Expect a fix soon. 😎