Skip to content

Commit

Permalink
Don't abuse `ivy-configure' + display-transformer
Browse files Browse the repository at this point in the history
Fixes #18.
  • Loading branch information
nbfalcon committed Nov 4, 2020
1 parent 20cac62 commit 0a2a1e3
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions lsp-ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,7 @@
(cons string face)
(cons string face)))

(eval-when-compile
(lsp-interface
(lsp-ivy:FormattedSymbolInformation
(:kind :name :location :textualRepresentation)
(:containerName :deprecated))))

(lsp-defun lsp-ivy--workspace-symbol-action
(lsp-defun lsp-ivy--workspace-goto-symbol
((&SymbolInformation
:location (&Location :uri :range (&Range :start (&Position :line :character)))))
"Jump to selected candidate."
Expand Down Expand Up @@ -156,8 +150,7 @@ FILTER-REGEXPS?, otherwise convert it to an `lsp-ivy:FormattedSymbolInformation'
(let ((textual-representation
(lsp-ivy--format-symbol-match symbol-information workspace-root)))
(when (--all? (string-match-p it textual-representation) filter-regexps?)
(lsp-put symbol-information :textualRepresentation textual-representation)
symbol-information))))
(cons textual-representation symbol-information)))))

(defun lsp-ivy--workspace-symbol (workspaces prompt initial-input)
"Search against WORKSPACES with PROMPT and INITIAL-INPUT."
Expand Down Expand Up @@ -194,14 +187,9 @@ FILTER-REGEXPS?, otherwise convert it to an `lsp-ivy:FormattedSymbolInformation'
:dynamic-collection t
:require-match t
:initial-input initial-input
:action #'lsp-ivy--workspace-symbol-action
:action (lambda (c) (lsp-ivy--workspace-goto-symbol (cdr c)))
:caller 'lsp-ivy-workspace-symbol)))

(ivy-configure 'lsp-ivy-workspace-symbol
:display-transformer-fn
(-lambda ((&lsp-ivy:FormattedSymbolInformation :textual-representation))
textual-representation))

;;;###autoload
(defun lsp-ivy-workspace-symbol (arg)
"`ivy' for lsp workspace/symbol.
Expand Down

0 comments on commit 0a2a1e3

Please sign in to comment.