Fork me on GitHub
#shadow-cljs
<
2022-01-30
>
Christopher Genovese04:01:51

@thheller I just wanted to circle back on that weird problem I was having a couple weeks back with the odd changes in repl state because after quite a bit of detective work I've tracked down the cause. It turns out that, without my being aware of it, the clj-refactor bindings in emacs were inserting require cljs libspecs in the ns form whenever I hit / with an "new" namespace. Unfortunately, it put those in the :require-macros section rather than the :require section as it should (presumably because it was first). There were a couple of these, and when I removed them the problem went away. When I put them back, the problem returned. I don't understand why that would produce the problems I saw, but the causality seems pretty clear. Thanks again for all your help; I very much appreciate it!

👍 1
barrell11:01:05

I’m starting my app by launching a repl clj -M:shadow-cljs clj-repl then running (shadow/watch :app). I like having that repl there. What is the best way to go about adding functions to this namespace? Can I somehow provide my own namespace and just require the functions that shadow.user does and add my own?

barrell11:01:58

I’ve tried adding :nrepl {:init-ns phrasing.user} to my shadow-cljs.edn and tried adding {:repl-init-ns phrasing.user} to :builds :app :devtools

barrell11:01:00

Also tried :repl {:init-ns phrasing.user} as well

thheller12:01:58

that is not configurable but you are free to just use clj directly

thheller12:01:23

or just (require 'phrasing.user) (in-ns 'phrasing.user)

thheller12:01:38

most people use nrepl though which does support this

barrell13:01:53

I tried that with the following clojure tools alias:

:nrepl
  {:extra-deps {nrepl/nrepl {:mvn/version "0.9.0"}}
   :main-opts ["-m" "nrepl.cmdline"
               "--connect"]}}}
which loads in the user namesapce. I tried lein repl :connect and that seems to have worked! So thank you!! Do you happen to know why the clojure.tools version isn’t working?

thheller13:01:04

it would work just fine, it just isn't supported because nobody has asked for this before

thheller13:01:30

most people use an editor connected REPL and most editors use nrepl for this, so that is the default that has the most features

barrell13:01:07

ahhh when it connects it prints user> as the prompt. After the first command it prints my designated namespace

barrell13:01:14

that only costed me 3 hours 😂

barrell13:01:19

thanks so much for the help!