Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spit an additional .nrepl-port file? #64

Open
vemv opened this issue Aug 11, 2023 · 7 comments
Open

Spit an additional .nrepl-port file? #64

vemv opened this issue Aug 11, 2023 · 7 comments

Comments

@vemv
Copy link

vemv commented Aug 11, 2023

For clojure-emacs/cider#3400, it would be nice if babashka-nrepl spat a file named e.g. .bb/nrepl.port in addition to its current, vanilla one, so that it's uniquely identifiable as coming from bb.

That way, M-x cider-connect would be able to display something like mydir:34567 (bb) (see screenshot in issue as well)

wdyt?

Cheers - V

@borkdude
Copy link
Contributor

There is no current vanilla one AFAIK. There have been issues about this:

babashka/babashka#1032
babashka/babashka#157

One of the issues is: you can have multiple nREPL servers running simultaneously AND there could be Clojure JVM nREPL servers running.

@vemv
Copy link
Author

vemv commented Aug 11, 2023

Oh, got it

I would be OK with a some sort of bespoke, conflict-free format e.g. a single .bb-nrepl.edn file with info regarding all current bb nrepl ports open within the current directory.

IDK if these nrepl processes can have a name associated somehow, in which case that info could also be included.

Final, ideal result: mydir:34567 (bb, backend) | mydir:34568 (bb, frontend)

@vemv
Copy link
Author

vemv commented Aug 11, 2023

There is no current vanilla one AFAIK

btw, after clojure-emacs/cider#3399 we don't always need .nrepl-port files - they're used, but we also ps for nrepl-like processes.

Current command is ps u | grep java | grep -v leiningen | grep nrepl.cmdline, if we'd need to expand it to include bb processes, please let us know

@borkdude
Copy link
Contributor

babashka nrepl is started using bb nrepl-server usually, so grepping like that could work. But that invocation only works on linux-like OS-ses I guess?

@borkdude
Copy link
Contributor

Writing one .edn file for all processes is a bit complex, since one process can overwrite while one process is busy writing the file

Would it be a solution to write .bb-<pid>-nrepl-port, which would be cleaned up after babashka exited?
The pid would take care of conflicts between multiple processes. If there are multiple on disk, I don't know how CIDER would select the right one though.

@vemv
Copy link
Author

vemv commented Aug 18, 2023

(sorry for the delay)

Would it be a solution to write .bb--nrepl-port, which would be cleaned up after babashka exited?

It sounds good to me. We'd have to ls but it seems no big deal

If there are multiple on disk, I don't know how CIDER would select the right one though.

It's no issue, we let users choose (see clojure-emacs/cider#3400 screenshot)

For the users to make an optimal decision, it would be nice if .bb-<pid>-nrepl-port could have contain not only a port but an identifier ("backend", "frontend"), assuming that's a piece of info that can be available somehow.

@vemv
Copy link
Author

vemv commented Sep 28, 2023

Not going to be that needed after clojure-emacs/cider#3489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants