A cool thing with VS Code is that they have made it super easy to write extensions and to try your extensions out. With Calva the latter is this easy:
- Clone your fork of the Calva repository and checkout the
- Open the project in VS Code
Run Build Task, and wait a minute, this will build and start the watcher.
- Hit F5 (shortcut for Start Debugging) .
This will open a new VS Code window running your dev version of Calva. It’s called the Extension Development Host. Open a Clojure(Script) project in this window. Place breakpoints in the Calva code and see them hit as you use Calva in your dev Calva.
Most of Calva is written in TypeScript. For now we don’t have any hot reload there. So when you have changed something in the code you’ll have to restart the debug session. However, parts of Calva is written in ClojureScript and if you hack on that you will have hot reload, thanks to shadow-cljs. But before you start to hack on the ClojureScript side of things you need to do one more thing:
- Jack in (choose to start both
:test and connect to
This will start the shadow-cljs watcher and REPLs, and connect Calva to them. You are now using Calva to hack Calva. It is pretty mind blowing, actually.
Read more here: How To Contribute to Calva
I hope you will try this and enjoy it. The Calva Team is in #calva-dev on the Clojurian’s Slack, ready to help you and receive feedback. Happy coding!
Writing the above, I started to find the Calva wiki a bit confusing. Who is it for? Contributors or users?
I decided it was for the former and pulled the user documentation out to here: https://calva.readthedocs.io/
I’ve worked quite a lot with restructuring and amending the user documentation once I got it up on Readthedocs. It’s still a bit of a mess, but I do hope it is an improvement from the wiki version. Feedback and tips and PRs, please!
I’ve noticed that the Paredit behavior is odd using Calva on VS Code. What I mean is this:
When I type a double quote, then type a word, and then type double quote again, two double quotes appear. For instance, if I type the following at the keyboard:
it actually comes out
It makes it virtually impossible to use Calva. Paredit mode (emacs) doesn’t work like this.
Wow, never seen that, and never heard of it happening to anyone before… So, when I type
”hello", I get two double quotes when I type the first one, then the cursor is in between those and I type
hello, then, if I type a double quote again, the cursor will just move over the closing quote that is already there. This is how it is supposed to work.
I can only guess that you have some setting that I never use, even though Calva actually tries to configure some settings for Clojure files so that this should be working… Do you know if you have configured something in vscode that might be relevant for this? What OS are you on, btw? I’d welcome an issue on this to the repo. If you create it from VS Code, it will attach a lot of the info that might be needed to reproduce it. Thanks in advance!
I wouldn’t mind creating an “issue on the repo,” however I don’t know how to do that. I do have GitHub desktop and I know how to get to your GitHub. If you want me to create an issue, just let me know how to do it.
Yes… The behavior is quite weird, to the point that I’m really not able to use VS Code/Calva. I use Windows 10. In my extensions I have Calva, clj-kondo, Clojure 0.12.0 nREPL support by Andrey Lisin (I didn’t personally install the last two; they just showed up), and Go 0.13.1 (Rich Go language support, which I believe only effects Go files).
I uninstalled the Emacs Keybindings and Go extensions and the behavior still persists. I really like Calva/VS Code; it’s better than Cider/Emacs in my option. However, I’m just not able to use it if this persists.
Also… From my example, it puts double parenthesis on the end too!
In VS Code’s Help menu, select Report Issue:
About your extensions, I don’t think they are causing the problem. clj-kondo is bundled with Calva so that is why it shows up. The Clojure extension is probably something you have tried because it makes sense when trying to get Clojure support in VS Code. It is not compatible with Calva, how ever. You need to choose which one of them to use.
OMG. What is your setting for Editor: Match Brackets?
I posted a “issue” on the GitHub for VS Code. Do you want me to post it on the Clava one too?
I deleted the Clojure extension and that didn’t fix things.
My Editor.Match Brackets setting is set to “always.” I changed it to “never” and that didn’t change anything.
I’m not sure what to do.
On Monday, March 16, 2020, 3:44:17 PM EDT, Peter Strömberg via ClojureVerse email@example.com wrote:
Is this happening outside of Calva too? Like in a JS file, for instance? If so it is probably not something for the Calva issues list. If it is only in Clojure files, then it belongs in Calva’s issue list (and not in the VS Code one, I would say).
I’ve made another observation.
This behavior is ONLY happening in the REPL, not in the editor.
Thanks! That is easy to reproduce for me. I’ll fix it. (Not using that much myself, so maybe that is why I have missed it.)
OK. So it turned out there are several bugs causing this. I have fixed most of them in this PR, and closing strings and list should work as expected when that is published.
Please help testing it using this PR version of Calva
See the Calva development wiki about Installing and Testing VSIX packages, if you are not familiar with it.
This is now fixed in latest Calva, v2.0.86. Thanks for reporting!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.