Fork me on GitHub
#cider
<
2022-10-08
>
oskarkv16:10:44

I have a problem with CIDER and Shadow-CLJS. Don't know what's wrong. Maybe it's not CIDER's fault. The problem is that evaluating with cider-eval-defun-at-point or cider-load-buffer sometimes doesn't work. Then it starts working for no apparent reason, only to stop working again soon after. I recorded a gif of the problem. If you look at the minibuffer, when it says Loading <file>... is when cider-load-buffer is not working, and when it says SPC e t is when cider-eval-defun-at-point is not working. When it says => something it is working. For some reason switching buffer to the REPL and back seems to make it work. Any ideas? EDIT: Oh, now I noticed that cider-swich-to-repl-buffer changes the repl type from cljs:shadow to clj, but when I type something in the repl it becomes a cljs:shadow repl again. And while it's a clj repl evaling doesn't work. Still, it is annoying.

ahungry17:10:02

Howdy all - I seem to remember on old lein projects, on jack-in I would end up with a user.clj file that was evaluated, or at the very least, the initial file I jacked in on would be loaded into the running cider repl session. I've built up a project from deps.edn, and that doesn't seem to be the case - how do I force loading of some files on initial cider connection? I'm feeling like it may be somewhat defined here https://docs.cider.mx/cider/config/project_config.html - with one of the clj flags

vemv17:10:42

say you have user.clj in a dev dir as usual. then dev should be in your deps.edn :paths (for a :dev alias or however you want to name it) and then make sure you activate that alias in cider

thanks3 1
ahungry18:10:50

it's loadable via manual measures, or with a fn like:

(defun my-cider-connected-hook ()
  (interactive)
  (cider-switch-to-last-clojure-buffer)
  (cider-load-buffer)
  (cider-repl-set-ns (cider-current-ns))
  (cider-switch-to-repl-buffer))
but it seems weird it doesn't load anything by default and I have to force the load

vemv19:10:58

it's the :paths thing for sure, cider generally won't load code that isn't in your classpath (which is the correct behavior!)

thanks3 1
ahungry23:10:34

Another QQ - when using .dir-locals.el, I want to let the cljs jack-in action know what REPL type so I don't have to choose 'figwheel-main', and subsequently 'dev' (env) at the REPL - what var would this be? I thought it was going to be:

(cider-cljs-repl-type . figwheel-main)
                        (eval . (cider-register-cljs-repl-type 'figwheel-main "(do (require 'figwheel.main) (figwheel.main/start :dev))"))
but that didn't seem to work out - I think the latter line may not even be correct (adjusted from cider doc page, but it seems more like maybe to define a brand new repl type)

rolt06:10:57

i have this config for shadow:

((nil . ((cider-default-cljs-repl . shadow)
         (cider-shadow-default-options . ":dev")
         (cider-offer-to-open-cljs-app-in-browser . nil)
         (cider-preferred-build-tool . shadow-cljs))))

thanks3 2