Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't abuse `ivy-configure' + display-transformer #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 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--goto-symbol
((&SymbolInformation
:location (&Location :uri :range (&Range :start (&Position :line :character)))))
"Jump to selected candidate."
Expand Down Expand Up @@ -155,8 +149,11 @@ 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)))))

(lsp-defun lsp-ivy--workspace-symbol-action ((_ . sym))
"Jump to the `cdr' of INPUT0, an `&SymbolInformation'."
(lsp-ivy--goto-symbol sym))

(defun lsp-ivy--workspace-symbol (workspaces prompt initial-input)
"Search against WORKSPACES with PROMPT and INITIAL-INPUT."
Expand Down Expand Up @@ -196,11 +193,6 @@ FILTER-REGEXPS?, otherwise convert it to an `lsp-ivy:FormattedSymbolInformation'
:action #'lsp-ivy--workspace-symbol-action
: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