Fork me on GitHub
#cider
<
2017-07-06
>
deg08:07:35

I'm playing with a style where I use pre/post conditions heavily in my Clojure code. I like it a lot so far, but my source files are more cluttered. Is there a cider setting or mode or hack somewhere that will customize the fontification of the {:pre ... :post ...} map in each defn?

a1308:07:25

@deg there's no simple solution afaics, since function metadata are fontified the same way as the rest of the code

robert-stuttaford10:07:13

why does cider colour :cljs branches of reader conditionals as comments, but :clj branches retain full syntax colouring? can i stop this?

a1310:07:42

(defface cider-reader-conditional-face
  '((t (:inherit font-lock-comment-face)))
  "Face used to mark unused reader conditional expressions."
  :group 'cider
  :package-version '(cider . "0.15.0"))

a1310:07:52

"An unused reader conditional expression is an expression for a platform that does not match the CIDER connection for the buffer."

a1310:07:48

so you can try to customize cider-reader-conditional-face so it don't inherits fl-comment-face

robert-stuttaford10:07:56

so if i had a cljs repl connected somehow, then it’d show me the other path?

a1310:07:09

I think it should 🙂

robert-stuttaford10:07:33

ok. i’m one of those unfortunate souls who never got cljs repls right. i wonder how i might stop it from doing this

robert-stuttaford10:07:01

it’s a very nice facility for those who can eat their cake, and have it, too, though 🙂

a1310:07:06

a I said before, try to remove all customizations from cider-reader-conditional-face

a1310:07:26

M-x customize-face RET cider-reader-conditional-face

robert-stuttaford10:07:40

well that was easy

robert-stuttaford10:07:45

untick the checkbox, apply and save

a1311:07:02

Welcome! is it working as expected now?

robert-stuttaford11:07:30

well, actually, not perfectly

robert-stuttaford11:07:09

that’s with (custom-set-faces '(cider-reader-conditional-face ((t nil))))

robert-stuttaford11:07:37

but it’s still better than solid green 🙂

robert-stuttaford11:07:23

wow, you’re a wizard, that works!

a1311:07:13

I got it!

a1311:07:23

(setq cider-font-lock-reader-conditionals nil)
is all you need 🙂

a1311:07:09

no hacks, no function redefs anymore ;; removed all hacky stuff not to confuse people

dominicm14:07:32

@featheredtoast your problem can be fixed by applying the patch from TNS-45 to tns. It might make sense for Cider to use metosin's fork for refreshing, temporarily. It makes sense for CIDER to adopt it despite Stu's concerns as cider only cares about reloading. Be interested if there would be an actual issue with that for CIDER.

juhoteperi14:07:10

I'm not using the fork myself anymore

dominicm15:07:11

@juhoteperi what do you do now?

juhoteperi15:07:46

@dominicm I make sure Cljs output is not in classpath, and I serve it from filesystem instead

featheredtoast16:07:04

I've been tinkering with the same methodology in the last day actually, and it works fine as is. Have a dev flag for routes that serves cljs + assets from a non-classpath directory during development, and compiles minified js into classpath, and serve from there when packaging via uberjar.

dominicm16:07:08

We always forget to do it 😛

featheredtoast16:07:07

it's not terrible to do in lein; I'm hoping that boot's able to do similar. Definitely a "best" vs "common" practice conflict.

juhoteperi17:07:50

It is possible to do with Boot built in tasks: https://github.com/Deraen/saapas/commit/2947fd02ed5096c6004ad0b973a31a746d8a3803 not very clean but works

juhoteperi17:07:15

Boot-cljs by default adds the files to classpath, which is a bit unfortunate