conjure

:neovim:+:clj: https://github.com/Olical/conjure - If you're enjoying Conjure and want to say thanks: https://github.com/users/Olical/sponsorship :smile: (alt https://conjure.fun/discord)
Aron 2020-09-21T11:39:22.019700Z

Can I use conjure with multiple projects at once? Like connect to one thing in one terminal and another in another? I was trying to connect and it kept talking about the other 🙂

Olical 2020-09-21T11:40:31.019800Z

Do you mean in one neovim instance or two?

Olical 2020-09-21T11:40:46.020Z

Because if it's two, of course, open neovim in another project and away you go

Olical 2020-09-21T11:42:01.020200Z

If it's one neovim instance you'll need to set the state key as you :cd between projects or maybe even as you open different files. This means you set up an autocmd on directory change or on file open that works out which project you're in and runs :ConjureClientState my-project-name where the project name can be any string really

👍 1
Olical 2020-09-21T11:42:26.020400Z

Basically by running :ConjureClientState SOMESTRING you can hop into an alternate reality of Conjure where you're connected to something else

Olical 2020-09-21T11:42:55.020600Z

It's up to you to set up autocmds / key mappings to hop between client state strings, so you can tailor it to your needs. It's more of a building block than anything.

Olical 2020-09-21T11:43:09.020800Z

You could just have two like "a" and "b" and set up a mapping to hop to a and one to b

Olical 2020-09-21T11:44:45.021Z

I use this at work with nvim-local-fennel

(module redacted
  {require {nvim aniseed.nvim}})

(set nvim.g.conjure#relative_file_root "./")

(nvim.ex.augroup :redacted-lnvim)
(nvim.ex.autocmd_)
(nvim.ex.autocmd :DirChanged :* :execute "'ConjureClientState ' . fnamemodify(getcwd(), ':t')")
(nvim.ex.augroup :END)

Olical 2020-09-21T11:45:05.021200Z

so as I :cd module/some-module I get an isolated environment for that separate clojure project.

Aron 2020-09-21T11:48:22.021400Z

two neovim makes more sense, but I might've been trying in the same one

Olical 2020-09-21T11:49:01.021600Z

Yeah, two neovims in two terminals works great for me

Aron 2020-09-21T11:49:02.021800Z

and thanks, I that's very helpful, I think I will try it

Olical 2020-09-21T11:49:25.022Z

No problem! The client state stuff basically lets you simulate two entirely separate conjure instances

Olical 2020-09-21T11:49:55.022200Z

But two terminals is simpler to do, :ConjureClientState ... is there for when you want to get creative and have things just connect and do what you want in monorepo style projects

2020-09-21T11:57:50.022400Z

I guess the same applies to two nREPLs (e.g. clj and cljs) in the same project. Either you use something like Piggieback or you wrangle :ConjureClientState. Is that right?

Aron 2020-09-21T11:59:56.022600Z

Seems like the problem is going to be something WSL related. I opened a completely new terminal and it still tells me that watch for the build is not running and when I want to connect it mentions the other project's namespace

Aron 2020-09-21T12:00:25.022800Z

these are completely separated projects in entirely different directories

Aron 2020-09-21T12:00:36.023Z

both shadow-cljs though

Olical 2020-09-21T12:15:16.023300Z

@jkrasnay kinda although CLJS + CLJ in one nREPL actually works well through sessions.

Olical 2020-09-21T12:15:35.023600Z

You can use session mappings to hop between your Clojure and ClojureScript sessions.

Olical 2020-09-21T12:15:58.023800Z

That sounds like your CWD isn't being updated @ashnur?

Olical 2020-09-21T12:16:10.024Z

I'd check :cwd in both terminals, if they're the same you're in the same project

Olical 2020-09-21T12:16:42.024200Z

Also if you have two nREPLs with two ports just using :ConjureConnect ... with just the port number for each nREPL in each terminal.

Aron 2020-09-21T12:18:47.024400Z

I think it's that, the port was the same, so it didn't start, had probably nothing to do with conjure, sorry for the bother 😞 But at least I learned about ConjureClientState

Olical 2020-09-21T12:19:36.024600Z

Not a problem! And yeah, I'd consider client state extremely useful in some cases with some upfront thinking / autocmds but an advanced feature most don't need.

orestis 2020-09-21T12:54:48.024800Z

TIL about ConjureClientState 🙂 I’ve been using the session list functionality

orestis 2020-09-21T12:55:32.025800Z

The error printer in Conjure seems rather sparse — no stacktrace, no ex-data… I end up evaluating *e in the editor to figure things out. Is this something pluggable via say an nrepl middleware?

Olical 2020-09-21T13:56:45.027Z

I tend to just use *e too, you could rig up a mapping that evaluated *e with whatever wrapper you're interested in at the time via :ConjureEval .... I would imagine nREPL middleware would give you some good hooks into it too! Although I've never tried that myself

Olical 2020-09-21T13:57:14.027700Z

I didn't do anything special with the errors because the default seemed pretty good already and I didn't want to step on the toes of middleware / custom setups / environmental differences (cljs / clj etc).

orestis 2020-09-21T14:07:34.027900Z

Good pointers, thanks

orestis 2020-09-21T14:08:23.028800Z

BTW one thing that I realised might influence the floating window delay that I’m seeing is wrapping. I usually tend to wrap my logs (set wrap) so floating window might have to do a lot of work to show the wrapped results?

orestis 2020-09-21T14:08:50.028900Z

I always kind-of expected that the floating window will only show the last evaluation result, not the whole log. But that’s just me 🙂

nate 2020-09-21T14:26:44.031Z

It took me a bit to get used to the error reporting in conjure. Now I'm used to the terse default and use ,ve to show the whole stack trace. I think it's a good balance.

💯 1
dharrigan 2020-09-21T15:24:44.031500Z

I must be the weird one. I run my repl outside of Conjure and I see everything :)

