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 dev branch
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 :calva-lib and :test and connect to :calva-lib).
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.
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:
(println “Hello!”)
it actually comes out
(println “Hello!”"))
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!
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?
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).
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.