Fork me on GitHub
#cider
<
2022-10-20
>
hifumi12304:10:20

Is it possible to use cider-jack-in-cljs with lein-shadow? Maybe adding a custom task for the lein repl action? EDIT: I ended up replacing shadow-cljs with figwheel-main in the end. And it works perfectly with CIDER

andrewzhurov09:10:26

M-. jumping to a definition of a symbol of a .jar dependency opens that file, however when doing C-x C-f you're not inside of that dependency's source code, but in a folder with its .jar Is there a way to M-. into its source code? I heard in LSP they unpack .jar and navigate there, for example, and that sounds good, can it be done with cider? (I'm using eglot instead of LSP)

👍 1
vemv09:10:30

are you asking about clj or java code?

vemv09:10:37

what practical problem are you experiencing?

andrewzhurov11:10:29

I jumped to a function definition of aws/invoke and wanted to search project-wide (aws cli) usage of that function's arg

andrewzhurov11:10:54

(I ended up not needing it, but I thought that having project's source at hand is useful, as I recalled wanting to explore project's source a couple of times before, and came to ask how to)

andrewzhurov11:10:32

atm to do so I'm clonning projects locally and using :local/root to point to them, which is tedious

vemv12:10:53

> I jumped to a function definition of aws/invoke and wanted to search project-wide (aws cli) usage of that function's arg For clarity: so for dependency foo and function bar you want to find usages of bar within foo (and not within your project)?

andrewzhurov12:10:18

and explore project foo in other ways as-though it is another project source on disk

vemv13:10:01

For full-blown interactive functionality, CIDER / refactor-nrepl aren't the best tool for the job. The reason being: they're based on runtime info, and we can't preemptively eval the whole classpath. clojure-lsp is fine for this use case. If you clone the repo as of the relevant commit/tag, of course you can have the full CIDER project for that repo, provided that you started a dedicated repl for it. I wouln't recommend :local/root as much: it still doesn't mean that CIDER will analyze all those namespaces (it only has direct access to stuff that has been require d or otherwise evaled) And as a quick hack, you might have luck with a jar-specific grep. It might not hard to build a little custom emacs feature: "grep within the jar containing the current buffer"

vemv13:10:21

This might sound like a big limitation in CIDER, but IME your use case is very much rare. For those rare occasions you can clone, start a repl, and use interactive functionality all in the same Emacs session - no restarts!

vemv13:10:42

It's also worth noting that CIDER has no real reason to "unpack" .jar to disk. In fact doing so would be very much dangerous - it can easily alter the classpath, resulting in opaque issues that would backfire later. tldr CIDER, because it co-habitates with the jvm/clojure runtimes, has to use certain cautions.

Chris Clark18:10:30

I hit this same limitation all the time. I’m maybe spoiled from other languages (like emacs-lisp and python) where it’s totally normal to M-. into a 3rd-party library and then just poke around, maybe check out the README, etc. In jars: I’ve noticed that dired actually handles the jar pretty well. If I dive into some 3rd-party library clojure code, then open dired, then hit <enter> on the .jar that it suggests, it goes into “Zip Archive” mode and allows me to see all the files in the jar and open any of them. Not as great as a git repo, but that has still been really useful for me!

João Pedro de Amorim Paula15:10:25

hi guys. i have a project in which i start it with cider-jack-in-clj&cljs, using a shadow as my preferred build tool because it already starts the nREPL and configures the middleware and etc. but i'm noticing that, because of that, whenever i try to print something from the Clojure part of my application, it shows up on the ClojureScript REPL instead of the Clojure one. do you know if there's a way to configure so that it prints to the correct REPL?