Fork me on GitHub
#calva
<
2019-11-07
>
pez01:11:48

Hey, that ^ VSIX is old! Here’s a new one with support for thread-first arguments: https://2023-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.58-wip-sinature-handler-use-paredit-2f4c8a1e.vsix The gif shows the various cases that I have been able to come up with, with @qythium’s help.

guillaume03:11:37

Is there a way to configure auto indentation on macros. for instance, I would like to get 2 indents under conjure/mocking

(conjure/mocking
 [datadog/inc]
 (testing "testing.."
   (is (= 1 1))))

pez07:11:56

Calva doesn’t though. At least not yet.

pez07:11:52

Right now there is no way at all for the user to inform Calva about the indentation settings. The relevant issue is here: https://github.com/BetterThanTomorrow/calva/issues/80

pez07:11:50

It is old and quite painful for me to see how often I have committed to try fixing it… It is really not that hard. We use cljfmt for the formatting + our own autoformatter that is still in experimental stage and opt-in for users. But it uses a compatible indentation settings format so if we just expose one or two good ways to give Calva the cljfmt indent settings, then both of Calva’s formatters can use it.

pez12:11:48

Calva v2.0.58 is out. Please upgrade, folks. The changes are: • Fixed: Incorrect red highlights around brackets/paren in specific case • Fixed: “Require REPL Utilities” command is longer broken • Fixed: Hover definition for symbols derefed with @, and quoted symbols • Improved: Signature help-while-typing hover, with active arg markup

borkdude12:11:52

Also published clj-kondo VSCode extension v0.0.9 which brings datalog linting and support for compojure macros. You guys and girls get a heads up, since the official announcement will happen later today together with a blog post about the datalog linting.

clj-kondo 8
calva 8
aw_yeah 4
Filipe Silva14:11:54

@pez on the topic of formatting, is there any way to use the same formatting settings that calva has outside of calva?

pez14:11:21

Not sure I understand…

Filipe Silva14:11:27

I'd like to format my whole cljs project in a way consistent with calva

Filipe Silva14:11:49

ok let me give a practical example

pez14:11:58

Oh, that should be quite easy.

Filipe Silva14:11:28

I have a cljs project, on that project I use both Calva in the editor and zprint via the npm module (https://github.com/clj-commons/zprint-clj)

Filipe Silva14:11:54

when I edit files, calva will format it in a certain way

Filipe Silva14:11:06

I edit a couple of files and save the changes

Filipe Silva14:11:32

then I run zprint over the whole project to make sure all formatting is consistent via a script

Filipe Silva14:11:52

zprint will reformat the calva files in different ways

pez14:11:14

Calva uses clj-fmt so you will probably need to use that instead of zprint.

Filipe Silva14:11:25

this is mostly a question of configuration: I either configure zprint to match Calva, or the other way around

Filipe Silva14:11:08

(or I figure out a way to use clj-fmt)

pez14:11:48

If I recall correctly Calva uses default clj-fmt indentation rules. And then it depends on the settings you have for calva-fmt.

pez14:11:57

Also if I recall correctly it is hard to stop zprint from doing certain things that clj-fmt doesn’t do, so I would guess that using clj-fmt would be your main option.

Filipe Silva14:11:33

ok, I'll look into my options this weekend... maybe I can use shadow-cljs run to run https://github.com/weavejester/cljfmt

pez14:11:15

This is the settings map that Calva uses to configure clj-fmt:

{:remove-surrounding-whitespace? t/f
  :remove-trailing-whitespace? t/f
  :remove-consecutive-blank-lines? t/f
  :insert-missing-whitespace? t/f}
They correspond to settings you have in VSCode for calva-fmt. So feeding clj-fmt that map, with your settings should make clj-fmt produce the same formatting as Calva does.

Filipe Silva14:11:05

ok, will try those

pez15:11:11

Please let me know how you fare.

4