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)
Sergiusz Bleja 2020-07-04T12:23:47.374300Z

I'm using the conjure dev shadow setup with the foo.cljs in the same repo. Run the ./nrepl-shadow.sh first and then started neovim. It seems like conjure assumes the n-repl connection is clojure. If I have the browser open on the page it sets it to clojurescript. Not sure whether this is default behaviour but it confused me quite a bit before I found a way around it.

Olical 2020-07-04T12:26:50.374600Z

This is a shadow + nREPL specific behavior, if there's no ClojureScript runtime connected (like a browser) then you're basically in Clojure land still. I may be misunderstanding here, but are you saying the order in which you boot things up / connect determines if it's going to work or not?

Olical 2020-07-04T12:27:28.374800Z

I tend to get shadow running my terminal, connect my browser, ensure it's all good and then connect Conjure when I know the nREPL server is all happy and connected.

👍 1
Olical 2020-07-04T12:27:52.375Z

If you want to reconnect you could try ,sQ to kill all sessions and then reconnect with :ConjureShadowSelect app

2020-07-04T14:05:41.376500Z

I know this isn't conjure related, but how would y'all recommend making a binding that calls one of your own functions on the result of an evaluation?

Sergiusz Bleja 2020-07-04T14:10:57.376600Z

Ok, thanks for clarifying - it makes sense. I think my mental model sort of missed that the browser is the runtime in this case.

Olical 2020-07-04T14:11:57.376900Z

Yup, it's conjure <-> shadow <-> browser, so if the browser isn't there, shadow has no CLJS. Shadow is the mediator between the browser's runtime and Conjure, Conjure never gets to talk to the browser directly. If that makes sense?

Olical 2020-07-04T14:19:14.377100Z

:thinking_face: you mean go and do an evaluation then call a function with the resulting string?

Olical 2020-07-04T14:19:43.377300Z

Because there's support inside Conjure to do this since all evaluations in practice are async. So it needs to be callback based.

Olical 2020-07-04T14:20:39.377500Z

I actually started writing up some docs for hooking into internal Conjure functions through Lua. This might be helpful https://github.com/Olical/conjure/wiki/Using-Conjure-programatically-(API)#evaluating-code

2020-07-04T14:22:13.378Z

Thanks!!

Olical 2020-07-04T14:23:05.379100Z

I've pushed some new functionality to develop that the previous generation of Conjure had: Resolving of file paths on eval to be relative to your CWD. This means that you can use &lt;localleader&gt;ef on files from your local disk while evaluating on a remote server or inside a docker container that doesn't share the same absolute path.

Olical 2020-07-04T14:23:42.379900Z

There's options to change the root it's resolved against in the case that your Neovim and JVM CWD are out of line as well as an option to turn this off entirely.

Olical 2020-07-04T14:24:39.380800Z

It shouldn't be noticeable for the most part, but if you regularly evaluate files within docker containers etc then it should just start working! (once it's released)

Sergiusz Bleja 2020-07-04T14:29:52.380900Z

Yes, it does - nowhere to evaluate.

Olical 2020-07-04T15:41:12.382300Z

Another feature on develop! I've addressed https://github.com/Olical/conjure/issues/104 with these options: https://github.com/Olical/conjure/blob/ca7ad6b8bfd72c89512fee0b274e250754ea9dc3/doc/conjure-client-clojure-nrepl.txt#L157-L166 So data structures will be elided past a certain length or depth automatically (as long as you have pretty printing enabled, which is on by default). This should save you from accidentally printing the universe, I hope.

Olical 2020-07-04T15:41:43.383100Z

Maybe the depth should be something more like 10-20. Any thoughts on these defaults (depth: 50, length: 500) is greatly appreciated!

Olical 2020-07-04T15:42:02.383700Z

You can set them to false to remove these limits when required, but most people won't have to ever worry about this, I hope.

dharrigan 2020-07-04T18:21:56.384200Z

I don't have any strong views on the defaults. Then again, I don't parse huge data structures atm 🙂

dave 2020-07-04T19:43:22.384600Z

limiting by default sounds like a good idea to me!

dave 2020-07-04T19:43:38.385Z

as long as the limit is reasonably high that it doesn't feel like it will get in the way

dave 2020-07-04T19:43:49.385300Z

and if it's configurable, that's even better