Skip to content

Commit 87d60a3

Browse files
committed
Don't abuse `ivy-configure' + display-transformer
Fixes #18.
1 parent 20cac62 commit 87d60a3

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

lsp-ivy.el

+7-15
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,7 @@
118118
(cons string face)
119119
(cons string face)))
120120

121-
(eval-when-compile
122-
(lsp-interface
123-
(lsp-ivy:FormattedSymbolInformation
124-
(:kind :name :location :textualRepresentation)
125-
(:containerName :deprecated))))
126-
127-
(lsp-defun lsp-ivy--workspace-symbol-action
121+
(lsp-defun lsp-ivy--goto-symbol
128122
((&SymbolInformation
129123
:location (&Location :uri :range (&Range :start (&Position :line :character)))))
130124
"Jump to selected candidate."
@@ -134,7 +128,7 @@
134128
(forward-char character))
135129

136130
(lsp-defun lsp-ivy--format-symbol-match
137-
((&SymbolInformation :name :kind :container-name? :location (&Location :uri))
131+
((&SymbolInformation :name :kind :container-name? :deprecated? :location (&Location :uri))
138132
project-root)
139133
"Convert the match returned by `lsp-mode` into a candidate string."
140134
(let* ((type (elt lsp-ivy-symbol-kind-to-face kind))
@@ -156,8 +150,11 @@ FILTER-REGEXPS?, otherwise convert it to an `lsp-ivy:FormattedSymbolInformation'
156150
(let ((textual-representation
157151
(lsp-ivy--format-symbol-match symbol-information workspace-root)))
158152
(when (--all? (string-match-p it textual-representation) filter-regexps?)
159-
(lsp-put symbol-information :textualRepresentation textual-representation)
160-
symbol-information))))
153+
(cons textual-representation symbol-information)))))
154+
155+
(lsp-defun lsp-ivy--workspace-symbol-action ((_ . sym))
156+
"Jump to the `cdr' of INPUT0, an `&SymbolInformation'."
157+
(lsp-ivy--goto-symbol sym))
161158

162159
(defun lsp-ivy--workspace-symbol (workspaces prompt initial-input)
163160
"Search against WORKSPACES with PROMPT and INITIAL-INPUT."
@@ -197,11 +194,6 @@ FILTER-REGEXPS?, otherwise convert it to an `lsp-ivy:FormattedSymbolInformation'
197194
:action #'lsp-ivy--workspace-symbol-action
198195
:caller 'lsp-ivy-workspace-symbol)))
199196

200-
(ivy-configure 'lsp-ivy-workspace-symbol
201-
:display-transformer-fn
202-
(-lambda ((&lsp-ivy:FormattedSymbolInformation :textual-representation))
203-
textual-representation))
204-
205197
;;;###autoload
206198
(defun lsp-ivy-workspace-symbol (arg)
207199
"`ivy' for lsp workspace/symbol.

0 commit comments

Comments
 (0)