Fork me on GitHub

Has anyone successfully setup jump to definition from clojure to Java?


Yes. Not with decompilation though.


You just need sources on the classpath


The hard part I’ve run into is automatically downloading sources, and adding them to the classpath


There's a lein plugin kicking around


Do you remember it’s name? I’d love to have this in plugin form.


It was on an issue on github for either cider / cider-nrepl.


the plugin was hosted on gitlab


worked out of the box with vim, so should also work for emacs


You commented on that issue, so maybe it didn't work for you 🙂 but maybe you missed, dunno


Thanks, I'll look into that


Has anyone worked on decompilers?


And synchronizing the classpath with something like lsp-java?


(and, possibly, decompilation of class files if the source isn't available)


@macrobartfast how are you starting your cljs project?


I start it with

lein repl


then switch to emacs, and then


followed by, in the repl that appears in emacs


(use 'figwheel-sidecar.repl-api)




at that point, the site appears, and reflects changes to the code, but, cider-eval-defun-at-point for any :require produces a class not found exception or the equivalent.



Unable to resolve symbol: + in this context


ok. you still have a clojure repl. you need to start a clojurescript repl. can you try cider-jack-in-clojurescript and select figwheel as your repl type?


but to do this you'll need to have figwheel sidecar in your deps


do you have cider-nrepl in your deps so lein repl includes it?


i'm wondering if there's any CIDER stuff at all


hmm... I've found all the figwheel stuff commented out...


the project was the result of

lein new app test -- --reagent"


I could have also done

lein new reagent test
which is something I'm not clear on.


so I'll uncomment the figwheel stuff and see what happens.


have you read the figwheel docs to see what is required?


I tried to read them... it has become very confusing as there seem to be quite a few variations on how to go about it.


and shadow-cljs has only made it more complex for me.


right now though, I'm regenerating a project with

lein new reagent test
as opposed to
lein new app test -- --reagent
and will see if the problem persists.


well, generating a project with

lein new reagent testtwo
then starting a repl with
lein repl
and connecting to it from emacs via
and then, in the emacs repl,
(use 'figwheel-sidecar.repl-api)
followed by
allows me to evaluate
(+ 1 1)
from a cljs buffer, but any eval of a namespace declaration with a :require such as
(ns testtwo.core
   [reagent.core :as reagent :refer [atom]]
   [reagent.session :as session]
   [reitit.frontend :as reitit]
   [clerk.core :as clerk]
   [accountant.core :as accountant]))
in this case produces an
Unhandled java.lang.IllegalAccessError
   atom does not exist
error and commenting that out causes the same error to be thrown on the reagent.session :require and so on right down the line.


I'm guessing this has something to do with my needing a cljs repl instead of a clj one, or something, as my buffer is a cljs one, but dunno.


yeah. you're just starting a clojure repl. lein-figwheel is a bit old. are you sure you can't try out shadow?


I can and should.


cool. i think you'll have a better time with that


and if you configure it in a standard way you can just run cider-jack-in-cljs and it will all work


ok. I'm super afraid of the shadow-cljs learning curve.


You really shouldn't be! It's as straightforward as the alternatives, and brings some very nice things to the table if you rely on npm libs.


and I'll try cider-jack-in-cljs now.


It’s far smaller than lein figwheel


And suggestion. Get it running where you have a repl from the command line and only then try putting CIDER in


just a sanity check, first... I assume I'll be able to evaluate forms from within a buffer in emacs as per usual when I use shadow-cljs in my pipeline, right?


I guess that is the role of cider, which seems to still play well with shadow-cljs.


yes. get your project working from the command line first though


but you'll be able to evaluate in line in the buffer, have a repl in emacs, all the goodies


is it possible to change the indentation of vectors to match the following requirements:

(defrecord Valores [])

[Valores (= 1 1)
 (= 2 2)
 (= 2 3)]

[Valores (= 1 1)
         (= 2 2)
         (= 2 3)]


As mentoined here, I'm trying to setup rebl with cider. I managed to make it work with plain lein repl but not with a complete cider setup. It fails when starting the repl:

[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.5.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.22.3\"\] -- repl :headless :host localhost

Error loading nrebl.middleware: Syntax error compiling at (nrebl/middleware.clj:1:1).
Syntax error compiling var at (/private/var/folders/hn/tgwyrdmj1tb5pmmbdkd1g_qc0000gn/T/form-init8412568572949758697.clj:1:10031).
Unable to resolve var: nrebl.middleware/wrap-nrebl in this context

When I manually edit the start command to just lein repl then it works (but obviously cider repl is sort of broken)


Is this a known limitation or is there a way how to make REBL work with cider?


I thought nrebl was the way, but I’ve never tested it.


I’m guessing you also have to add this to your list of plugins/middleware for it to be loaded properly (unless it’s set up in your project.clj).


I added it to my ~/.lein/profiles.clj as mentioned in the linked thread. Here's the current version (minus lot of other stuff):


  :dependencies [

                 ;; REBL
                 [rickmoynihan/nrebl.middleware "0.3.1"] ;; set this to the latest nrebl version
                 [org.clojure/core.async "0.4.500"]
                 ;; to support java 11: 
                 ;;    or rather 
                 [org.openjfx/javafx-fxml "11.0.1"]
                 [org.openjfx/javafx-controls "11.0.1"]
                 [org.openjfx/javafx-graphics "11.0.1"]
                 [org.openjfx/javafx-media "11.0.1"]
                 [org.openjfx/javafx-swing "11.0.1"]
                 [org.openjfx/javafx-base "11.0.1"]
                 [org.openjfx/javafx-web "11.0.1"]
                 ;; downloaded to "/Users/jumar/tools/clojure/rebl/REBL-0.9.220/REBL-0.9.220.jar"
                 ;; and installed to the local maven repo:
                 ;;   mvn install:install-file -Dfile=REBL-0.9.220.jar -DgroupId=com.cognitect -DartifactId=rebl -Dversion=0.9.220 -Dpackaging=jar
                 [com.cognitect/rebl "0.9.220"]

  ;; REBL - must be inlined in :user, cannot be separated to :nrebl profile
  ;; see 
  ;; TODO: make this work!!!
  :repl-options {:nrepl-middleware [nrebl.middleware/wrap-nrebl]}

  :injections [
               ;; REBL
               (require '[cognitect.rebl :as rebl])



I'm gonna try if it works with just this minimalistic version


Nope, the same error again:

Syntax error compiling var at (/private/var/folders/hn/tgwyrdmj1tb5pmmbdkd1g_qc0000gn/T/form-init10118661615782107768.clj:1:9797).
Unable to resolve var: nrebl.middleware/wrap-nrebl in this context


@U06HHF230 I'm not sure if you're using Cider or not but perhaps you have some advice on this?


Hi @U06BE1L6T. Yes, when I use nrebl I use it with cider. I’ve not used it with leiningen for a while, and tbh I don’t tend to use REBL much on a day to day basis. Regarding the nrebl profile I tend to have nrebl and other profiles defined, and then merge them into :user e.g.

:nrebl {:repl-options {:nrepl-middleware [nrebl.middleware/wrap-nrebl]}
         :dependencies [[rickmoynihan/nrebl.middleware "0.2.1-SNAPSHOT"]
                        ;;[rickmoynihan/nrebl.middleware "0.2.0"]
                        [org.clojure/core.async "0.4.490"]

                        [org.openjfx/javafx-fxml "11.0.1"]
                        [org.openjfx/javafx-controls "11.0.1"]
                        [org.openjfx/javafx-swing "11.0.1"]
                        [org.openjfx/javafx-base "11.0.1"]
                        [org.openjfx/javafx-web "11.0.1"]

         :resource-paths ["/Users/rick/Software/rebl/REBL-0.9.220.jar"]
         :injections [(require '[cognitect.rebl :as rebl])]

 :user [


how are you starting it, cider-jack-in? I tend to cider-connect to a lein repl run from a terminal


@U06HHF230 I've tried the "profile merging" option but it didn't work at all (I have many other things in profiles.clj) But as posted above I've also tried a minimalistic profiles.clj with the same result. I don't normally use cider-connect, always cider-jack-in which runs something like this:

/usr/local/bin/lein update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.5.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.22.3\"\] -- repl :headless :host localhost


With plain lein repl and cider-connect I get this warning:

WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it!
         More information.WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 2.5.0-SNAPSHOT (package: 20190618.716) and n/a, respectively.


I tried to profile merging again with cider-nrepl, but still the same error, now even with plain lein-prel

Error loading nrebl.middleware: Syntax error compiling at (nrebl/middleware.clj:1:1).
Syntax error compiling var at (/private/var/folders/hn/tgwyrdmj1tb5pmmbdkd1g_qc0000gn/T/form-init7074044914497216362.clj:1:9555).
Unable to resolve var: nrebl.middleware/wrap-nrebl in this context


Perhaps this error message can be relevant - I'm getting that for all lein commands:

lein -v
Error: cannot resolve lein-tools-deps.plugin/resolve-dependencies-with-deps-edn middleware
Leiningen 2.9.1 on Java 11.0.2 OpenJDK 64-Bit Server VM


I have no idea where that's coming from though (maybe I just forgot). Is it somehow bundled in the leinigen itself?


I tried to for the nrebl.middleware repo and ran lein repl there -> it fails with the similar error. When I remove this line it sort of works: However, I cannot require the namespace:

lein do clean, repl
nREPL server started on port 49538 on host - 
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.1
OpenJDK 64-Bit Server VM 11.0.2+9
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (require '[nrebl.middleware])
Syntax error (FileNotFoundException) compiling at (nrebl/middleware.clj:1:1).
Could not locate cognitect/rebl__init.class, cognitect/rebl.clj or cognitect/rebl.cljc on classpath.


But I have no idea how this thing is supposed to work so I don't know if it really make sense to use it like this


are you also sure you’re running it on clojure 1.10.1?


I can confirm I can recreate the issue. Not sure what it is either. rebl is a bit of a PITA tbh I think largely because it’s shipped as a binary, and it has some weird dependency issues that it weirdly pushes downstream. Not sure if that might be what is causing it — if you can downgrade REBL you might have more luck. Another complication might be the Java version. Are you running it on java 11 or java 8? If not why are you including the java 11 FX deps? Some bits of cider/leiningen might not work properly on that, not sure.


I'm using Java 11 and clojure 1.10.1


Leiningen 2.9.1 on Java 11.0.2 OpenJDK 64-Bit Server VM
Clojure 1.10.1


Hmm, I can confirm it works with 0.9.157. Unfortunately, I don't have access to newer versions before 0.9.220. I guess they are not publicly available, right?


I’d ask in #rebl but yeah as far as I’ve seen cognitect currently only supply the latest version.


Well it sort of works. I got this exception when trying tap> (which might be a known issue in the old version):

Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: com/sun/javafx/jmx/MXNodeAlgorithm
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lan


the tap panel in rebl only started working recently afaik

👍 4

Anyway, thanks a ton for your help. I'll see if I can get a working solution anytime soon..


n/p let me know how you get on; and maybe file an issue describing any findings. I find REBL pretty hard to test and work against because of its binary nature and there are various incompatibilities and dependency issues that can arise which are hard to debug because it’s so inscrutable.


@macrobartfast I have been using lein new figwheel-main project-name -- --reagent for my projects. Works very well with clojurescript-jack-in. I havent found the opportunity to try out shadow-clj and figure out what npm packages I want to use. There is a reasonably simple example of a figwheel-main project here


There is also an article if you decide to use Clojure CLI tools and deps.edn instead of Leiningen


You really shouldn't be! It's as straightforward as the alternatives, and brings some very nice things to the table if you rely on npm libs.


thank you all! ( @dpsutton @jr0cket @aisamu ) I feel much better about all this thanks to your help. 😉

cider 8

@iagwanderson clojure-mode defines indentation, though I can’t remember the setting off the top of my head


thanks @U0JJ68RBR I will try to take a look at this later

👍 4