From 46d6d0b586b868c21a534bacd6650a4ff0f753c3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 29 Jun 2020 15:12:30 -0400 Subject: [PATCH] Use symbol-at-point instead of xref w/ eglot Otherwise doom-thing-at-point-or-region will return nil, causing "Nothing under point" warnings when using lookup commands. --- core/autoload/text.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/autoload/text.el b/core/autoload/text.el index f415e1e70..79c924f4c 100644 --- a/core/autoload/text.el +++ b/core/autoload/text.el @@ -105,12 +105,15 @@ in some cases." (doom-region-end))) (thing (thing-at-point thing t)) - ((and (require 'xref nil t) (not (eq (xref-find-backend) 'eglot))) - ;; A little smarter than using `symbol-at-point', though in most cases, - ;; 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))) + ((require 'xref nil t) + ;; Eglot defines a dummy for `xref-find-backend', so we need a special + ;; case to avoid xref when using eglot. See + ;; https://github.com/joaotavora/eglot/issues/503 + (if (eq (xref-find-backend) 'eglot) + (thing-at-point 'symbol t) + ;; A little smarter than using `symbol-at-point', though in most + ;; cases, xref ends up using `symbol-at-point' anyway. + (xref-backend-identifier-at-point (xref-find-backend)))) (prompt (read-string (if (stringp prompt) prompt "")))))