Fork me on GitHub
#cider
<
2022-09-08
>
robert-stuttaford06:09:54

has anyone perhaps found a way to script with clj-refactor's jvm-side middleware? we'd love to run all our code through cljr-clean-ns on-pre-commit. wondering if anyone has done any work in this direction

borkdude07:09:08

You could also do this with the Clojure LSP binary

borkdude07:09:55

Well, then it is the LSP-organize-imports equivalent which takes into account clj-kondo

robert-stuttaford07:09:03

unfort the lsp impl doesn't do as good a job as cljr does when it comes to .cljc files

robert-stuttaford07:09:17

you're right though, that would have been ace

robert-stuttaford07:09:37

my colleague @U0HJ7CX6H will file an lsp issue about it at some point 🙂

borkdude07:09:59

You could maybe run eMacs as a binary

😁 1
robert-stuttaford07:09:34

not sure if you're joking haha

chrisetheridge07:09:28

i half considered just calling the emacs binary to do the thing 😄 clojure-lsp almost does the right thing, but struggles with namespace reader conditionals, specifically ones that don't use splicing but rather two different require sets for clj and cljs

borkdude07:09:36

I wasn't joking :)

vemv09:09:33

hi, refactor-nrepl (clj-refactor's backend) maintainer here 👋 refactor-nrepl is a vanilla clojure library which you can simply invoke however you please. https://github.com/clojure-lsp/lein-clojure-lsp and similar do a nice job as well refactor-nrepl is accurate indeed, but the formatting is a bit wacky for .cljc files. What I do in my daily workflow is run refactor-nrepl first, then a formatter of choice (I happen to use https://github.com/nedap/formatting-stack but anything will do)

vemv09:09:52

(maybe in a future refactor-nrepl will use zprint internally so nothing wacky is spat)

robert-stuttaford09:09:40

wow didn't know about formatting-stack!

chrisetheridge09:09:34

formatting-stack looks amazing! thank you @U45T93RA6

vemv10:09:10

Cheers 🍻 It's quite underpromoted (even though @UHJH8MG6S and me keep it alive), we have some finishing touches pending (like an easier CI setup)

jumar04:09:27

Thanks for sharing formatting-stack. I wanted to try it on our repo but just (require '[formatting-stack.core]) caused a huge CPU usage spike (800% for minutes until I killed the REPL)

vemv06:09:31

@U06BE1L6T probably it's the cost of running clj-kondo analysis in a project for the first time (which is done here https://github.com/nedap/formatting-stack/blob/8b0482d95d22628eeb8991d8503268b650089c17/worker/formatting_stack/background.clj)

vemv06:09:14

I always run f-s in all projects I work on / open (I have dozens of random clones, besides from work) - it doesn't have a generalized perf issue - much the opposite. Perhaps your project is particularly large?

jumar11:09:53

It's not a huge project but it is a bit larger. I simply ran (format!). How does it decide what to analyze?

vemv12:09:19

(taking this to DM to avoid further thread hijacking 🏴‍☠️)

robert-stuttaford06:09:47

first prize would be with babashka but normal jvm options are worth trying too 😄

zhuxun221:09:12

Is there a way for me to display a non-root-level error in the cider-error buffer, but without actually throwing it at the repl root level?

zhuxun221:09:48

Not sure if my question makes sense, but what I want is to nicely format an error that is caught (but not re-thrown)