Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 75ae6c8

Browse files
committedNov 6, 2020
Don't abuse `ivy-configure' + display-transformer
Fixes #18.
1 parent e3c675b commit 75ae6c8

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* ((sanitized-kind (if (< kind (length lsp-ivy-symbol-kind-to-face)) kind 0))
@@ -157,8 +151,11 @@ FILTER-REGEXPS?, otherwise convert it to an `lsp-ivy:FormattedSymbolInformation'
157151
(let ((textual-representation
158152
(lsp-ivy--format-symbol-match symbol-information workspace-root)))
159153
(when (--all? (string-match-p it textual-representation) filter-regexps?)
160-
(lsp-put symbol-information :textualRepresentation textual-representation)
161-
symbol-information))))
154+
(cons textual-representation symbol-information)))))
155+
156+
(lsp-defun lsp-ivy--workspace-symbol-action ((_ . sym))
157+
"Jump to the `cdr' of INPUT0, an `&SymbolInformation'."
158+
(lsp-ivy--goto-symbol sym))
162159

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.