This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-30
Channels
- # announcements (15)
- # beginners (143)
- # boot (2)
- # calva (48)
- # cider (93)
- # cljsrn (2)
- # clojure (127)
- # clojure-europe (3)
- # clojure-italy (8)
- # clojure-losangeles (8)
- # clojure-nl (10)
- # clojure-spec (67)
- # clojure-uk (51)
- # clojurescript (20)
- # cursive (9)
- # data-science (2)
- # datomic (10)
- # duct (13)
- # figwheel-main (1)
- # fulcro (74)
- # instaparse (10)
- # jobs (3)
- # joker (8)
- # juxt (4)
- # lumo (1)
- # malli (11)
- # nrepl (3)
- # off-topic (4)
- # pathom (5)
- # pedestal (6)
- # planck (5)
- # re-frame (18)
- # reagent (5)
- # reitit (17)
- # shadow-cljs (165)
- # sql (30)
- # vim (12)
- # xtdb (6)
Has anyone successfully setup jump to definition from clojure to Java?
The hard part I’ve run into is automatically downloading sources, and adding them to the classpath
https://github.com/clojure-emacs/cider-nrepl/issues/64 -> https://github.com/vise890/lein-pocketbook
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
cider-connect
followed by, in the repl that appears in emacs
(use 'figwheel-sidecar.repl-api)
and finally
(start-figwheel!)
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.
(+ 1 1)
causes
Unable to resolve symbol: + in this context
as well.
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?
gotcha.
lemme see
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.
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 cider-connect
and then, in the emacs repl, (use 'figwheel-sidecar.repl-api)
followed by (start-figwheel!)
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
(:require
[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.
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.
And suggestion. Get it running where you have a repl from the command line and only then try putting CIDER in
ok, will do.
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.
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:
clojure
(defrecord Valores [])
[Valores (= 1 1)
(= 2 2)
(= 2 3)]
[Valores (= 1 1)
(= 2 2)
(= 2 3)]
As mentoined here https://clojurians.slack.com/archives/CEFN9UP8R/p1572424846034600, 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)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):
{
:user
{
: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])
]
}}
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 [
:nrebl
:cider
,,,
]
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: https://github.com/RickMoynihan/nrebl.middleware/blob/master/project.clj#L29
However, I cannot require the namespace:
lein do clean, repl
nREPL server started on port 49538 on host 127.0.0.1 -
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 using my lein-tools-deps as well?? https://github.com/RickMoynihan/lein-tools-deps
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.
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
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 https://github.com/practicalli/practicalli-landing-page
There is also an article if you decide to use Clojure CLI tools and deps.edn instead of Leiningen https://practicalli.github.io/blog/posts/development-workflow-with-clojure-cli-tools/
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. 😉

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