calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
pdekruif 2021-04-08T07:07:37.344100Z

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!

borkdude 2021-04-08T07:15:58.344400Z

@pdekruif clj-kondo is not a formatter. have you looked at zprint as well?

pez 2021-04-08T07:37:56.347Z

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/

pez 2021-04-08T07:40:27.350400Z

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.

👍 1
pdekruif 2021-04-08T07:48:35.352Z

@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!

pdekruif 2021-04-08T08:00:27.357400Z

@pez is it possible to use the cljfmt variant of Calva as a standalone tool? Calva uses it's own fork from cljfmt right?

pez 2021-04-08T08:07:52.359100Z

I think so. Building the jar from the fork should do it.

pez 2021-04-08T08:56:06.360100Z

It’s an aging fork, though. We will have to merge form latest cljfmt soon.

pdekruif 2021-04-08T09:12:39.361500Z

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?

pez 2021-04-08T09:35:26.362700Z

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.

pez 2021-04-08T09:36:55.364200Z

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.

pdekruif 2021-04-08T09:46:31.366Z

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"
  }

👀 1
pez 2021-04-08T12:29:24.370Z

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.

❤️ 2
pez 2021-04-08T12:32:26.371700Z

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.

1
pez 2021-04-08T12:33:43.373Z

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.

Setzer22 2021-04-08T12:55:04.373900Z

Hi there! Is there a way in calva to evaluate a whole file? Similar to CIDER's cider-eval-buffer

pez 2021-04-08T13:02:48.377600Z

@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.

pez 2021-04-08T23:27:21.381700Z

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.)

pez 2021-04-08T23:28:59.382100Z

@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?