It will soon be three years since Calva was first released. Back then it was not yet clear how important VS Code would become. It was rather the encouragement from the Clojure community that kept us at it, feature by feature, fix by fix. The VS Code Extensions Marketplace reviews and the repository stars collected, and the activity at the #calva Slack channel, all tell the story of a product that has been there, and will stay there, for the benefit of its users.
Somehow Calva has become a pretty decent Clojure development environment. It has happened from many, many small steps, mixed with some bigger leaps. The latter much thanks to Clojurists Together.
Assuming that The Tao of Calva does not answer all your questions: In waiting for the latest State of Clojure results to drop in, the Calva Team ā since quite a while consisting of me and @bpringe ā hereby make ourselves available to answer any questions you might have about Calva and the process of creating and maintaining it.
Hi @PEZ
I started switching from Cursive to calva for some months now but I feel Iām not using it at its full potencial to be fare I havenāt had the time to study it in deep.
Hi @PEZ and @bpringe ,
Iām not a Calva user (20 years and counting on Emacs, VSCode is not really my thing), but Iāve been following its development, and I wanted to thank you guys for the amazing effort youāve put in, and especially how youāre constantly trying to make it accessible to new Clojure users. You guys rock!
Calva is awesome. I use it as my main environment. I am so thankful I didnāt have to learn emacs as well as Clojure when I started out.
I have three questions:
Maybe this is a vs code issue, but is it really necessary to reset my keybindings every other release? Itās a bit annoying so now Iām just trying to learn the standard ones instead.
I would like to control the execution enviromnent (i.e. PATH and JAVAHOME env vars) Because I like to try out different jvms and stuff. And honestly, now I donāt even know what is used. Where can I set this for Calva?
When printing too much, jacking-in again is not enough and I have to restart vs code to get a āclean slateā is there any way around this?
Windows Remote Desktop does not convey ctrl-alt-left/right. I notice that it is possible to choose Paredit commands from the palette if you know their name.
In Emacs, I know how to reevaluate each form in the current buffer: m-x cider-eval-buffer. Is there an analogous command in Calva?
Itās not a VS Code issue as much as it is a multiplattform issue. Keyboard shortcuts are notoriously hard to get right. Impossible even. When I created Calva I wanted it to have defaults for most things, but I underestimated the shortcuts quagmire. That said we have not been changing default shortcuts very often. The last year I think it has happened once, and it was three or four shortcuts. It was after much consideration, but it still caused disruption. Canāt promise it wonāt happen again, because when something is wrong, it needs to be fixed, but I do promise it wonāt happen willy-nilly.
Not sure what you mean here. If you are using jack-in, then maybe the jackInEnv setting might be what you need? See Customizing Jack-in.
This is a limitation with us using a regular VS Code editor as output panel. We have on our todo to add some options for this. As the regular editor has many advantages, I am guessing most people will want to stick with that anyway. You might get away with just closing the output window and opening it again (ctrl+alt+c o). Otherwise there is also a Developer: Reload Window command that is slightly less of a nuke option than restarting VS Code.
Super happy to hear you are enjoying Calva! Keep the questions coming!
I didnāt know that. Goes towards the point I made about multi-platform shortcut hell, earlier. Not good at all. However, VS Code also makes it easy to re-bind shortcuts. If you are on an English keyboard, I know people how are happy with using shortcuts for slurp and barf that involve the > and < keys. (Iām on a Swedish keyboard so not an option for me, did I maybe not mention that on top of the platform issues, there is also a huge variety of shortcuts that become unavailable when considering various languages and keyboard layoutsā¦)
Currently there are only two options:
Select All ā Evaluate Selection
Load file
The first one has the drawback that Select All doesnāt participate in the Paredit selection stack, so it is bit hard to get back to where the cursor was. I should probably fix thatā¦ Issue welcome.
The second one does a bit more than what you ask for, but often works for the purpose. Iād welcome an issue to add the command you ask for.
Also, there is almost a third way to do it. To create the command yourself using a Custom REPL Command, ā¦ but, no, I donāt expose the text of the current file there. I should. That is really easy to add. Issue please. (I will probably just do this, but it is always a nice feeling to being able to close user issues.)
and Iām a repl with java 16 as jvm. (my usual one is openjdk 11)
I figured it was probably calva.jackInEnv. It was a bit finicky to get to work. ( I had some syntax errors that was not causing errors to be raised) but I got it to work now.
Not working (missing "'s):
{
// not working
"calva.jackInEnv": {
"PATH": /usr/lib/jvm/java-16-oracle/bin/:${env:"PATH"},
"JAVA_HOME":/usr/lib/jvm/java-16-oracle/
}
}
VSCode calls it āDeveloperā but I recommend everybody to remember that command and use it when something in VSCode doesnāt work. For example when new keybindings didnāt start working.
@PEZ Thank you very much for Calva. I love it. I wouldnāt use Clojure without it since VSCode (Codium in my case) is the only editor I want to use. THANK YOU THANK YOU THANK YOU ;-).
If I may one question, could you please tell me how does Calva work with clj-kondo? Recently I wiped and re-install all extensions and I realized that something changed since older version of Calva installed clj-kondo as āextension packā but it seems that the current version 2.0.194 doesnāt need it and everything works like before when I had installed both Calva and clj-kondo.
If you may? This is an AMA. Calva does this by way of clojure-lsp these days. @bpringe and @ericdallo, @snoe and @borkdude are the team behind this awesome thing in your favorite editor. Iāll be talking about it a bit at :clojureD in beginning of June, btw. Get your tickets now.
Iād say it is. We take our feature request wherever we get them. Even if often we then ask for them to be filed at GitHub. My experience is that the requests on GH often improves if they are first discussed a bit.
open-vsx is not just about open source enthusiasm. Either patched versions (VSCodium) or complete forks (code-server) canāt use official VSCode marketplace without braking MS terms so open-vsx is very important. Thank you.
I was very pleasantly surprised when I installed Calva and typed ācalvaā into Command Palette and saw all commands. Very impressive.
The only problem I had was default settings. I quickly realized that default Calva keybindings override classic key shortcuts like for example Ctrl+arrows. I donāt know how about other people but I use Ctrl+arrows all the time to move cursor. I understand that you want to make some features easy accessible but I donāt think that overriding Ctrl+arrows or Ctrl+shift+arrows is a good idea.
Luckily it was very easy to disable all bindings "calva.keybindingsEnabled": false so I didnāt have to disable one by one and I could enable just a few:
There is one great VSCode extension for Elixir that you might want to look at: Elixir Test
All it does is to jump back and forth between Elixir source and its test. In other words in Clojure it would jump between src/a/b/c.clj and test/a/b/c_test.clj and if the test file doesnāt exist it would create that file with the following content:
Hi @rudolfvesely . Thanks for this feedback! There have been discussions around the keybinding overrides in the past. Keybindings are unfortunately difficult to get right (Calva has many by default, and keeping similar actions mapped to similar combinations can make changing one cause a cascading effect of needing to change others), but we continue to tweak things if/when it seems good to do so.
The ctrl+arrows and ctrl+shift+arrows bindings should still move the cursor and select things, respectively, but they do so in more of a Clojure-structure-aware way, at least when the cursor is in Clojure code. ctrl+arrows actually used to slurp/barf, but of course this was jarring for some new users and we somewhat recently changed them to more closely map to the default VS Code actions. This still may not be desirable for some users though. Iāll defer to @pez for his thoughts on this.
I think it is a good idea. The non-structural norm is of course going to cause some friction doing this, but I donāt think that structural editing should take the back seat if it can be avoided.
That said, I know many users are not ready to let structural editing take full precedence, which is why there is a setting that I think you might have missed (because I think it might not be mentioned in the documentation, or at least not prominently enough, I donāt remember). calva.paredit.hijackVSCodeDefaults. See if disabling that give you back some of what you think should be the defaults. I think it can be applied wider, even, so if you try it and still find places where you think Calva is hijacking too much, file an issue about them and we can have a discussion.
Also if you mainly want to target Paredit shortcuts and not kill all Calva defaults, there is a setting āParedit keymapā which you can set to none. (Though hopefully the hijack setting will prove enough and you wonāt need the two nuke options, we will see.)
Please file as a feature request on Github. Sounds great!
Yes, Iām among those users. I canāt imagine working without syntax highlighting or without linter or without "editor.formatOnSave": true, like I did 20 years ago but Iām not happy when editor deletes right bracket when I backspace the left one. Thatās too much, I feel like Iām constantly fighting it.
But I understand that most people do like it so itās better that defaults work for them. Thank you @PEZ.