Fork me on GitHub
#calva
<
2021-04-12
>
Thomas Tay00:04:56

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

ericdallo00:04:16

Are you using leiningen or clojure cli?

Thomas Tay01:04:38

Clojure CLI. actually I just managed to get it to work, by manually invoking javac and putting it into a classes/ folder

ericdallo01:04:13

exactly, with clojure cli there is no easy way AFAIK to achieve that automatically, you can wrap that in a script

ericdallo01:04:41

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

ericdallo01:04:21

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

Thomas Tay01:04:54

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

Thomas Tay01:04:22

Eric that might be useful

ericdallo01:04:00

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

👍 2
pez12:04:51

Maybe @U04V70XH6 has an idea? He’s a master of dynamic things. 😃

seancorfield15:04:37

Someone — I can’t remember who — wrote a Clojure library to do dynamic recompilation of Java.

👀 2
seancorfield16:04:02

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.

metal 1
metehan02:04:28

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 ...

ericdallo02:04:14

@UJ35GLZU7 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

metehan02:04:46

thank you for guiding me there, now I added like: {:linters {:lint-as {r/with-let clojure.core/let}}} but still same

ericdallo02:04:55

it should be something like:

{:linters {:lint-as {full-r-namespace/with-let clojure.core/let}}}

metehan02:04:19

I didn't think about it 😅

metehan02:04:23

thanks

😉 2
Aleksander Rendtslev12:04:22

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

pez12:04:53

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, 😂

bringe16:04:08

That's true, latest uses clojure-lsp for auto namespace creation.

richiardiandrea20:04:35

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.

pez20:04:11

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.

richiardiandrea20:04:21

oh cool we'll try and report back...wonder if it can work with the binary as well, we'll fiddle

richiardiandrea20:04:32

thanks @U0ETXRFEW for the prompt reply

pez20:04:50

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.

richiardiandrea20:04:38

ok thanks yeah will do that