From edae1e107c3ffa3ba7e2fb65a768a67073f5ed91 Mon Sep 17 00:00:00 2001 From: Sebastien Chapuis Date: Sat, 14 Oct 2023 11:23:48 +0200 Subject: [PATCH] Fix `lsp-completion--company-match` freezing #4192 Consider only the first line in `prefix` --- lsp-completion.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lsp-completion.el b/lsp-completion.el index 97b1555a053..c9b4d99fd58 100644 --- a/lsp-completion.el +++ b/lsp-completion.el @@ -351,6 +351,10 @@ The MARKERS and PREFIX value will be attached to each candidate." (buffer-substring-no-properties (plist-get (text-properties-at 0 candidate) 'lsp-completion-start-point) (point)))) + ;; Workaround for bug #4192 + ;; `lsp-completion-start-point' above might be from cached/previous completion and + ;; pointing to a very distant point, which results in `prefix' being way to long. + (prefix (car (string-lines prefix))) (prefix-len (length prefix)) (prefix-pos 0) (label (downcase candidate))