Fork me on GitHub
#cider
<
2020-03-24
>
bozhidar08:03:28

@qythium Looks reasonable to me. I don’t use/like spec, so improving the support for it has never been a priority for me.

tvaughan12:03:33

How can I set the port for cider-connect-sibling-cljs? I have already run cider-jack-in-clj and need to connect to an already running cljs repl. However, cider-connect-sibling-cljs refuses to use anything other than the same port number as the clj repl. Editing .nrepl-port was no help. And C-u also seems to have no effet

bozhidar13:03:47

@tvaughan The sibling REPL is supposed to be on the same nREPL server by definition. That’s why you can’t specify this manually.

bozhidar13:03:26

Keep in mind that in nREPL a single physical connection can host multiple logical connections (nREPL sessions).

bozhidar13:03:52

From the perspective of CIDER the cljs connection is just a different nREPL session.

bozhidar13:03:11

Therefore the sibling terminology - they run side-by-side on the same server.

tvaughan13:03:32

OK. I've misunderstood then. How do I run cider-jack-in-clj and connect to an already running cljs repl? I've tried other approaches and I always seem to lose the clj repl.

dpsutton13:03:09

i connect to a running cljs project separate from my clj backend like so for work:

dpsutton13:03:13

(defun aclaimant-jack-in-dashboard ()
    (interactive)
    (cider-connect-cljs (list :host "localhost"
                              :port 7888
                              :cljs-repl-type 'figwheel-connected
                              'project-dir "~/projects/aclaimant/acl")))

dpsutton13:03:23

i also have a shadow-cljs project here. I threw in a deps.edn file and started a clojure repl. Then shadow-cljs watch app from the command line, m-x cider-connect-cljs selected localhost, then the port for shadow and i'm up and running. I'm not seeing any issue to this workflow? Did i miss something?

tvaughan13:03:39

@U11BV7MTK This is exactly what I did. But after cider connects to the cljs repl I lose the clj repl. I can no longer evaluate clojure expressions/buffers

dpsutton13:03:04

oh. i didn't test that. sorry. let me check

dpsutton13:03:06

hmm, i'm not having any such issues

dpsutton13:03:31

but need to mention that there is a limitation that CIDER isn't aware of clj versus cljs repls in the same project. its only aware of the last repl

dpsutton13:03:56

so if you need to evaluate clojure, the last repl to have focus needs to be your clojure repl, and if you need to evaluate cljs, the last repl to have focus needs to be your cljs repl

dpsutton13:03:21

basically it asks of all the connections for the latest repl, and if its a clojure one, it thinks you don't have a cljs repl at all so things appear disconnected

bozhidar13:03:03

Actually, the problem is that when you do two separate connections you end up with independent sesman sessions, that have just one connection each.

tvaughan13:03:22

How do you "focus" the clojure repl?

dpsutton13:03:30

put the point in it

👍 4
dpsutton13:03:44

@U051BLM8F ah thanks. i've never really gotten deep into sesman. but i think the observed behavior here is the same regardless. That api needs to be opened up for us so we can track the "latest" clj and latest cljs repls

dpsutton13:03:57

I wonder if any other projects have used sesman?

dpsutton13:03:56

from this it seems like just CIDER at the moment

tvaughan13:03:55

Hmmm I can't focus the cljs repl. I can evaluate expressions in each repl directly, however, evaluating something like (js/console.log "Hi") in a .cljs file is sent to the clj repl

bozhidar13:03:43

Not our finest writing, but I think it gives a good overview of session/connection management.

tvaughan13:03:35

Yes. Especially this The current REPL is the most relevant REPL from the current session. REPL relevance is determined by the type of the current buffer.

tvaughan13:03:52

C-c C-s i only lists the clj repl session

tvaughan13:03:58

C-c C-s w lists two but the cljs session is linked to a directory path that's totally wrong

tvaughan13:03:14

I'll start over... Thanks for everyone's help!

tvaughan14:03:10

OK. It's working now. I don't know why it wasn't working. I think maybe it was because I connected to the cljs repl first using cider and then in a browser. It seems to only work if I connect to the cljs in a browser first and then using cider. I don't have to focus the repl either. Cider chooses the correct repl correctly based on the current buffer type

johnj17:03:48

curious, why does cider have 3-4 different keybindings for the same command for many commands?

johnj17:03:27

you can see them in C-h m - cider-eval-last-sexp has three for example

johnj17:03:19

C-x C-e C-c C-e C-c C-v e

dpsutton17:03:29

i have

C-c C-e         cider-eval-last-sexp
C-c C-f         cider-pprint-eval-defun-at-point
C-c C-j         cider-insert-commands-map
C-c C-k         cider-load-buffer

johnj17:03:23

yep, if you keep going down you'll see some of those have additional bindings

dpsutton17:03:14

ah i see! missed it

eval-on-point17:03:06

triples your chance of guessing right harold