Skip to content

Commit 1111c94

Browse files
committed
Make lsp-completion--resolve[-async] public
1 parent 5bc2096 commit 1111c94

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lsp-completion.el

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ See #2675"
186186
(unless (lsp-get data :import_for_trait_assoc_item)
187187
(lsp-put data :import_for_trait_assoc_item :json-false)))))
188188

189-
(defun lsp-completion--resolve (item)
189+
(defun lsp-completion-resolve (item)
190190
"Resolve completion ITEM.
191191
ITEM can be string or a CompletionItem"
192192
(cl-assert item nil "Completion item must not be nil")
@@ -211,7 +211,9 @@ ITEM can be string or a CompletionItem"
211211
item))
212212
(_ completion-item)))))
213213

214-
(defun lsp-completion--resolve-async (item callback &optional cleanup-fn)
214+
(defalias 'lsp-completion--resolve 'lsp-completion-resolve)
215+
216+
(defun lsp-completion-resolve-async (item callback &optional cleanup-fn)
215217
"Resolve completion ITEM asynchronously with CALLBACK.
216218
The CLEANUP-FN will be called to cleanup."
217219
(cl-assert item nil "Completion item must not be nil")
@@ -242,6 +244,8 @@ The CLEANUP-FN will be called to cleanup."
242244
(funcall callback completion-item)
243245
(when cleanup-fn (funcall cleanup-fn))))))
244246

247+
(defalias 'lsp-completion--resolve-async 'lsp-completion-resolve-async)
248+
245249
(defun lsp-completion--annotate (item)
246250
"Annotate ITEM detail."
247251
(-let (((completion-item &as &CompletionItem :detail? :kind? :label-details?)
@@ -466,7 +470,7 @@ The MARKERS and PREFIX value will be attached to each candidate."
466470
completion-item))
467471

468472
(unless (or resolved (and detail? documentation?))
469-
(setq completion-item (get-text-property 0 'lsp-completion-item (lsp-completion--resolve item))
473+
(setq completion-item (get-text-property 0 'lsp-completion-item (lsp-completion-resolve item))
470474
resolved t))
471475

472476
(setq detail? (lsp:completion-item-detail? completion-item)
@@ -671,7 +675,7 @@ Others: CANDIDATES"
671675
;; see #3498 typescript-language-server does not provide the
672676
;; proper insertText without resolving.
673677
(if (lsp-completion--find-workspace 'ts-ls)
674-
(lsp-completion--resolve candidate)
678+
(lsp-completion-resolve candidate)
675679
candidate))
676680
((&plist 'lsp-completion-item item
677681
'lsp-completion-start-point start-point
@@ -713,14 +717,14 @@ Others: CANDIDATES"
713717
(not (seq-empty-p additional-text-edits?)))
714718
(lsp--apply-text-edits additional-text-edits? 'completion)
715719
(-let [(callback cleanup-fn) (lsp--create-apply-text-edits-handlers)]
716-
(lsp-completion--resolve-async
720+
(lsp-completion-resolve-async
717721
item
718722
(-compose callback #'lsp:completion-item-additional-text-edits?)
719723
cleanup-fn))))
720724

721725
(if (or resolved command?)
722726
(when command? (lsp--execute-command command?))
723-
(lsp-completion--resolve-async
727+
(lsp-completion-resolve-async
724728
item
725729
(-lambda ((&CompletionItem? :command?))
726730
(when command? (lsp--execute-command command?)))))

0 commit comments

Comments
 (0)