cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
Alexis Vincent 2021-04-28T00:03:04.380900Z

bozhidar 2021-04-28T08:56:17.387200Z

I have some memory that dynapath was breaking this. You might try disabling it as documented here.

Alexis Vincent 2021-04-28T00:03:46.381500Z

@bozhidar Any chance I can get you to weigh in on ^

2021-04-28T05:18:39.386700Z

Some problem with eval defun functionality. In some namespaces I can’t properly do repl based development as CIDER doesn’t seem to “see” anything I have declared and loaded already. Evaling the buffer works fine, but as soon as I eval region or defun, it doesn’t see things in the same namespace. I turned nrepl logging on and I see for the working one

(-->
  id                             "28"
  op                             "eval"
  session                        "375f7ae0-c60a-417a-a9d8-cc4b9e442d65"
  time-stamp                     "2021-04-28 08:09:47.045094000"
  code                           "(defn oracle-db-config [config]
  (if
    (common.env/dev-mo..."
  column                         1
  file                           "/Users/matti.uusitalo/projektit/allu/valvira-allu-konversio/..."
  line                           28
  nrepl.middleware.print/print   "cider.nrepl.pprint/pr"
  nrepl.middleware.print/quota   1048576
  nrepl.middleware.print/stream? nil
  ns                             #("konversio.db" 0 12 (fontified t help-echo cider--help-echo cider-locals nil cider-block-dynamic-font-lock t face font-lock-type-face))
)
but for the ones not working I get
(-->
  id                             "30"
  op                             "eval"
  session                        "375f7ae0-c60a-417a-a9d8-cc4b9e442d65"
  time-stamp                     "2021-04-28 08:10:12.564574000"
  code                           "(defn next-lupanumero [target-db used-numbers licence-type]
  (loop [candidate nil]
    (if-not (or (nil? candidate) (used-numbers candidate))
      candidate
      (recur
       (format
        \"%s%06d\"
        licence-type
        (:nextval (db/query target-db (format \"SELECT nextval('rekisteri.licence-number-%s\" licence-type))))))))
"
  column                         1
  file                           "/Users/matti.uusitalo/projektit/allu/valvira-allu-konversio/..."
  line                           15
  nrepl.middleware.print/print   "cider.nrepl.pprint/pr"
  nrepl.middleware.print/quota   1048576
  nrepl.middleware.print/stream? nil
  ns                             "user"
)
So it looks like it doesn’t understand the namespace correctly, as the ‘ns’ identifier points to “user” in the non-working namespace. The files are both in the same project and folder. What could cause CIDER to get confused about the namespace like this?

bozhidar 2021-04-28T08:57:40.387700Z

I think that's a known bug and it's actually in clojure-mode, but as it was pretty rare I didn't pay it much attention.

2021-04-29T05:21:15.404700Z

My apologies. I misinterpreted it to being cider-related. I was navigating the code in Emacs and didn’t realize i’d switched to a different package. I reported an issue about it to Cider repo yesterday. https://github.com/clojure-emacs/cider/issues/3009 I just close the issue then. Sorry for extra hassle.

2021-04-28T05:22:06.386800Z

(cider-current-ns) seems to return the wrong namespace for the non working ones. It returns “user”

2021-04-28T05:29:48.387Z

I figured this out. I had a space before the ns declaration. Cider doesn’t find the namespace declaration in that case

2021-04-28T21:29:31.404Z

Given a project that 1. starts both a server 2. and manages the frontend cljs code 3. has a cljc code i'm not sure of how to achieve the common goal of being able to evaluate expression for both context (clj & cljs) forms. Here is the project in question https://github.com/drewverlee/garlic I'm guessing these cider docs contain most of the information I need https://docs.cider.mx/cider/usage/managing_connections.html. It seems likely that I want to somehow group files by FrontEnd (FE) and BackendEnd (BE) code. What does cider consider a "project?" I have always thought it looks at the directory with the .git folder. How are .cljc files treated? is it dependent on the context? As in i should put them in their own library and import them into the FE or BE project? If i do split the project, then I assume it would be just a matter of running `cider-jack-in-(clj or cljs)`  respectively. Alternatively, is there a way to keep clj and cljs in the same files and use cider-jack-in-clj&cljs? the backend code is responsible for starting a webserver: servering assets, responding to api calls, etc... The front end code, if i understand figwheel-main correctly, needs to either launch a new (or should it be sibling) nrepl server, with piggieback middleware (because i can't run cider-jack-in here). What I have tried is firstly (different from the github link) to temporarly  moving all my alias deps to :deps

com.bhauman/figwheel-main {:mvn/version "0.2.11"}
         cider/piggieback          {:mvn/version "0.5.1"}
         org.clojure/clojurescript {:mvn/version "1.10.764"}
to avoid extra complications with alias and my .dir-locals.el as i'm worried this second clojurescript-mode expression isn't valid
(
 (clojure-mode . ((cider-clojure-cli-aliases . "-A:cljs")))
 (clojurescript-mode . ((cider-clojure-cli-aliases . "-A:fig")))
 )
Then 1. cider-jack-in-clj, correctly starts nrepl clj server. then starting my server. 2. cider-connect-sibling which produces another Nrepl buffer. However trying to evaluate anything results in a "nrepl-send-sync-request: sync nREPL request timed out). At this point i feel my further guesses would be somewhat random and i'm hoping someone can give advice.

tvaughan 2021-04-29T14:24:42.428900Z

We have a backend in clojure and frontend in clojurescript in one repo with a lot of shared cljc source code between the two. The frontend has its own alias in deps.edn, but otherwise there's no separation between the two. I use jack-in to start a clojure repl, and connect to a running cljs repl started by shadow-cljs. Cider uses the "most recent" repl when evaluating buffers or s-expressions where "most recent" is whichever had focus most recently.

2021-04-29T15:36:05.429200Z

thanks. cider-jack-in-clj&cljs unfortanltly doesn't just work.

2021-04-29T15:36:25.429400Z

hopefully looking at this fresh today makes it clear

2021-04-28T21:33:21.404600Z

i guess my next step is breaking the project into two projects and see if that just works.