Fork me on GitHub
#cider
<
2022-04-06
>
Carlo17:04:04

what kind of object is:

(cider-nrepl-sync-request:eval "123")
in elisp? If I do
(defun simple ()
  (interactive)
  (message (pp (type (cider-nrepl-sync-request:eval "123")))))
I get:
(dict "status"
      ("done")
      "id" "3009" "ns" "couperin.core" "session" "541d57ee-8fe0-4bd5-8b98-8e4dc145edc9" "value" "123")
that seems a dictionary, is it only a list instead? How would I retrieve the "value"?

dpsutton17:04:27

its a an nrepl-dictionary

🙌 1
Carlo17:04:56

nrepl-dict-get is probably what I want then

dpsutton17:04:57

check out the file nrepl-dict.el

Carlo17:04:34

what would have been the way of knowing that that was an nrepl-dictionary ? Is there a type function of some sort?

dpsutton17:04:38

look for uses of defmacro nrepl-dbind-response which is the normal way to “destructure” from it

dpsutton17:04:53

(defun nrepl-dict (&rest key-vals)
  "Create nREPL dict from KEY-VALS."
  (cons 'dict key-vals))

dpsutton17:04:08

you can see its just a cons of the symbol 'dict with the keys and vals

paulspencerwilliams17:04:12

My minimal cider install hands Emacs displaying 'Can't find instrumented sexp, did you edit the source?' if I ever use here / h when debugging. I've replicated this on several work projects and just in a toy application. What am I doing wrong? Other debugging works fine. My entire Cider config is

(use-package cider
  :ensure t
  :config
  (setq clojure-toplevel-inside-comment-form t)
  (setq cider-save-file-on-load t)
  (setq cider-repl-pop-to-buffer-on-connect nil))
I'm on Cider <tel:202204051216|20220405.1216>, Clojure CLI version 1.11.0.1100, and Java openjdk version "17.0.2" 2022-01-18. However, as this happens on two machines, it doesn't seem config nor version dependent...

jmckitrick19:04:10

Where do I tweak JVM settings for CIDER?

jmckitrick19:04:15

I’m suddenly getting OOM errors

dpsutton19:04:18

kinda depends. CIDER is gonna just launch your program with lein or the clojure cli. So you could put the settings there or behind an alias and just make sure to use that alias

jmckitrick19:04:55

Sorry, I should have clarified. I’m connecting to a process running via clj on the command line. But I believe CIDER spins up a separate JVM, correct?

dpsutton19:04:04

nope. all in process

dpsutton19:04:08

it uses your process

jmckitrick19:04:32

Hmm, ok. No one else is having this issue but me, so as the sole user of CIDER, I’m assuming that’s my problem.

dpsutton19:04:39

cider-jack-in will make sure to start the process with an nrepl server running with cider’s middleware

dpsutton19:04:53

give yourself more memory

dpsutton19:04:14

if the stacktraces have something actionable, raise an issue if that part of CIDER can use less memory

jmckitrick19:04:35

ok… I’ll throw memory at it as a last resort if I can’t narrow it down. But yes, I’ll try that first.

dpsutton19:04:32

we had an OOM stacktrace recently that showed it was using too much memory in the stacktrace annotation bit. If you can recognize something like that it would be helpful

dpsutton19:04:15

see the stacktrace here. And if it’s easy to scroll up to it you can see our proposed solutions.

jmckitrick19:04:07

Oh, I see. Someone else had the same issue recently. Ok, I’ll just bump up those numbers. I just hate to do it for the entire project and team when I’m the only one that needs it.

dpsutton19:04:21

put it an alias you control in your local deps

jmckitrick19:04:26

It’s only the dev alias, so…

dpsutton19:04:39

also, try to redefine the function that OOM’d with my proposed fix and see if it solves it

jmckitrick19:04:42

Hmm, I could do that as well.

jmckitrick19:04:37

Sorry, I’m just being lazy, lol. I hate getting sidetracked while trying to solve a big issue

dpsutton19:04:41

(clojure.repl/apropos "flag_duplicates") and find which namespace its in

jmckitrick19:04:48

ok, time to read about tools/deps aliases.

jmckitrick19:04:00

Looks like I just need that simple file in my home directory.

dpsutton19:04:09

yeah. add :memory {:jvm-options ["-Xmx8g"]} to .clojure/deps.edn and then use the :memory alias when starting your process

dpsutton19:04:18

(add that to the aliases map

jmckitrick20:04:44

Oh, this is sweet… clojure -M:dev:memory

jmckitrick20:04:25

Let’s see if it does the trick…. anyway, I’m on the right track. Thanks for your help, @dpsutton!

dpsutton20:04:24

of course. happy hacking