I would like the Calva formatter to be used also with VSCode Format Document command. I.e., when running Calva Format: Format Current Form and trim space... , it preserves the comment 's closing parenthesis in its own line, like this:
(comment
"testing"
)
(def testing "testing"
)
;; After running Calva Format: Format Current Form and trim space... inside both forms I get:
;; Good
(comment
"testing"
)
;; Good
(def testing "testing")
But when running Format Document I get:
;; NOT GOOD
(comment
"testing")
;; Good
(def testing "testing")
... which is not what I want (the closing parenthesis is moved to the last form line also with the comment form).
I tried to read the documentation, how to configure VSCode Format Document command to use the same formatter as Calva Format: Format Current Form and trim space... uses, but somehow I fail to understand how to configure this.I have in my VSCode settings:
"files.associations": {
"*.clj": "clojure",
"*.cljs": "clojure",
"*.cljc": "clojure"
},
"[clojure]": {
"editor.defaultFormatter": "betterthantomorrow.calva"
}, I don't believe this. I somehow managed to break my Calva setup. Even though I have my VSCode settings in a git repo, and resetted every configurations I did. Now when starting new line, the new line is not indented. 😞
Weird. I turned on the Calva > Fmt: New Indent Engine. When I do git diff in my VSCode settings.json I see this change:
"calva.fmt.newIndentEngine": false, => line removed.
But the indentation works again.
I’m not following around what happened and the diff. Is it working now?
You don’t need any special setting to use Calva as the document formatter. That’s the default. It is also expected behaviour that the trailing rich comment paren is not folded when formatting from inside the form, but it is folded when formatting from outside the rich comment form. https://calva.io/rich-comments/#special-formatting
Ah, ok. So, I am using Calva document formatter, but it just behaves a bit differently when formatting from outside the rich comment form. Is it possible to configure that formatter so that it behaves the same way when formatting outside the rich comment form as inside the form?
Indentation works again. 😃
And thanks for your answer, that explained the behaviour. ❤️
Dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.488 • https://github.com/BetterThanTomorrow/calva/issues/2745