Skip to content

Commit

Permalink
Ensure candidate is valid in exit-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Jan 11, 2025
1 parent 51022dc commit bfa3e9e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lsp-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -684,25 +684,25 @@ Returns resolved completion item details."
CANDIDATE is the selected completion item.
Others: CANDIDATES"
(unwind-protect
(-let* ((candidate (if (plist-member (text-properties-at 0 candidate)
'lsp-completion-item)
candidate
(cl-find candidate (funcall candidates) :test #'equal)))
(candidate
;; see #3498 typescript-language-server does not provide the
;; proper insertText without resolving.
(if (lsp-completion--find-workspace 'ts-ls)
(lsp-completion--resolve candidate)
candidate))
((&plist 'lsp-completion-item item
'lsp-completion-start-point start-point
'lsp-completion-markers markers
'lsp-completion-resolved resolved
'lsp-completion-prefix prefix)
(text-properties-at 0 candidate))
((&CompletionItem? :label :insert-text? :text-edit? :insert-text-format?
:additional-text-edits? :insert-text-mode? :command?)
item))
(-when-let* ((candidate (if (plist-member (text-properties-at 0 candidate)
'lsp-completion-item)
candidate
(cl-find candidate (funcall candidates) :test #'equal)))
(candidate
;; see #3498 typescript-language-server does not provide the
;; proper insertText without resolving.
(if (lsp-completion--find-workspace 'ts-ls)
(lsp-completion--resolve candidate)
candidate))
((&plist 'lsp-completion-item item
'lsp-completion-start-point start-point
'lsp-completion-markers markers
'lsp-completion-resolved resolved
'lsp-completion-prefix prefix)
(text-properties-at 0 candidate))
((&CompletionItem? :label :insert-text? :text-edit? :insert-text-format?
:additional-text-edits? :insert-text-mode? :command?)
item))
(cond
(text-edit?
(apply #'delete-region markers)
Expand Down

0 comments on commit bfa3e9e

Please sign in to comment.