calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
2021-04-12T00:38:56.432800Z

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

pez 2021-04-12T12:44:51.447100Z

Maybe @seancorfield has an idea? Heโ€™s a master of dynamic things. ๐Ÿ˜ƒ

seancorfield 2021-04-12T15:13:37.447600Z

Someone โ€” I canโ€™t remember who โ€” wrote a Clojure library to do dynamic recompilation of Java.

๐Ÿ‘€ 2
seancorfield 2021-04-12T16:58:02.449500Z

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.

๐Ÿค˜ 1
2021-04-13T18:59:45.456Z

Thanks Sean, I'll take a look this weekend, looks promising. Zach tellman's stuff is always the best

ericdallo 2021-04-12T00:41:16.432900Z

Are you using leiningen or clojure cli?

2021-04-12T01:11:38.433100Z

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

ericdallo 2021-04-12T01:14:13.433300Z

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

ericdallo 2021-04-12T01:14:41.433500Z

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

ericdallo 2021-04-12T01:15:21.433700Z

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

2021-04-12T01:24:54.433900Z

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

2021-04-12T01:25:22.434100Z

Eric that might be useful

ericdallo 2021-04-12T01:27:00.434300Z

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

๐Ÿ‘ 1
metehan 2021-04-12T02:26:28.435600Z

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

ericdallo 2021-04-12T02:40:14.435700Z

@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

metehan 2021-04-12T02:48:46.436Z

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

ericdallo 2021-04-12T02:53:55.436200Z

it should be something like:

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

metehan 2021-04-12T02:59:19.436400Z

I didn't think about it ๐Ÿ˜…

metehan 2021-04-12T02:59:23.436600Z

thanks

๐Ÿ˜‰ 1
Aleksander Rendtslev 2021-04-12T12:31:22.438700Z

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

pez 2021-04-12T12:43:53.446800Z

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, ๐Ÿ˜‚

bringe 2021-04-12T16:35:08.449400Z

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

richiardiandrea 2021-04-12T20:42:35.451900Z

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.

richiardiandrea 2021-04-12T20:42:53.452Z

ping @tristbot

๐Ÿ‘ 1
pez 2021-04-12T20:49:11.452500Z

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.

richiardiandrea 2021-04-12T20:50:21.452600Z

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

richiardiandrea 2021-04-12T20:50:32.452800Z

thanks @pez for the prompt reply

pez 2021-04-12T20:54:50.453Z

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.

richiardiandrea 2021-04-12T20:58:38.453200Z

ok thanks yeah will do that