From 765a4bb1c100a1a75b664b9cfcd1e7ef045a6486 Mon Sep 17 00:00:00 2001 From: Jason Zhen <15258281+JasZhe@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:12:00 -0500 Subject: [PATCH] fix(lookup): use dumb-jump xref instead of dumb-jump-go Since dumb-jump-go is deprecated, we want to use the xref backend. Due to how lsp-mode integrates with xref-backend-functions currently, it's not as simple as just adding dumb-jump-xref-activate to the xref-backend-functions so this is a bit of a hacky workaround. --- modules/tools/lookup/autoload/lookup.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/tools/lookup/autoload/lookup.el b/modules/tools/lookup/autoload/lookup.el index 393253da3..bf001989d 100644 --- a/modules/tools/lookup/autoload/lookup.el +++ b/modules/tools/lookup/autoload/lookup.el @@ -223,14 +223,18 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g. (+lookup--xref-show 'xref-backend-references identifier #'xref--show-xrefs) (cl-no-applicable-method nil))) -(defun +lookup-dumb-jump-backend-fn (_identifier) +(defun +lookup-dumb-jump-backend-fn (identifier) "Look up the symbol at point (or selection) with `dumb-jump', which conducts a project search with ag, rg, pt, or git-grep, combined with extra heuristics to reduce false positives. This backend prefers \"just working\" over accuracy." (and (require 'dumb-jump nil t) - (dumb-jump-go))) + ;; See: https://github.com/jacktasia/dumb-jump/issues/353 + ;; This is a workaround for a workaround to actually both fall back to dumb-jump and use the xref integration for it. + (let ((xref-backend-functions '(dumb-jump-xref-activate)) + (stop-infinite-dumb-jump-recursion t)) + (+lookup-xref-definitions-backend-fn identifier)))) (defun +lookup-project-search-backend-fn (identifier) "Conducts a simple project text search for IDENTIFIER.