This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (14)
- # beginners (133)
- # cider (27)
- # cljs-dev (7)
- # cljsjs (13)
- # clojure (105)
- # clojure-dev (58)
- # clojure-italy (1)
- # clojure-nl (17)
- # clojure-russia (33)
- # clojure-spec (5)
- # clojure-uk (154)
- # clojured (1)
- # clojurescript (35)
- # cloverage (4)
- # cursive (35)
- # datomic (58)
- # duct (8)
- # editors (9)
- # emacs (15)
- # events (1)
- # figwheel (47)
- # figwheel-main (132)
- # hyperfiddle (5)
- # immutant (29)
- # instaparse (21)
- # luminus (3)
- # off-topic (5)
- # onyx (5)
- # overtone (5)
- # pedestal (8)
- # re-frame (7)
- # reagent (6)
- # reitit (3)
- # schema (2)
- # shadow-cljs (178)
- # spacemacs (49)
- # specter (2)
- # sql (1)
- # tools-deps (110)
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
: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
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.
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?
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/)
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)
@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?
@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.
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.
> 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
> 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)
I usually use a
user.clj file for that or just go to the buffer I want to test and require it before inspection.
Probably something that lists and autorequires tests in
test could be added but I don't think it is there at the moment
> 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/)
> 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)
@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.
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.
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
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.