This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-22
Channels
- # announcements (2)
- # babashka (18)
- # beginners (87)
- # calva (22)
- # chlorine-clover (5)
- # cider (11)
- # clj-kondo (10)
- # clojure (71)
- # clojure-austin (1)
- # clojure-norway (6)
- # clojure-uk (13)
- # clojurescript (3)
- # core-async (10)
- # data-science (17)
- # datascript (1)
- # datomic (22)
- # emacs (10)
- # fulcro (32)
- # hoplon (8)
- # jobs-discuss (2)
- # malli (5)
- # meander (5)
- # nrepl (35)
- # off-topic (8)
- # pathom (38)
- # planck (21)
- # re-frame (10)
- # reagent (17)
- # reitit (7)
- # shadow-cljs (26)
- # tools-deps (3)
- # xtdb (7)
I think that’s fundamentally how cider works. It is part of of running image and doesn’t do any static introspection. Until you evaluate forms it only knows about clojure core essentially.
@dpsutton It seems I didn't explain clearly. My test was on the slurp function, so not working on clojure.core
functions.
I don't need to evaluate anything specific, but it seems I need to evaluate something before any function will work with clojure-doc.
If it should work on clojure.core, I will do more testing on other core functions.
I understand that my own custom functions should be evaluated before Cider can find them.
@marques.goncalves.fel The following works deps.edn
file will jump to Java definitions using the CIDER command clj-find-var
.
I have a deps.edn as follows:
{:path
["src" "resources"]
:deps
{org.clojure/clojure {:mvn/version "1.10.1"}
;; Java 11 sources
java-sources {:local/root "/usr/lib/jvm/openjdk-11/lib/src.zip"}}}
The location of your sources.zip file may differ. I installed the sources from an Ubuntu package openjdk-11-source
.
I would recommend adding the Java sources as an alias, rather than a main dependency.@marques.goncalves.fel I've added example aliases for including java sources in my example deps.edn
file here: https://github.com/practicalli/deps-edn-examples/blob/master/deps.edn#L81-L93
I would encourage you to use aliases rather than including sources as a main dependency, as the java sources are a development time artifact.
:java-11-source
{:extra-deps
{java-sources {:local/root "/usr/lib/jvm/openjdk-11/lib/src.zip"}}}
Thanks for the amazing explanation. Normally, I don't have to look the java source code. But recently I have been working with Avro and it is handy to be able to take a look at the library from inside Spacemacs. But now I understand better the internals and how I could make it available. Thanks!
Its useful stuff for the Spacemacs book I am writing, so I was happy that I managed to figure out how to do it. Occasionally I do a bit of Java Interop, so it is useful to have for those times. Now I know how to do it next time I forget 🙂 https://practicalli.github.io/spacemacs/navigating-code/java-definitions.html
Cool! Btw, I love you book. I use Spacemacs and it was my go-to reference when I was starting (and it still is!)
If you always want to include the java sources when running cider-jack-in
then you can add a .dir-locals.el
file to the root of your Clojure project. Here is an example that will include the java-11-source
and use the clojure-cli buld tool by default (if you have more than one build configuration file)
((nil . ((cider-clojure-cli-global-options . "-A:java-11-source")
(cider-preferred-build-tool . "clojure-cli"))))
In case there are any nREPL experts in the house, I could use a little help with https://github.com/borkdude/nrepl-server. It doesn't work with lein
and boot
yet. Somehow the response is not printed
@U04V15CAJ just a casual perusal, but I see you're casing on the op code as a keyword. I thought these are always strings. If you don't match anything in the session loop you stop there. Strange to only see a recur in the eval branch
and i see the following in nrepl server:
(defn- normalize-msg
"Normalize messages that are not quite in spec. This comes into effect with
The EDN transport, and other transports that allow more types/data structures
than bencode, as there's more opportunity to be out of specification."
[msg]
(cond-> msg
(keyword? (:op msg)) (update :op name)))