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

Watch file system for changes to .nrepl-port #37

Open
mhansen opened this issue Jul 9, 2017 · 7 comments
Open

Watch file system for changes to .nrepl-port #37

mhansen opened this issue Jul 9, 2017 · 7 comments

Comments

@mhansen
Copy link
Contributor

mhansen commented Jul 9, 2017

Currently, we try to updateConnectionParams() by reading the .nrepl-port file during extension activation (when a clojure file is first opened), then we try to auto-connect.

This fails when you open the clojure file first, then the repl after extension activation.

Perhaps we can setup a file watcher, and automatically connect to the repl if a .nrepl-port file becomes available?

This isn't a fully fleshed-out idea: we'll need to think a bit about how to handle a change the .nrepl-port file when we're already connected to a nrepl. Do we connect to the new one? Or keep the existing one - which may be closed, and maybe we haven't noticed it's gone? I'd propose taking the less-destructive route of staying with the existing REPL.

What do you think?

@avli
Copy link
Owner

avli commented Jul 9, 2017

That's actually a good suggestion. Any ideas how to implement the watcher properly?

@fasfsfgs
Copy link
Contributor

fasfsfgs commented Jul 9, 2017

Good idea indeed.

I wouldn't worry too much about previous nrepl connections since it is merely the information about the nrepl's server location. It is not something leaky like an actual open connection or anything like that.

@fasfsfgs
Copy link
Contributor

With #21, we start our own nrepl when the extension is activated.

But we still let the user connect to a custom running nrepl.

What could we do better here?
One thing that would be great is to at least watch for this .nrepl-port file and disconnect if it gets deleted (if the user chose to connect to that nrepl).

About changes to this file, what do you think @avli and @mhansen?

@mhansen
Copy link
Contributor Author

mhansen commented Jul 23, 2017 via email

@fasfsfgs
Copy link
Contributor

Yup. I completely agree the idea of connection is nonexistent here.
Any idea how to do that persistent TCP connection like in our case?

@mhansen
Copy link
Contributor Author

mhansen commented Jul 23, 2017 via email

@fasfsfgs
Copy link
Contributor

haha no worries. Your ideas and feedback are great imo. =)
I might have an idea to test about leaving a listener on a nrepl command we send and watch for anything to signals a "drop" of our connection.

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

3 participants