Filter out 'eglot backend from doom-thing-at-point

Context : https://github.com/joaotavora/eglot/issues/503

Fixes a bug where having eglot enabled in a buffer will make `SPC *` search the whole project for literally `LSP Identifier at point.`
This commit is contained in:
Gerry Agbobada 2020-06-18 23:59:33 +02:00 committed by GitHub
parent 1878a08814
commit 32f9070614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -105,9 +105,11 @@ in some cases."
(doom-region-end))) (doom-region-end)))
(thing (thing
(thing-at-point thing t)) (thing-at-point thing t))
((require 'xref nil t) ((and (require 'xref nil t) (not (eq (xref-find-backend) 'eglot)))
;; A little smarter than using `symbol-at-point', though in most cases, ;; A little smarter than using `symbol-at-point', though in most cases,
;; xref ends up using `symbol-at-point' anyway. ;; xref ends up using `symbol-at-point' anyway.
;; "Most cases" doesn't cover 'eglot so we manually exclude it.
;; See discussion in https://github.com/joaotavora/eglot/issues/503
(xref-backend-identifier-at-point (xref-find-backend))) (xref-backend-identifier-at-point (xref-find-backend)))
(prompt (prompt
(read-string (if (stringp prompt) prompt ""))))) (read-string (if (stringp prompt) prompt "")))))