This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-06
Channels
- # announcements (14)
- # babashka (12)
- # beginners (61)
- # biff (2)
- # calva (16)
- # clj-kondo (22)
- # cljdoc (7)
- # clojure (131)
- # clojure-europe (52)
- # clojure-losangeles (9)
- # clojure-norway (54)
- # clojure-spec (5)
- # clojure-uk (4)
- # clojurescript (18)
- # cursive (14)
- # datomic (19)
- # deps-new (14)
- # emacs (8)
- # events (7)
- # fulcro (6)
- # graphql (3)
- # hyperfiddle (42)
- # instaparse (5)
- # lsp (10)
- # malli (21)
- # nbb (1)
- # off-topic (3)
- # pathom (3)
- # polylith (7)
- # reagent (14)
- # releases (2)
Is there a way to make sure that calva read the .cljfmt.edn
file? I have a very simple macro that should be indented the same way as let but it seems that calva ignores that line from config.
it's trivial {:extra-indents {appspark.core/stream-loop [[:block 1]]}}
But I see that I have "new structural engine" enabled. Can this be the cause?
Depends on what it is that is not working. The indenter is responsible for placing the cursor at the right column when you press enter. The formatter, formats code. (Like when you press tab
to format the enclosing form.) They sometimes disagree, because the indenter is not as smart with the cljfmt config as the real cljfmt. You could try with just stream-loop
, there and see if that changes anything, or just add an extra rule with that.
It looks like whatever I put doesn't affect formatting. Right now it aligns the "body" with bindings
(stream-loop [a b]
(body-code))
And I'd like it to be similar to let
(stream-loop [a b]
(body-code))
According to the https://github.com/weavejester/cljfmt/blob/master/docs/INDENTS.md#macro-with-bindings-and-body it should work, but it doesn't. So my assumption that for whatever reason calva doesn't see my config.It formats like in the first example on tab and newline puts cursor under first square bracket too.
Hm, turning off new indent engine and removing fqn for the symbol did the trick.
{:extra-indents {stream-loop [[:block 1]]}
:test-code
(stream-loop [a b]
asdad)}
ok, it works now. I put explicit path to cljfmt and removed fully qualified name and it worked. Structural editing checkbox seems to not make a difference.
Thank you for the help!!
It can be a pit finicky. Though I wonder why the default path setting didn’t work. Where was the file located? What’s your setting now?
it's in the root .cljfmt.edn
. I just typed that string in the settings.
OS X 12.6.2 Intel Mac.
I think the issue was that I had fully qualified name in config and it just needed a symbol. I now removed the string .cljfmt.edn
from Fmt: Config Path and it still works. Probably, I haven't reloaded it properly between some tries.