selectrum: improve :tools lookup integration

- move `consult-xref` stuff to `:tools lookup` where it belongs
- add selectrum functionality where possible, document what's beyond the
  scope of this PR
This commit is contained in:
Itai Y. Efrat 2021-05-08 23:36:14 +03:00
parent 693eb3c9a4
commit 1fe0ad318b
4 changed files with 20 additions and 13 deletions

View file

@ -234,8 +234,8 @@ This backend prefers \"just working\" over accuracy."
(defun +lookup-project-search-backend-fn (identifier)
"Conducts a simple project text search for IDENTIFIER.
Uses and requires `+ivy-file-search' or `+helm-file-search'. Will return nil if
neither is available. These require ripgrep to be installed."
Uses and requires `+ivy-file-search', `+helm-file-search', or `+selectrum-file-search'.
Will return nil if neither is available. These require ripgrep to be installed."
(unless identifier
(let ((query (rxt-quote-pcre identifier)))
(ignore-errors
@ -244,6 +244,9 @@ neither is available. These require ripgrep to be installed."
t)
((featurep! :completion helm)
(+helm-file-search :query query)
t)
((featurep! :completion selectrum)
(+selectrum-file-search :query query)
t))))))
(defun +lookup-evil-goto-definition-backend-fn (_identifier)

View file

@ -178,7 +178,13 @@ Dictionary.app behind the scenes to get definitions.")
(funcall orig-fn fetcher alist)))
(use-package! helm-xref
:when (featurep! :completion helm)))
:when (featurep! :completion helm))
(use-package! consult-xref
:when (featurep! :completion selectrum)
:init
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)))
;;