Fork me on GitHub
#cursive
<
2021-12-30
>
simongray16:12:38

CLJC static analysis doesn’t seem to work correctly for me now...? I have a worse example, but this should be enough (cannot resolve s in the CLJS part):

cfleming04:12:23

Yeah, the static analysis sometimes struggles with CLJC, especially around interop. I’m planning to look at this soon since CLJC is about to get more complicated with ClojureDart.

👍 2
1
simongray06:12:44

Thanks a lot, Colin.

Colin P. Hill16:12:17

Is there any way in the code style options to reformat this

(filter even?
  (range 1 10))
into this?
(filter even?
        (range 1 10))
At my company, we use cljfmt to enforce this code style in CI, and I haven't been able to figure out how to replicate it in Cursive's settings.

Jordan Robinson16:12:17

this may or may not help, but cljstyle will do that for you automatically if you set it up as a file watcher

Jordan Robinson16:12:32

problem being that cljfmt has very different rules apart from that one, so you may need to disable basically everything else

shinichy16:12:27

I use cljfmt with File Watchers plugin to format a file on save. You can build cljfmt as a native binary using GraalVM. https://plugins.jetbrains.com/plugin/7177-file-watchers

git clone 
cd cljfmt/cljfmt
lein native-image

# Check the binary
target/cljfmt check

💡 1
Colin P. Hill17:12:22

Ahh, never played with Graal and didn't think of it. I'll try that, thank you!

cfleming04:12:57

@U029J729MUP You’ll want to set the indent for filter to “Function” - see: https://cursive-ide.com/userguide/formatting.html#code-style-settings

1
cfleming04:12:03

You’ll want to do that even if you use the File Watcher workaround, because the internal formatter is used for a lot of things (e.g. where the caret goes on the new line when you press enter)

Colin P. Hill12:12:14

@U0567Q30W My issue was actually that I had this enabled (pretty sure it was the default). Took me a while to try unchecking it because it wasn't clear to me what "only indent" meant.

cfleming03:01:08

Oh, yes, that would do it. It’s not on by default, but even if you have it on you can override it for particular forms. But if you want to match cljfmt you want that off, for sure.