]> git.eshelyaron.com Git - emacs.git/commit
Eglot: try reuse file watchers when server over-watches
authorJoão Távora <joaotavora@gmail.com>
Thu, 8 Jun 2023 01:19:06 +0000 (02:19 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 8 Jun 2023 14:08:46 +0000 (15:08 +0100)
commit433a452814fb9eb443819d5a21324364d2600116
tree2a592b1e5b93570bf3bfab5d4abb1c8419a235ee
parent46b6d175054e8f6bf7cb45e112048c0cf02bfee9
Eglot: try reuse file watchers when server over-watches

GitHub-reference: https://github.com/joaotavora/eglot/pull/1228
GitHub-reference: https://github.com/joaotavora/eglot/discussions/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
etc/EGLOT-NEWS
lisp/progmodes/eglot.el