Fork me on GitHub
#conjure
<
2021-03-13
>
stopa00:03:53

Hey team! Quick question: what plugin do ya’ll use to autoformat your code? (Playing around with conjure and neovim now!)

4
berkeleytrue00:03:20

I'd like to know that too. Having recently used HIndent for haskell and trying prettier for js, it kinda is a dream not to have to worry about format. Let the machine do the work.

❤️ 4
dharrigan06:03:36

I use parinfer-rust and clojure-vim/clojure

nbardiuk14:03:07

our team is using cljfmt, through calva and vim-iced But it is not hard to setup without a plugin: * in vimrc nmap <leader>f :!clj -M:cljfmt %<CR> * in deps.edn {:aliases {:cljfmt {:extra-deps {cljfmt/cljfmt {:mvn/version "0.7.0"}} :main-opts ["-m" "cljfmt.main" "fix"]}}}

❤️ 3
nbardiuk15:03:54

turns out nrepl has format middleware that uses cljfmt, maybe it can be used in conjure https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/format.clj ?

Olical15:03:29

I want to add support for the newer nREPL 0.8 operations + refactor/debug/format tools in CIDER (when they're present) but time. If anyone wants to have a go at contributing these things (wouldn't be too hard for some of them!) I'd be happy to review / guide / carry PRs across the line

Olical15:03:14

There's a LOT of untapped power in CIDER right now, low hanging fruit in some cases. Although things like a stepping debugger (anything stateful) will require some UI / UX work that I'll try to handle since I have a bigger view of the system.

Olical15:03:14

Formatting should be a case of * extract form under cursor * send off to CIDER * replace form range with result All of which have prior art in Conjure and Fennel modules / functions dedicated to performing this extraction / replacement in a buffer. It's how <prefix>e! works after all.

❤️ 6
Olical15:03:38

I actually format data sometimes by just running <prefix>e! on it since the source data gets replaced by a pretty printed version

😮 9
Olical15:03:56

My personal motivation for formatting is quite low since I've never relied on one for Clojure in years of professional development with it. No single formatting tool ever sat with me as "perfect", but I know for some teams it's a great thing to have as common ground. Not opposed to the idea, just not super driven to solve it right now, personally. Just some context 🙂

6
Olical15:03:34

If there's no relevant issue on the repo, feel free to open one so we have something to track

stopa17:03:43

Thanks for the deep responses team! I solved this for now, by using coc + clojure-lsp alongside conjure. Will look around gh and make an issue that notes the conversation above, as a someday/maybe.

🎉 3