Fork me on GitHub

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?


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


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”.


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

👍 4

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...


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

😆 4

@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.


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


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


State is good until it becomes shared mutable state 😆

😆 4

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


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

metal 4

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


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 🙂


Absolutely! I'd overlooked this completely.


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

thanks 4

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 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?