diff options
| author | João Távora | 2023-03-29 19:30:04 +0100 |
|---|---|---|
| committer | João Távora | 2023-04-02 23:40:46 +0100 |
| commit | ad1efe5e675216e1f1f342fc9d48018fac718b5e (patch) | |
| tree | e9bfb4aaeb3e1e40fb58024201286d53bd6c00fa /java | |
| parent | d00e05daa96700860dbb9dc6527105e464ffb960 (diff) | |
| download | emacs-ad1efe5e675216e1f1f342fc9d48018fac718b5e.tar.gz emacs-ad1efe5e675216e1f1f342fc9d48018fac718b5e.zip | |
Eglot: improve caching in eglot-completion-at-point
When answering the :textDocument/completion request, LSP servers
provide a :isIncomplete flag in the response, which allows Eglot to
know if "further typing should result in recomputing [the completions]
list.
If :isIncomplete is false (i.e. the full set was returned), Eglot
caches the response in a global variable eglot--capf-cache that
persists for the duration of the "completion session", taken to be the
interval between two calls to completion-in-region-mode.
If the cache has been set, and Eglot detects that "further typing" has
happened, it is safe to use the cache instead of making a request to
the server.
Thus eglot--capf-cache-flush, added to completion-in-region-mode-hook,
is used to flush this cache. Since the popular Company completion
package doesn't use completion-in-region-mode, eglot--capf-cache-flush
is also added to its company-after-completion-hook.
* lisp/progmodes/eglot.el (eglot--managed-mode): Set
'completion-in-region-mode-hook and company-after-completion-hook.
(eglot--capf-cache): New variable.
(eglot--capf-cache-flush): New function.
(eglot-completion-at-point): Rework.
* etc/EGLOT-NEWS: Update.
Diffstat (limited to 'java')
0 files changed, 0 insertions, 0 deletions