-
Notifications
You must be signed in to change notification settings - Fork 201
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
Tune File Notify Watchers to share directory file descriptors #1228
Conversation
* The same file descriptors will be shared across same server watchers. * When watcher cap unregs, only watcher unique descriptors are rm'd. * When directory created event, add a new watcher for it. * Send eglot--error to eglot-message, like eglot--warn aleady does. * Discussion: #1226
This is very interesting, but please explain again what current wasteful behaviour is with a toy example, so that I can understand it. Then explain how your implementation solves this problem. |
Added the "toy example" testing items for demonstration to setup a overly large python virtual environment. Then will load up a python file with eglot, and after each call of
With pyright Here is how it outputs for me, with first run using normal eglot.el, and second run using updated.
I have included rust and js LSP's in the update, just for extra info. Rust LSP also sends the Anyway, just wanted to finalize this for you since you requested and so you have it. |
Sorry, this is too complicated for me to run and decipher. I didn't explain myself, a toy example as I envisioned it couldstart from the MRE (the bit that contains an It might not me necessary at this point, as I think I have understood the problem sufficiently well, But it might still be a nice-to-have. So we could start with this.
|
Oops, I definitely over thought toy example. This is probably as tight as I can get it.
Once inside of emacs, paste this into scratch and eval-buffer:
In Messages buffer, you should see something like:
When that number doubles, that means the file notifiers are duplicated. You can then load the eglot.el from this PR, and restart eglot and you should just see this:
which means the file notifiers were not doubled. |
Thanks, this is good and a good test. In fact, it would be easy to make this an automated test |
I've now pushed changes to the same effect to Emacs master, so we should get these enhancements in the next Eglot release: |
GitHub-reference: joaotavora/eglot#1228 GitHub-reference: joaotavora/eglot#1226 The Pyright language server issues very heavy file watching requests, which sometimes exceed the OS limit. Most of these file watches are useless, but Pyright insists on issuing them. What's more, for some (absurd?) reason, Pyright issues two file watching requests for the _same_ directories, only to then almost immediately ask to undo the effects of one of these requests. This change to Eglot makes it so that if a single server requests to watch a specific directory twice, only one file watch object is used. Suggested by: https://github.com/thejeffphil * lisp/progmodes/eglot.el (eglot-lsp-server): Change structure of file-watches field. (eglot--on-shutdown): Adapt to new structure. (eglot-register-capability): Rework. (eglot-unregister-capability): Rework. * etc/EGLOT-NEWS: Mention change
GitHub-reference: joaotavora/eglot#1228 GitHub-reference: joaotavora/eglot#1226 * lisp/progmodes/eglot.el (eglot-register-capability): Rework. Suggested by: https://github.com/thejeffphil
Note: Eglot is part of Emacs, this PR is just for discussion purposes on #1226. And if discussion goes well, I will complete necessary required paperwork.