This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-05
Channels
- # announcements (3)
- # babashka (135)
- # beginners (82)
- # calva (55)
- # chlorine-clover (23)
- # cider (13)
- # clara (1)
- # clj-kondo (39)
- # cljs-dev (1)
- # cljsrn (2)
- # clojure (96)
- # clojure-france (3)
- # clojure-uk (24)
- # clojuredesign-podcast (1)
- # clojurescript (56)
- # conjure (73)
- # core-typed (1)
- # cursive (1)
- # datomic (10)
- # fulcro (57)
- # joker (4)
- # juxt (1)
- # malli (20)
- # meander (2)
- # off-topic (54)
- # re-frame (4)
- # reagent (3)
- # shadow-cljs (11)
- # spacemacs (6)
- # sql (26)
- # tools-deps (7)
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.
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.
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.
Personally, really gotten used to "doc things under the cursor" with K
Hmm food for thought then! K
will be easier to implement anyway, I'll stick with that for now.
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.
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.
If you mainly edit one buffer at a time on the left of your screen you'll probably rarely see it move.
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!
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.
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.
Doc isn't working with piggieback CLJS, it doesn't send the output to the right place, figwheel is probably fine.
Perhaps I missed this, but what are you using to bring up the other split to eval into?
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)
I have <leader>wm
mapped to pop the current window into a new tab, think window maximise
Yeah, I use that buffer all the time. Work a lot more like a terminal REPL in Lua Conjure too
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.
Although I think I need to improve my bencode parsing into a more streamy / buffered model to work with bb.
@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.
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.
I think lein repl creates one too? I thought it was the convention for any CLI nREPL client to create it.
Should've replied with a thread, oops. To make sure you get a notification, here's an @. @borkdude
@olical Babashka doesn't start an nREPL server on a random port, it also doesn't do this for the socket REPL
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 😅
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
and then you can use (wait/wait-for-port "localhost" FREE_PORT)
to wait for the server to become ready
so you can discover a free port, start the nrepl server and wait for the server to become available, all with the same tool
Just misses a LSP implementation and would be too good to be true
I need to read more about LSP. I'm still a little unsure on how good a fit they are with Lisps.
They fit great! I use full time with clojure, is amazing