Closed daveyarwood closed 5 years ago
Previous version was relying on a .nrepl-port
file on the local directory. This is still available on the server server side as a fallback, but I probably should move that to lua or remove it completely.
(to make my previous comment clearer)
After preparing the message to be sent to the nrepl, I send it to python which then sends through the socket. If I don't provide a connection (a tuple of [ip, port]), it will look for a local .nrepl-port
, but on python side.
That's interesting. How are you finding the nrepl port when there is no .nrepl-port
?
I phrased that poorly. I mean, how do you find the nrepl port before looking for the .nrepl-port
?
There are two functions on acid.connections
to add a connection and to connect to it. I'll add a command to invoke both functions so that's transparent.
Another, much simpler way is to use acid.nrepl.start
, as described in the docs here. For example:
"This will start a nrepl server with default arguments and cider and refactor-nrepl middlewares.
lua require("acid.nrepl").start{}
"This will start a nrepl server with only the piggieback middleware.
lua require("acid.nrepl").start{middlewares = {"cider/piggieback"}}
Also, one can use jazz.nvim, which is a set of extensions of acid that make use of impromptu.nvim to have interactive menus.
I splitted that from acid since I didn't want to impose another extra dependency, so the menus are opt-in.
Oh, cool -- I didn't realize that you can use acid to start an nREPL. I'll have to play around with that.
My typical workflow is usually to start my own nREPL in another terminal, so that I can have more control over the environment, dependencies, etc. There will often be old .nrepl-port
files laying around from previous REPL sessions, so if I'm understanding correctly, acid is trying to connect on those old ports and bombing out.
In that case, maybe a good error message would be something like "Unable to connect to nREPL on port 12345."
That is possible to happening, yes. I think it's safe to assume that either way I should stop doing that on python and try to find my way through with lua, so one could auto-connect if a .nrepl-port
file is found and a connection is active.
I'll look into it. :)
I believe this one is fixed now by 9667705, but I'll keep this open so I remember to refactor the python end.
The issue is fixed from my perspective. :+1:
BTW, I discovered something interesting. At least with Boot, when you quit the REPL by either running (quit)
or pressing Ctrl-D, it actually removes the .nrepl-port
file! So I think my theory about acid trying to connect to previous REPL sessions because there are old .nrepl-port
files laying around was incorrect.
At any rate, things are feeling much nicer now. Much appreciated!
Awesome! I'm really glad those issues are being solved and the experience of using acid is getting nicer :)
Please don't refrain from opening issues and let me know if you have any other problems or suggestions!
I'll close this now, but, as always, feel free to reopen if needed.
Cheers, Henry
This is just a little thing I noticed where the experience could be a bit nicer:
If I don't have a REPL running, and I run
:AcidRequire
, I get this uncaught error:It would be nice if acid could recognize this scenario and say "No REPL found" or something.