Skip to content

Commit caf1e1d

Browse files
Use ivy's display-transformer, remove local candidate cache
1 parent 4625892 commit caf1e1d

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

lsp-ivy.el

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151

5252
(defun lsp-ivy--workspace-symbol (workspaces prompt initial-input)
5353
"Search against WORKSPACES with PROMPT and INITIAL-INPUT."
54-
(let ((candidates nil)
55-
(current-request-id nil))
54+
(let ((current-request-id nil))
5655
(ivy-read
5756
prompt
5857
(lambda (user-input)
@@ -67,23 +66,17 @@
6766
(plist-get request :id))
6867
(lsp-send-request-async
6968
request
70-
(lambda (incoming-candidates)
71-
(ivy-update-candidates
72-
(mapcar
73-
#'lsp-ivy--format-symbol-match
74-
(setq candidates incoming-candidates))))
69+
#'ivy-update-candidates
7570
:mode 'detached)))
7671
0)
7772
:dynamic-collection t
7873
:require-match t
7974
:initial-input initial-input
80-
:action (lambda (result)
81-
(let ((match
82-
(cl-find-if
83-
(lambda (it) (string-equal result (lsp-ivy--format-symbol-match it)))
84-
candidates)))
85-
(when match
86-
(lsp-ivy--workspace-symbol-action match)))))))
75+
:action #'lsp-ivy--workspace-symbol-action
76+
:caller 'lsp-ivy-workspace-symbol)))
77+
78+
(ivy-configure 'lsp-ivy-workspace-symbol
79+
:display-transformer-fn #'lsp-ivy--format-symbol-match)
8780

8881
;;;###autoload
8982
(defun lsp-ivy-workspace-symbol (arg)

0 commit comments

Comments
 (0)