Fork me on GitHub
#conjure
<
2020-04-05
>
Olical14:04:44

With regards to doc lookup: I'm thinking of having a <localleader>d_ prefix, where _ is what you want the doc of. So like ee evals the current form, de would doc the head of your expression. In a defn somewhere you could use dr to doc the root (the defn macro). dw would doc the element under the cursor like K would normally. Doc output will appear in the log and the HUD will show it to you.

Olical14:04:20

So you can ask for the doc of the symbol under your cursor, the head of your form or the head of the root form.

Olical14:04:35

Or should it just be "doc thing under cursor" as usual?

Olical14:04:22

I like the idea of being able to doc at an element or form level but I'm not sure if it's too specific. I like this level of specificity that allows me to ask for things without moving my cursor so much.

Nir Rubinstein14:04:21

Personally, really gotten used to "doc things under the cursor" with K

dharrigan14:04:37

I too am used to K, however, I can adapt if need be 🙂

Olical14:04:10

Hmm food for thought then! K will be easier to implement anyway, I'll stick with that for now.

Olical14:04:56

Also just wrote some checks so if your cursor is in the top right corner (by dividing your editor into four equal corners) it'll move the hud to the bottom right.

Olical14:04:39

So the HUD is always on the right and tries to be at the top, unless your cursor is in that area. By giving it some extra padding (not checking if it'll exactly cover the cursor) we avoid hiding parts of a form you're interested in with results.

Olical14:04:56

If you mainly edit one buffer at a time on the left of your screen you'll probably rarely see it move.

👍 8
Olical16:04:37

Now the HUD won't appear if you have a log buffer open with your cursor at the bottom. Since that's following along with the eval results anyway. You can however open the log, pin it to some past result by moving your cursor there and then continue to eval. The results WILL appear in the HUD since you can't see them at the bottom of the log, you're looking elsewhere!

💯 4
Olical16:04:10

More of my "try to do the right thing given passive input", so you just go about your business and I'll try to show you what's important without repeating in multiple place on the screen.

Olical16:04:42

Feel free to try out the sourcery repo. Start an nREPL with a .nrepl-port file, open a Clojure file, eval with <localleader>ee etc.

Olical16:04:47

K will do doc under cursor.

Olical16:04:12

You can also eval text objects and motions with <localleader>E<motion>.

Olical16:04:22

Or visual select and hit <localleader>E.

Olical16:04:34

Or type into :ConjureEval ....

Olical16:04:42

I really need to document 😬

Olical16:04:40

Doc isn't working with piggieback CLJS, it doesn't send the output to the right place, figwheel is probably fine.

dharrigan16:04:33

The hud is pretty darn neat

dharrigan16:04:53

Perhaps I missed this, but what are you using to bring up the other split to eval into?

Olical16:04:29

That's the log buffer, <localleader>lv is vertical, ls is horizontal (like split and vsplit) and lt is a new tab you can close whenever. (like a fullscreen mapping)

dharrigan16:04:48

cool, is that in conjure presently?

Olical16:04:56

The log buffer?

dharrigan16:04:13

yes - I know what the answer to this is going to be 🙂

dharrigan16:04:24

I don't think I've used tabs ever in vim 😉

dharrigan16:04:32

windows all the way for me!

Olical16:04:34

<localleader>cl to open, cq to close and cL to toggle 😄

Olical16:04:47

I like tabs for fullscreen while leaving my old windows in palce

Olical16:04:54

I can just :q and pop back to what I was doing

Olical16:04:15

I have <leader>wm mapped to pop the current window into a new tab, think window maximise

dharrigan16:04:11

You know, I thought the log buffer wasn't writable, just read-only

Olical16:04:23

Oh no! That's a core part of the design!

dharrigan16:04:26

Just wrote a little defn in the log buffer, eval'ed the form and used it

Olical16:04:27

Edit and eval away in there

Olical16:04:32

It's a scratch eval buffer and a log

Olical16:04:56

Yep! Can't remember which namespace it comes under, probably user?

Olical16:04:05

Or cljs.user if you're in cljs

Olical16:04:26

JVM Conjure may be inconsistent but Lua Conjure should always be user and cljs.user.

Olical16:04:54

Yeah, I use that buffer all the time. Work a lot more like a terminal REPL in Lua Conjure too

dharrigan16:04:22

I'm looking forward to when what you have is ready for beta testing 🙂

dharrigan16:04:31

take your time 'tho 🙂

Olical16:04:37

I'm looking forward to all the bugs people find 😄

Olical16:04:32

Already got people asking on twitter for other lisps support too. https://janet-lang.org/ is now on the list beside MIT Scheme and Racket.

Olical16:04:04

Babashka should just work with Clojure support.

Olical16:04:54

Although I think I need to improve my bencode parsing into a more streamy / buffered model to work with bb.

Olical16:04:03

My initial connection resulted in errors.

Olical16:04:22

@borkdude any thoughts on writing a .nrepl-port file from bb?

Olical16:04:33

(awesome work btw, it's such a cool feature)

borkdude20:04:38

@olical What would you be using the .nrepl-port file for, can you describe the workflow? Maybe it can be solved differently with bb. I think PEZ and I also talked about this.

Olical20:04:52

Oh, it's a file the nREPL server writes when it starts up. Since it starts on a random port it writes that port into the file, then things like Cider and Conjure check for it when connecting. That way you can just assume if that file exists, you can connect to it. Or try to anyway.

Olical20:04:12

I think lein repl creates one too? I thought it was the convention for any CLI nREPL client to create it.

Olical20:04:24

Like with propel, I create a .prepl-port file

Olical20:04:58

Should've replied with a thread, oops. To make sure you get a notification, here's an @. @borkdude

borkdude20:04:19

@olical Babashka doesn't start an nREPL server on a random port, it also doesn't do this for the socket REPL

Olical20:04:54

Ah, okay, well no problem then. With propel I made it so if you didn't specify a port it'd pick one and write to the file which ended up being nice for tooling. It's not a big deal really, I just like port files 😅

borkdude20:04:46

What I suggested to pez was basically (from Calva) do something like:

FREE_PORT=$(bb '(defn random-free-port [] (let [n (rand-nth (range 1000 10000))] (try (.Socket. n) (recur) (catch Exception _ n)))) (random-free-port)')
bb --nrepl-server $FREE_PORT

borkdude20:04:14

and then you can use (wait/wait-for-port "localhost" FREE_PORT) to wait for the server to become ready

borkdude20:04:40

so you can discover a free port, start the nrepl server and wait for the server to become available, all with the same tool

pyrmont23:04:24

Janet looks neat.

rafaeldelboni12:04:34

Just misses a LSP implementation and would be too good to be true

pyrmont23:04:55

CSP, do you mean?

pyrmont23:04:47

I need to read more about LSP. I'm still a little unsure on how good a fit they are with Lisps.

pyrmont23:04:54

Thanks for the link!

rafaeldelboni23:04:32

They fit great! I use full time with clojure, is amazing

pyrmont23:04:30

Oh awesome! I'd read about LSP a while back before (I think) this project existed and was curious about how it could be implemented. Something to read about this morning!