orestis 2020-09-21T16:19:17.032100Z

I didn’t know there was a mapping, I’ll try that tomorrow.

2020-09-21T17:20:52.033300Z

I love this mapping!

❤️ 1
Olical 2020-09-21T17:29:18.033500Z

Only showing the last thing is definitely something worth considering

Olical 2020-09-21T17:29:48.033700Z

The current route just means "there's only ever one buffer and we get a little view of it" which is sometimes bad, sometimes good when you want to see a glimpse into your previous evals as the latest one comes back

Olical 2020-09-21T17:29:56.033900Z

I find that pretty helpful with my goldfish memory 😬

Olical 2020-09-21T17:31:04.034400Z

I rarely run my REPL inside nvim but when I do I use https://github.com/clojure-vim/vim-jack-in

Olical 2020-09-21T17:31:17.034700Z

Most of the time I'm REPLing into docker containers (plural)

dharrigan 2020-09-21T18:00:36.034900Z

What does vim-jack-in do?

dharrigan 2020-09-21T18:00:50.035100Z

I normally have two terms open, one for nvim + conjure, the other running clj

dharrigan 2020-09-21T18:01:24.035300Z

since clj is also running nrepl

dharrigan 2020-09-21T18:01:37.035500Z

I can simply require a namespace and try things out in the term

dharrigan 2020-09-21T18:01:41.035700Z

whilst evaling things in the nvim

Olical 2020-09-21T18:05:43.035900Z

Opens a terminal buffer/window/tab in nvim and runs lein/clj etc within it. That's all! It also injects all the magic cider nrepl middleware stuff which can be handy for off the cuff evals

Olical 2020-09-21T18:05:59.036100Z

But if you have a working script in another terminal you don't need it

Olical 2020-09-21T18:06:25.036300Z

I just use it where my CIDER/Emacs wielding team mates rely on their form of jack in, which usually means the project.clj isn't actually set up properly and they lean on CIDER's jack in

Olical 2020-09-21T18:06:42.036500Z

So I do the same but nvim equivalent where it makes sense