Following along the “Getting Started” REPL, in hello_repl.clj
, it indicates that the user can use Go to Definition
on Java methods “if you have Java sources installed”. What is involved in installing Java sources in this context? Is it referring to an SDK installation? If so, how is that discovered by vscode? Or is there a specific extension needed to support Java sources?
I had the same question in the past. See the answer here: https://github.com/clojure-emacs/orchard/issues/103#issuecomment-764936527
We probably should provide info on this in docs or the guide
Happy to hear you are trying out the Getting Started REPL! I’m super curious about how/if it works for you as a means to get started. Ar you a beginner with Calva and/or Clojure, or are you mainly checking it out?
Checking it out. Coming from cursive.
Hey folks 👋 I have been trying out Calva during the last weeks, and it has being a very capable a great tool so far, thanks for the effort 🙂 However, one problem that myself and some colleagues have been facing is that Calva fails to load some namespace dependencies correctly, so it ends up throwing exception like:
; Syntax error (FileNotFoundException) compiling at (test/messaggero/db/datomic/notifications_test.clj:1:1).
; Could not locate messaggero/aux__init.class, messaggero/aux.clj or messaggero/aux.cljc on classpath.
; Evaluation of file notifications_test.clj failed: class clojure.lang.Compiler$CompilerException
Usually I need to manually trace back the dependency tree and load each file individually until I am able to load the ns I want to work in.
Is this something that has already being tracked?@leoiacovini Are you on Windows?
Nope, MacOS here
Just checking, since aux
and a few other filenames behave strangely on Windows (legacy references to CON
, AUX
, PRN
ports etc).
I guess I mean, I’m checking out Calva
Hello, and thanks for recognizing that this is an effort. We try, we try. 😍 I am not completely sure I understand the problem, or rather how it is Calva related. Calva only loads what you tell it to load. I know that Cursive has some pretty extensive load mechanism that you can use to load more eagerly (or whatever the right word is). I haven’t wrapped my head around what that is really, but maybe that is what you are missing? Meanwhile, if you know what files that if loaded will load what you need for your session, I’m thinking, maybe you can use the custom connect sequence so that when you connect the project, a start command will fire that loads the necessary files. (Again, speaking without having really understood, so apologies if it doesn’t make sense.)
I see, I hope you’ll like it. Even if it is a bit more spartan than Cursive. 😃
is there a way to configure a command calva calls when disconnecting? i start the repl server separately and sometimes disconnect to clean the build, so trying to configure a sort of cleanup hook when disconnecting
Not, currently. But sounds like it would fit in a custom connect sequence. Please file an issue. And of course, please submit a PR too. 😃 We are here to help guiding anyone that wants to hack on Calva.
Thanks! What I meant is that if I have a namespace in my project that includes some other required ns (using the regular (:require [...])
syntax, ie:
If I load this using the Calva: Load current file and dependencies
command
(ns my-ns
(:require [utilities :as utils]))
(utils/say-hello! "")
The required namespaces (in this case utilities
) is not being properly loaded when I load the my-ns
namespace, thus throwing the exception I pasted above. Sometimes is not the direct required namespace, but instead an indirect dependency that it has. And it also does not happen constantly, but it’s a frequent thing that I have been experiencing, what I usually need to do, is to close the REPL and open a fresh one again
Not sure if I made myself completely clear 😅Haha, makes sense. But it happens with a lot of different namespaces, not specially with this one. Seems more something related to some state that is messed up. Because re-starting the repl and loading again, usually works
Yeah, you are making yourself clear. 😃 Is anyone in your team using Emacs/CIDER? I’d be curious if there is the same problem there.
Also if you do (require … :reload-all)
, does that help any?
In any case, it sounds like you should file an issue. Not sure I understand it well enough, yet, to be able to fix it, but with issues things get visible and sometimes someone throws the needed light on things.
I have checked with some folks who uses Emacs/CIDER (@ericdallo for example), and they haven’t faced this kind of problem. I just found this issue: https://github.com/BetterThanTomorrow/calva/issues/907 I think it may be related, I will try to do some isolated testing, and see if I can bring a more accurate report 🙂 Thanks anyway for the help
That does seem related. I have not quite experienced that problem myself, it was just something I became aware of. Now asked here about what the fix is from the REPL point of view. https://clojurians.slack.com/archives/C03S1KBA2/p1615413134450300
Calva version 2.0.179 is released. It just includes an implementation change that helps us move forward with using ClojureScript for more of Calva's implementation. Specifically, we use CLJS for ephemeral state now instead of TS + Immutable.js. Everything should work the same as before, and has in my testing, but if you notice anything strange please report it. :simple_smile:
A colleague of mine is getting started with Clojure. He asked for editor recommendations. I said Cursive, since it's worked well for me previously. He wasn't too happy with "going back to Intellij". He decided to try Calva, looking for something more lightweight. Outcome? He's happy with what he's got now. The "Getting Started" REPL was especially impressive. Great work!
Yes, @pez, I second the above. Great work on that!
That was my experience as well. I'm taking a college course that uses Clojure and they recommended Sublime Text which I didn't like at all. I've used Intellij before but Cursive felt really heavy and I didn't have the patience to learn Emacs and Clojure at the same time. Calva feels perfect
That's awesome. And it's also awesome that a college course uses Clojure. May I ask what college or where?
It's the Programming Languages and Translation course at Auburn University. I'm in their online CS bachelor's program
We're covering Clojure and Smalltalk as examples of functional and object oriented languages
Oh that's cool
Back to the original question... I've got Java src.zip in my jdk directory, but is something supposed to find it there to get Go To Definition to work?
cider-nrepl should find it, but they actually may have an issue with this right now, see the issue linked above. I've never actually tried to make this work.
Thanks for letting us know! I especially need to hear things like this about the Getting Started REPL, because I have spent A LOT of hours on it. I do intend to complete the Clojure guide, but am glad I released the feature even with the guide unfinished. 😃
At the Royal Institute for Technology (the main engineer university in Stockholm) they have a course about building big systems, and it is based on Clojure. Thomas Ekholm, who’s managing the course, refused to continue with it if it was to remain a Java based course. 😃
While you are all this happy with Calva, please consider filing a review. Link in the topic of this channel. ❤️
I just command-click things like Math/abs
and it just works. MacOS. Installing Java using sdk-man (no idea if that makes a difference, but anyway).
Maybe a different JDK version would help in the meantime, but I'm not sure. And if using clojure cli, try lein, and vice versa.
I submitted one, thanks for making it easy to get started with Clojure
Awesome. You are most welcome, sir!
Yeah, I updated to jdk11 and also installed the sources (I'm on Linux). It works now, thanks!
Awesome. It is a pretty nice thing to have working.
You know what, dear Calva-friends? I need help testing a thing again. This time someone reminded me about an issue with how Paredit-selecting things first forwards then backwards (or vice versa) behaves a bit surprisingly. And it made me realize that I now understand how to fix it, so I did. Check the issue for context and install the VSIX if you feel like helping me test it. Thanks in advance! ❤️ • https://github.com/BetterThanTomorrow/calva/pull/1066 • More context in https://github.com/BetterThanTomorrow/calva/issues/1062 • https://12044-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.180-1062-select-back-fwd-df06c31b.vsix.
Sweet!