Fork me on GitHub
#cider
<
2017-03-31
>
jumar10:03:49

is there a way to navigate to java source code for classes in clojure.lang, e.g. clojure.lang.PersistentVector? I tried cider-find-var but it gives me "no source location" Note: I'm using spacemacs and I've already installed eclim as mentioned here: https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Blang/java#eclim

benedek10:03:58

M-. should just work

benedek10:03:05

no idea what that is in spacemacs tho

jumar11:03:36

the thing is that it works for Java classes like java.util.List but not for "Clojure java classes" like clojure.lang.PersistentVector

cpmcdaniel15:03:50

was there a tremendous increase in the memory footprint of cider-nrepl between 0.10 and 0.15?

cpmcdaniel15:03:17

I used to be able to cider-jack-in my project with 128M max heap. Not anymore.

dpsutton16:03:59

@cpmcdaniel this is on the same project that has no changes? ie project under 0.10 is fine and under 0.15 can't start up with no changes?

cpmcdaniel16:03:23

yeah, other folks on my project are running an older version of cider without OOMs

cpmcdaniel16:03:06

er, at least one other… folk

cpmcdaniel16:03:49

basically, the repl starts up, but once I eval a buffer or expression, it crashes and heap dumps

dpsutton16:03:55

i'm not sure. if you can hook up a profiler an issue with that info would be very helpful

cpmcdaniel16:03:20

I looked at the heapdump with some tools

dpsutton16:03:35

any indication?

cpmcdaniel16:03:12

nothing suspicious looking from our own namespaces, but lots (tons) of Var instances from threads with nrepl-refactor in the stack

cpmcdaniel16:03:36

that was about the only thing I could glean from it

dpsutton16:03:48

you could raise an issue with nrepl-refactor

dpsutton16:03:57

i can totally see that growing in size as it grows in features

pesterhazy16:03:39

You could probably remove nrepl-refactor?

cpmcdaniel16:03:19

@pesterhazy was that directed at me?

cpmcdaniel16:03:48

cider now adds the deps inline, correct?

cpmcdaniel16:03:58

with jack-in, anyway

cpmcdaniel16:03:28

(using the clojure layer in spacemacs, fyi)

pesterhazy16:03:59

ah. What I do is to start the repl in a terminal and then use cider-connect

pesterhazy16:03:20

gives me more of a feeling of control

cpmcdaniel16:03:03

yeah, but then don’t you have to put the cider-nrepl plugin version in your lein profile?

cpmcdaniel16:03:22

otherwise you don’t get the full functionality of cider

pesterhazy16:03:30

right it's there, but not the refactor one

pesterhazy16:03:08

btw, perhaps someday soon unrepl may offer a lighter weight repl connection

cpmcdaniel16:03:56

so cider-jack-in avoids the profile setup by injecting deps right on the lein cli

cpmcdaniel16:03:04

which I really like

pesterhazy16:03:35

right, that's neat

cpmcdaniel16:03:41

makes it easy to keep the versions in sync when I update cider

pesterhazy16:03:59

unrepl will do that too

pesterhazy16:03:21

"inject" all it needs into the jvm process

dpsutton16:03:54

i think this actually happens in clj refactor

dpsutton16:03:56

(defun cljr--inject-jack-in-dependencies ()
      "Inject the REPL dependencies of clj-refactor at `cider-jack-in'.
    If injecting the dependencies is not preferred set `cljr-inject-dependencies-at-jack-in' to nil."
      (when (and cljr-inject-dependencies-at-jack-in
                 (boundp 'cider-jack-in-lein-plugins)
                 (boundp 'cider-jack-in-nrepl-middlewares))
        (add-to-list 'cider-jack-in-lein-plugins `("refactor-nrepl" ,(cljr--version t)))
        (add-to-list 'cider-jack-in-nrepl-middlewares "refactor-nrepl.middleware/wrap-refactor")))

dpsutton16:03:47

ie, i think if you just uninstall clj refactor it will prohibit clj refactor from injecting itself

dpsutton16:03:56

it seems like it just throws itself in there

dpsutton16:03:20

so in your dir-locals, maybe set cljr-inject-dep... to nil?

cpmcdaniel16:03:51

well, this is how it actually launches lein...

dpsutton16:03:20

;;;###autoload
(defun cljr--inject-jack-in-dependencies ()
  "Inject the REPL dependencies of clj-refactor at `cider-jack-in'.
If injecting the dependencies is not preferred set `cljr-inject-dependencies-at-jack-in' to nil."
  (when (and cljr-inject-dependencies-at-jack-in
             (boundp 'cider-jack-in-lein-plugins)
             (boundp 'cider-jack-in-nrepl-middlewares))
    (add-to-list 'cider-jack-in-lein-plugins `("refactor-nrepl" ,(cljr--version t)))
    (add-to-list 'cider-jack-in-nrepl-middlewares "refactor-nrepl.middleware/wrap-refactor")))

;;;###autoload
(eval-after-load 'cider
  '(cljr--inject-jack-in-dependencies))

dpsutton16:03:38

this is from clj-refactor. This looks like if you uninstall it it won't inject itself

dpsutton16:03:49

does that make sense?

dpsutton16:03:44

or, use a dir-locals file to set cljr-inject-dependencies-at-jack-in to nil to prevent this from executing the (add-to-list lein-plugins refactor-nrepl...

dpsutton17:03:11

and c-h v [ret] cider-jack-in-lein-plugins will show you the current value, which appears to be set by clj refactor

dpsutton17:03:36

cider-jack-in-lein-plugins is a variable defined in ‘cider.el’.
Its value is (("refactor-nrepl" "2.3.0-SNAPSHOT")
 ("cider/cider-nrepl" "0.15.0-SNAPSHOT"))


  This variable may be risky if used as a file-local variable.

Documentation:
List of Leiningen plugins where elements are lists of artifact name and version.
hmm. ha. "This variable may be risky if used as a file-local variable" that's not good 🙂

cpmcdaniel17:03:39

anyone have general thoughts on nrepl-refactor? I can’t even say for sure if I’m using any of it’s features...

dpsutton17:03:27

i never think to use it, but i'm not full time in clojure. I'll bet that if i was i would use it. That being said, if it's causing problems and you don't use it, toss it

dpsutton17:03:47

but you can put a dev profile in there to raise your jvm heap which won't affect production

cpmcdaniel17:03:05

well, I bumped my heap to 256M, which is still reasonably small, and all is well

dpsutton17:03:12

sounds good

cpmcdaniel17:03:19

also, confirmed another co-worker of mine ran into the same problem

cpmcdaniel17:03:44

we were probably near the 128M ceiling before nrepl-refactor was a thing

cpmcdaniel17:03:05

or at least in the ~100M ballpark

cpmcdaniel17:03:21

looks like nrepl-refactor does some useful things

cpmcdaniel17:03:30

I will keep it for now and try some of its features

cpmcdaniel17:03:47

like cleaning up ns clauses