Cross posting this here. I'm working on a project that needs to include a single Java file. Any advice on how to do this easily from Calva? I'll be working both the Java and clojure together, so ideally some sort of hotkey to recompile the Java file and reload the class would be helpful
Maybe @seancorfield has an idea? Heโs a master of dynamic things. ๐
Someone โ I canโt remember who โ wrote a Clojure library to do dynamic recompilation of Java.
Ah, I was thinking of this https://github.com/ztellman/virgil but it only documents how to work with Leiningen and Boot. I bet you could make it run with the CLI and deps.edn
if you wanted to spend some time on it.
Thanks Sean, I'll take a look this weekend, looks promising. Zach tellman's stuff is always the best
Are you using leiningen or clojure cli?
Clojure CLI. actually I just managed to get it to work, by manually invoking javac and putting it into a classes/ folder
exactly, with clojure cli there is no easy way AFAIK to achieve that automatically, you can wrap that in a script
on clojure-lsp, we have a class that we don't need to maintain, so we extracted it to another lib that we use on dependencies
I was thinking other day in create a deps.edn lib that would handle those cases and compile the java classes and include on classpath
Hmm but now I have to reload the repl every time I change the Java file. Quick google doesn't seem like there's a way around it
Eric that might be useful
yes, I don't think there's a easy way to make the java file changes available on repl, maybe you can ask for help on #nrepl
I get unresolved symbol error from clj-condo linter when I use r/with-let
as a sample I define values
here but it says Unresolved symbol:values
(defn login []
(r/with-let
[values (r/atom {:domain (.get ...
@m373h4n probably r/with-let
is a macro and should be configured as :lint-as
or hooks, check clj-kondo documentation about macros: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#unrecognized-macros
thank you for guiding me there, now I added like: {:linters {:lint-as {r/with-let clojure.core/let}}}
but still same
it should be something like:
{:linters {:lint-as {full-r-namespace/with-let clojure.core/let}}}
I didn't think about it ๐
thanks
Hi,
Is there a way to run custom npm
scripts when doing jack-in?
Iโm running a postcss
watcher for tailwind-jit. It works if I start shadow-cljs in a separate terminal and then connect. But it seems like iโm missing a few features. (Iโm unsure about this though. But automatically creating namespaces when I create new files isnโt working).
It is in my other project where I do a normal jack in
Hello, there is currently no hook in jack-in for running custom scripts. Might be something we should consider. There are some things you could investigate around it that I come to think of, though.
โข With https://calva.io/connect-sequences/ there is an afterCLJReplJackInCode
option. Maybe you can start the script using clojure.java.shell
?
โข shadow-cljs might have some hook for this
โข Tell us how you do it from the separate terminal and maybe we can come up with more ideas. ๐
Regarding functionality. As long as you start shadow with the dependencies that Calva jack-in starts it, there should be no difference in Calva functionality. And the specific feature with creating namespaces is not even using the REPL connection, so there must be something else going on/wrong. If you are using latest Calva, I think this is handled by clojure-lsp, but Iโm not sure, Calva is developing faster than I can keep up, ๐
That's true, latest uses clojure-lsp for auto namespace creation.
Hi there, my company are using a dual Calva+Emacs workflow and picked zprint
as our formatter.
I am not a Calva power user but I was wondering if there is any suggestion on how to make so that Calva uses zprint
as default formatter.
ping @tristbot
This might work, @richiardiandrea. The jury is still out. Calva could definitely be made to use zprint
as a formatter. It is a matter of putting in the work.
oh cool we'll try and report back...wonder if it can work with the binary as well, we'll fiddle
thanks @pez for the prompt reply
np. Should work with the binary as well. The experience will not be as smooth as Calvaโs built in, I think. Feel invited to file a request on Calva to support zprint if you find that this external formatter way doesnโt cut it.
ok thanks yeah will do that