Fork me on GitHub
#cider
<
2018-08-02
>
vemv05:08:21

Say I have a pretty vanilla clj (not cljs) setup with Leiningen, clojure.test and the 'reloaded' workflow (in some or other variation). I put test in :source-paths so I can interact with the tests as I develop them (completions, jump-to-def, etc). The test namespaces aren't required anywhere - as we know there isn't a big file where all tests are listed. But now, when I visit a given test ns with CIDER, there are no interactive features until you require that ns. Sometimes, I think I have to go one step beyond and M-x cider-load-buffer. Is this a common problem? What would be a solid solution? Currently I piled up some hacks to do this requiring and loading, but that's not integrated with 'reloaded' at all (it loads individual ns's on demand, instead of refreshing the test dir cleanly and as a whole). Maybe the solution I seek is outside CIDER/Emacs? i.e. have a clever function that lists all ns's in the test dir and requires them dynamically.

plexus12:08:18

Not sure if this has been asked yet, I use jump-to-definition quite a lot, and with the sesman changes when it jumps to a third party library the buffer I end up in ends up not having a sesman link, and I need to do a sesman-link-directory or similar before anything cider related works (including jump-to-definition from there). Would it be possible to automatically link these buffers to the session I navigated from?

jumar20:08:55

@plexus not ideal, but just evaling the buffer should work.

plexus12:08:16

in general I'd really like to have the old behavior back of just using whatever connection it finds, especially if there's only one. (yes I know this makes me sound like this: https://xkcd.com/1172/)

vemv14:08:05

You always can use a cider git submodule pinned to a specific version (cider itself will load fine like that, but clj-refactor will need to have its package-requires altered to avoid downloading cider again)

bozhidar12:08:25

@vemv I think a very long time I changed this and made CIDER eval the ns form automatically if you try to eval something before it. But the fact remains that normally the first thing you should do when interacting with a buffer is to eval it. Not sure what exactly is so problematic with this, though. You don’t want to have to require tests manually?

bozhidar13:08:06

@plexus Vitalie is not active here, so it’s best to just file tickets on the sesman issue tracker. I never change code in third party libs (I normally just read it), so this didn’t look like a problem to me before you brought it up. Probably those temp buffers should just be auto-associated with the current session. I think Vitalie would agree that’s a good approach.

bozhidar13:08:53

And yeah - maybe we should add a mode to funnel everything unliked to a predefined connection. I think he’d agree this makes sense as well.

vemv14:08:06

> first thing you should do when interacting with a buffer is to eval it. Not sure what exactly is so problematic with this It's simply a manual step (though automatable), and one that I don't have to perform with regular source code - just with tests. plus this manually-evaled buffer can get out of date. None of these happen with regular src code (as opposed to tests), thanks to the 'reloaded' workflow

vemv14:08:11

> You don’t want to have to require tests manually? As in, creating a big 'requires' file? It's a possibility but it seems tedious and controversial (particularly for Cursive users who don't want to see the project poulluted due to emacs-isms)

richiardiandrea14:08:01

I usually use a user.clj file for that or just go to the buffer I want to test and require it before inspection.

richiardiandrea14:08:33

Cider does not do much static analysis

richiardiandrea14:08:45

Probably something that lists and autorequires tests in test could be added but I don't think it is there at the moment

👍 4
bozhidar17:08:23

> in general I’d really like to have the old behavior back of just using whatever connection it finds, especially if there’s only one. (yes I know this makes me sound like this: https://xkcd.com/1172/)

8
bozhidar17:08:28

So true! 😄

bozhidar17:08:54

> Maybe the solution I seek is outside CIDER/Emacs? i.e. have a clever function that lists all ns’s in the test dir and requires them dynamically. (edited)

bozhidar17:08:41

@vemv Btw, there a few functions even now to load all namespaces within a project. Implementing some eval-on-visit functionality would be trivial, but there’s always the problem with namespaces which will produce side-effects when evaluated.

bozhidar17:08:27

And for a very long time I was thinking of adding some small indicator showing that some ns is out of sync with the code in the source file. If only I had time to pursue all those cool ideas.

❤️ 4
vemv17:08:33

Gotchu! Thanks for the support 🙌 I guess that historically there hasn't been a canonical solution for this problem, which is what I was most curious about

bozhidar17:08:05

That’s an opportunity to create one. 😉

bozhidar17:08:35

I guess my problem is that I’m so used to the default workflow that for me it’s hard to see fundamental problems with it.

👍 8
dominicm18:08:39

So much to do, and so little time.

bhauman19:08:13

I updated figwheel.main to support nrepl/nrepl

✌️ 12
8
parrot 20
bhauman19:08:28

currently working on lein-figwheel