Fork me on GitHub
#cider
<
2019-11-11
>
etiago15:11:54

Hey everyone, maybe a beginners question but as I'm setting up CIDER, I'm wondering if I'm using it wrong 🙂 I start by triggering a cider-jack-in, then connect to it with lein, and everything works fine, but if I, for example, create a new function, I need to invoke cider-ns-reload to be able to use it (and see it in the autocompletion). When using random IDE, if I write a function, it's automatically available as part of autocompletion. Am I doing something wrong/missing some config, or is this expected behaviour because... REPL?

etiago15:11:14

Happy to be pointed in the direction of docs, blog posts, etc...

pez15:11:09

What most people do is to evaluate the function every time it has been updated. (Rather than reload the whole namespace.) Cider has a command for this. I have forgotten what it is named, but something with ”defun”.

etiago15:11:27

Possibly cider-eval-defun-at-point :thinking_face:

👍 4
etiago15:11:22

I wonder if I should bother with hooking the saving of the buffer with cider-ns-reload... In theory that would re-evaluate everything on every save, and I save frequently anyway...

pez16:11:01

I'd try without that first. Call me a control freak. 😃

😆 4
practicalli-johnny10:11:40

@UQ5NR04L9 if you have any state in your namespace then reloading will reset that state each time. Reloading the ns is a little wasteful, when all you want to do is evaluate a function definition, function call or data structure.

practicalli-johnny10:11:01

With reload on save you could easily generate errors If you are refactoring something and press save mid way through...

etiago10:11:16

State. Yuck! 😄 (I'm just kidding, I get your point 🙂 )

practicalli-johnny10:11:13

State is good until it becomes shared mutable state 😆

😆 4
practicalli-johnny10:11:24

I often evaluate the buffer if I have just opened a namespace and want all the functions in the repl

practicalli-johnny10:11:02

CIDER also highlights which function definitions have been evaluated in the repl with a mark in the fringe. This mark is removed as soon as you edit a function definition. A good way to keep track of changes

4
metal 4
etiago11:11:44

☝️ I'd never noticed this 😮 this changes everything!

practicalli-johnny11:11:52

I keep meaning to ask @U051BLM8F how to make the evaluated function mark in the fringe a bit more obvious as I find it very useful 🙂

etiago12:11:01

Absolutely! I'd overlooked this completely.

dominicm15:11:28

Yeah, expected behavior. The function didn't exist yet. The completion inspects the live environment, it isn't using static analysis.

thanks 4
michal21:11:59

hey, I'm just curious if something has been changed in cider-browse-ns or I messed with helm config too much. not so long ago I could easily find desired namespace by providing any "part" of the namespace, eg: having foo.bar.bazz ns it was enough to type bazz to find the namespace. now, I have to add a dot, like .bazz. is it how cider-browse-ns works now?