Skip to content

Commit e15a996

Browse files
authored
Make completion-lazy-hilit-fn run in the current typing buffer (#4797)
1 parent 09f16c7 commit e15a996

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lsp-completion.el

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -873,13 +873,15 @@ If the candidates is non-empty, return the passed STRING and POINT."
873873
"Passthrough all completions from TABLE with PRED."
874874
(defvar completion-lazy-hilit-fn)
875875
(when (bound-and-true-p completion-lazy-hilit)
876-
(setq completion-lazy-hilit-fn
877-
(lambda (candidate)
878-
(->> candidate
879-
lsp-completion--company-match
880-
(mapc (-lambda ((start . end))
881-
(put-text-property start end 'face 'completions-common-part candidate))))
882-
candidate)))
876+
(let ((buf (current-buffer)))
877+
(setq completion-lazy-hilit-fn
878+
(lambda (candidate)
879+
(with-current-buffer buf
880+
(->> candidate
881+
lsp-completion--company-match
882+
(mapc (-lambda ((start . end))
883+
(put-text-property start end 'face 'completions-common-part candidate))))
884+
candidate)))))
883885
(all-completions "" table pred))
884886

885887
;;;###autoload

0 commit comments

Comments
 (0)