Fork me on GitHub
#conjure
<
2023-09-22
>
ander02:09:26

Are there any articles / resources / example setups / tips that anyone can recommend for using Conjure in a Clojure+ClojureScript (w/ shadow-cljs) combined repo? I can get it to work by manually creating a new session with ,sf , switching into it with ,ss and running :ConjureShadowSelect from within that session. This works but it feels pretty clunky. When using the workflow described https://github.com/Olical/conjure/wiki/Multiple-connections-with-ConjureClientState I find that in whatever 'state' my client is in, after I run :ConjureShadowSelect all evaluations are in ClojureScript regardless of which state is active. I'm actually not sure how to undo this step so I have start over here if I want to evaluate normal Clojure. Any advice would be greatly appreciated šŸ™

Oliver Marshall10:09:46

I'm not sure about the workflow that you described, but my workflow looks like this: 1. Start shadow-cljs in a separate terminal (`npx shadow-cljs watch app`) 2. Connect to the clojure repl it started 3. ,sf to create a new session 4. :ConjureShadowSelect (I have a keybinding that searches for shadow sessions ,sS found https://github.com/Akeboshiwind/dotfiles/blob/master/nvim/.config/nvim/lua/plugins/lang/conjure.lua#L41) At this point you have two sessions: a clojure one and a clojurescript one. They can be listed with ,sl and I switch between them using ,sn and ,sp Once you switch to a session evaluations will go to that session.

šŸ‘ 1
Oliver Marshall10:09:31

I'm not sure this is the most optimal setup (particularly using the same clojure process for both shadow-clj & my own app) but it works for me šŸ¤·

Braden Shepherdson14:09:32

I do this! šŸ™‚ I use :ConjureClientState default for the CLJ REPL and :ConjureClientState cljs for the CLJS REPL. (and bind those to keys, of course) it gives a very nice ability to switch between them at any time.

Braden Shepherdson14:09:53

I use the .nrepl-port for CLJ so in default state it just works the first time I try to eval something. in contrast, I have shadow-cljs hard-coding the nrepl port (eg. {:nrepl {:port 50655}} in shadow-cljs.edn) so to connect to CLJS: ā€¢ ,tj does :ConjureClientState cljs<CR> ā€¢ :ConjureConnect 50655 ā€¢ :ConjureShadowSelect dev or whatever your build is called then you can switch freely with the :ConjureClientState key bindings.

Braden Shepherdson14:09:48

as a nice bonus, the Conjure output always begins

; --------------------------------------
State: default
...
so you get a little nudge for which state you're in on each eval.

ander23:09:47

Thanks! This all helps a lot

Saket04:09:28

I have autocommands defined for vim startup and on the basis of the directory I am in (i.e. _/clj/_ or _/cljs/_ , they switch the sessions.

Oliver Marshall10:09:35

Interesting idea thinking-face

martinklepsch11:09:55

hello ā€” this probably has been asked before but I was just thinking... is there a way to direct tap> results into a vim buffer?

practicalli-johnny15:09:54

I assume any Clojure function that can write to a vim buffer and takes a single argument can be added as a tap>, using add-tap I assume the trick is then to do something useful with the values sent to the vim buffer. I assume this would be to help navigating more interesting evaluation results, like Portal or Cider inspector (but within vim/Neovim)

rs19:09:33

Hello, Does Conjure provide Java interop autocompletions ?