Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix eglot-completion-at-point to work with bare completion-at-point
Fixes #313, fixes #311, fixes #279 As is well known, LSP's and Emacs's completion mechanics don't fit very well together, mostly because Emacs expects completion to be a something of a pure function of a string argument and LSP treats as a function of a concrete buffer position. A further complication arises because some completion frontends like "bare" completion-at-point make Emacs modify the buffer's contents during the completion process, while other (notably company-mode) don't do that. Thus, 'eglot-completion-at-point' must take extra care to answer to the questions listed in the "(elisp)Programmed Completion" info node based on its (quite hacky) "completions" local var and _not_ based on the intermediate buffer contents. That var is also used to cache the last LSP response and allow the :exit-function callback to retrieve much more than just the completion text in In yet another related problem, :exit-function won't be called at all with completion-at-point if the completion table doesn't answer properly to test-completion. A previous use of completion-table-dynamic was found to be unsuitable here: we must answer all the requests separately. * eglot.el (eglot-completion-at-point): Rework. #313: joaotavora/eglot#313 #311: joaotavora/eglot#311 #279: joaotavora/eglot#279
- Loading branch information