How to auto-format clojure "on save" in VSCode

188 Views Asked by At

I'm currently using VSCode, and I'm trying to auto-format clojure files. I have Calva installed.

I've typed the following code into my .clj file:

(let [a    :b]
(str "foo"     "bar" "baz"
"a"    a))

I'm expecting it to auto format when I save, but it's not working for some reason. Any idea how to make it work?

Thanks!

1

There are 1 best solutions below

0
Esteban Ginocchio Silva On

You could use an extension such as: https://marketplace.visualstudio.com/items?itemName=marcomorain.clojure-lint that works with clj-kondo.

Additionally, you can add an alias in your project.clj to lint with clj-kondo. See the docs: https://github.com/clj-kondo/clj-kondo.