Fork me on GitHub

I created an IntelliJ plugin that enables navigation to Clojure component code. It supports navigation to init-key code from its key in a map. It also supports navigation from #ig/ref to its target. It’s useful when navigating a large code base using Integrant/duct. Please let me know if anyone finds an any issue.

👍 2

This is really cool! I had a quick look at the code, a few comments:


I think your FilesSearchScope can just use GlobalSearchScope#filesScope().


Actually, I thought I had another comment, but I think what you have is OK. Nice work! That must have taken some figuring out 🙂


Thanks! It’s my first plugin, so I appreciate your feedback! Yes, it took a lot of time to figure out Psi element tree 😅 It would be great if my plugin depends on only cursive.psi.api.* packages, but I couldn’t find a good way to achieve what I want without cursive.psi.impl.* packages.


May I ask a question about testing my plugin? I’m trying to add a test, but ClojureGoToSymbolContributor doesn’t seem to work in the test. Do you know how to enable it in the test?


Hmm, I don’t, sorry. What I would normally do is get the IntelliJ community source code, and look for other implementations of the base class (ChooseByNameContributor), and see where they’re used in tests. But I just checked a few implementations there and they don’t seem to be used in tests at all, at least not directly. It’s possible there are tests for higher-level things like Go To Symbol which use them under the hood, but I’m not sure, sorry.


No worries. Thanks for checking it!


Uh, JetBrains just announced Fleet, a new lightweight editor. Since it's using intelliJ for the code-processing engine I'm curious to see what will come out of it, and if it could be a lightweight alternative for us clojurians (with cursive! 😉). I guess this is news also to you @cfleming?


It is news to me! I knew they have been working on various projects along these lines, but I didn’t know they were ready.


Looks like it will be a while before I can do anything to support this.

👍 1
Jakub Holý (HolyJak)15:11:49

Is there a way to run all tests from IntelliJ? (Using Lein) I assume that will make the results more navigable than just running lein test in the terminal. I have tried to add a run config. for clojure.test with "run all tests in module" but there was some IntelliJ error about the cursive config class that could not be cast to some II Base class and the run config does not run...


Could you send the exact error? Or even better, check to see if it appears in your log?

Jakub Holý (HolyJak)10:11:52

I don't know where to find it. It appeared in a pop up window which I killed.

Jakub Holý (HolyJak)10:11:46

Ok, I found II logs but not sure what to look for. I will try to re-create the error.

Ian Fernandez17:11:56

I've tried to get a Repl running clojure from clojure cli with this :jvm-opts :

"--add-modules" "java.base/jdk.internal.misc=ALL-UNNAMED"

Ian Fernandez17:11:12

it gives me an error:

Unrecognized option: --add-exports
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


Does this happen in Cursive or on the command line?

Ian Fernandez15:11:50

in cursive only


Can you send a screenshot of the error?


That looks to me like your project is using the JDK bundled with IntelliJ, and it doesn’t support that option. There’s more information here about the syntax of that option in different JDK versions:


Actually, I misread part of the stacktrace, it’s not using the IntelliJ JVM. But regardless, it’s a problem with the JVM, so I guess your Cursive project is using a different JVM to the one that’s picked up on the command line.

Ian Fernandez17:11:21

why this happened?


Just updated to 1.12.0 (not sure what I had before but I am on EAP channel) on IDEA 2021.2.3 and lots of (but not all) clojure.core symbols have stopped resolving in a babashka project (e.g. defn, let, and ns don't resolve but def does). I tried invalidating caches and even deleted .idea and the .iml file and re-setup the project but no dice. Anyone else seeing that in babashka projects?


Oh, this is with babashka 0.6.6


Hmm, @cfleming - is there anything I can do to help here?


I think I found the issue


the print-deps result contains a local/root dependency which doesn't make sense for this use case


I'll make an issue and fix that


What a co-incidence, I had this issue open in my browser and you commented on it just now:

😆 1

I pushed a fix for this to master, releasing now


will take 15 minutes or so (if CI cooperates)


done, 0.6.7 released

👍 1

confirming 0.6.7 fixed it here too. thanks again @U04V15CAJ!