Hi all, could someone offer me some insight in formatting? I'm using Calva's builtin formatter which works well, but I also have coworkers using emacs and cursive. We're trying to uniform the formatting that we're using. I've looked at cljfmt and cljstyle, but those don't seem to support map column alignment (which Calva and Cursive both do support, don't know about emacs). Having a single tool (like clj-kondo) to do the job would be ideal, so we can enforce that with git / CI. Hope this is the right place to ask this question. Is this something other teams ran into? What options are currently available to solve this? Any suggestions would be greatly appreciated, thanks!
@pdekruif clj-kondo is not a formatter. have you looked at zprint as well?
The issue was brought up as late as yesterday, so it is definitely something teams run into. It is also a really tricky thing to solve as this ClojureVerse (including all the links) demonstrates: https://clojureverse.org/t/clj-commons-building-a-formatter-like-gofmt-for-clojure/
I think that for teams aligning around cljfmt defaults make sense. Not only because that is Calva’s defaults. Aligning maps and stuff is nice, but simplifying the unification across the team is nicer.
@borkdude clj-kondo is not a formatter I know, I meant it's such a great (standalone) tool that can be used as a quality gate and with whatever editor. Thanks for all the hard work you're doing on that! We'd like to use something in the same way, but for formatting. I'm looking at zprint right now per your suggestion and it looks definitely promising. Thanks!
@pez is it possible to use the cljfmt variant of Calva as a standalone tool? Calva uses it's own fork from cljfmt right?
I think so. Building the jar from the fork should do it.
It’s an aging fork, though. We will have to merge form latest cljfmt soon.
zprint looks pretty good for our purposes. currently I have format on save enabled, which uses Calva's cljfmt. Is it possible to switch this out for zprint? Here be dragons?
Not really. But Calva could be made to support using either cljfmt or zprint as the formatter. It would take quite a lot of work, but it is a possibility at least.
If you standardize along formatting that Calva can’t be configured to support, then format-on-save will cause more pain, I think. Depending on how you enforce your formatting, of course.
Good to know. I'll try with this plugin alongside Calva: https://marketplace.visualstudio.com/items?itemName=SteefH.external-formatters . I've disabled Calva format, see how that works out. In case anyone is interested, I've added this to my settings.json:
"externalFormatters.languages": {
"clojure": {
"command": "zprintm",
"arguments": []
}
},
"[clojure]": {
"editor.defaultFormatter": "SteefH.external-formatters"
}
Dear Calva ClojureScriptarians I just got word from @bozhidar that in cider-nrepl 0.25.10
the completion of JS things is re-enabled unless it’s a shadow-cljs
REPL (because it doesn’t work there yet). Please update your Calva jack-in dependencies settings to try it out. Let us know if you run into issues.
If you are not following along in the #lsp channel (which you should) you might not know that 2021.04.07-16.34.10
was released yesterday. Same there, please try it out and give feedback where you think it is appropriate.
And in both cases, remember that you have fiddled with this settings, so that you can reset it to defaults later and follow Calva’s choice of dependencies as we update them.
Hi there! Is there a way in calva to evaluate a whole file? Similar to CIDER's cider-eval-buffer
@setzer22: The closest you’ll get is Load Current File and Dependencies, which might be close enough. You can also Select All -> Evaluate Current Form (or selection, if any), then Undo Cursor. Which on mac, default key bindings, would be cmd+a ctrl+enter cmd+u
.
Would appreciate some help testing a VSIX again: https://12713-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.186-1023-add-comment-context-d9c37682.vsix It introduces these changes: • https://github.com/BetterThanTomorrow/calva/issues/1023 • Fix: https://github.com/BetterThanTomorrow/calva/issues/1105 It also uses these new contexts to let VS Code default word movement be active within line comments. Please consider giving it some spins both to check the new functionality and to help find any regressions we might have introduced. (“We” are @cb.lists and yours truly in this case.)
@javahippie, since you are running with the unbalanced closing brackets prevention thing enabled, maybe you can test this one and confirm that it behaves better in line comments now?