]> git.eshelyaron.com Git - emacs.git/commitdiff
Ensure exit-function of eglot-c-at-point runs on exact match
authorrbrtb <104695105+rbrtb@users.noreply.github.com>
Tue, 3 May 2022 09:53:17 +0000 (09:53 +0000)
committerGitHub <noreply@github.com>
Tue, 3 May 2022 09:53:17 +0000 (10:53 +0100)
When the completion is exact match, exit-function should still run.

Say one is using auto-imports feature of pyright.  One types foo, and
triggers the completion.  There are two candidates: foo and foo_bar.  If
one chooses foo, the status would be 'exact' instead of 'finished', thus
exit-function is not executed, foo is not auto-imported.

* eglot.el (eglot-completion-at-point): Consider 'exact status.

Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/941

lisp/progmodes/eglot.el

index 3d1b19c905ba5af9262c4c919b66b855117f623d..81c545e64f9c51181dad4307b83598cc2dd35fa7 100644 (file)
@@ -2649,7 +2649,7 @@ for which LSP on-type-formatting should be requested."
             (line-beginning-position))))
        :exit-function
        (lambda (proxy status)
-         (when (eq status 'finished)
+         (when (memq status '(finished exact))
            ;; To assist in using this whole `completion-at-point'
            ;; function inside `completion-in-region', ensure the exit
            ;; function runs in the buffer where the completion was