From 4beab004d98f17f830600b4597315f030a7313c3 Mon Sep 17 00:00:00 2001 From: rbrtb <104695105+rbrtb@users.noreply.github.com> Date: Tue, 3 May 2022 09:53:17 +0000 Subject: [PATCH] Ensure exit-function of eglot-c-at-point runs on exact match 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 3d1b19c905b..81c545e64f9 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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 -- 2.39.5