Skip to content

Commit

Permalink
Fix lsp-completion--company-match freezing emacs-lsp#4192
Browse files Browse the repository at this point in the history
Consider only the first line in `prefix`
  • Loading branch information
sebastiencs committed Oct 14, 2023
1 parent 9c3ebe4 commit accd30b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lsp-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ 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 too long.
;; So let's consider only the first line.
(prefix (car (string-lines prefix)))
(prefix-len (length prefix))
(prefix-pos 0)
(label (downcase candidate))
Expand Down

0 comments on commit accd30b

Please sign in to comment.