Skip to content

Commit 730ca66

Browse files
committed
Make lsp-completion--resolve[-async] public
1 parent 6fb5c2b commit 730ca66

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
@@ -187,7 +187,7 @@ See #2675"
187187
(unless (lsp-get data :import_for_trait_assoc_item)
188188
(lsp-put data :import_for_trait_assoc_item :json-false)))))
189189

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

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

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

469473
(unless (or resolved (and detail? documentation?))
470-
(setq completion-item (get-text-property 0 'lsp-completion-item (lsp-completion--resolve item))
474+
(setq completion-item (get-text-property 0 'lsp-completion-item (lsp-completion-resolve item))
471475
resolved t))
472476

473477
(setq detail? (lsp:completion-item-detail? completion-item)
@@ -672,7 +676,7 @@ Others: CANDIDATES"
672676
;; see #3498 typescript-language-server does not provide the
673677
;; proper insertText without resolving.
674678
(if (lsp-completion--find-workspace 'ts-ls)
675-
(lsp-completion--resolve candidate)
679+
(lsp-completion-resolve candidate)
676680
candidate))
677681
((&plist 'lsp-completion-item item
678682
'lsp-completion-start-point start-point
@@ -714,14 +718,14 @@ Others: CANDIDATES"
714718
(not (seq-empty-p additional-text-edits?)))
715719
(lsp--apply-text-edits additional-text-edits? 'completion)
716720
(-let [(callback cleanup-fn) (lsp--create-apply-text-edits-handlers)]
717-
(lsp-completion--resolve-async
721+
(lsp-completion-resolve-async
718722
item
719723
(-compose callback #'lsp:completion-item-additional-text-edits?)
720724
cleanup-fn))))
721725

722726
(if (or resolved command?)
723727
(when command? (lsp--execute-command command?))
724-
(lsp-completion--resolve-async
728+
(lsp-completion-resolve-async
725729
item
726730
(-lambda ((&CompletionItem? :command?))
727731
(when command? (lsp--execute-command command?)))))

0 commit comments

Comments
 (0)