commit 225f4cc51db64c75b7eae5785afc976f66f71654 parent 8cafe76a3f807932d1137165a13d8e5ed15cb94d Author: Lou Woell <lou.woell@posteo.de> Date: Mon, 6 Oct 2025 03:32:20 +0200 [haredoc.el] implement `xref-backend-references` Diffstat:
| M | haredoc.el | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/haredoc.el b/haredoc.el @@ -353,5 +353,21 @@ declaration at point." (col (string-to-number (nth 2 loc)))) (list (xref-make symbol (xref-make-file-location file line col))))) +(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql 'haredoc-xref))) + '()) + +(cl-defmethod xref-backend-references ((_backend (eql 'haredoc-xref)) identifier) + (let* ((lines (process-lines haredoc-helperbin "-p" (haredoc/root-dir) "find-references" + identifier default-directory))) + (mapcar (lambda (line) + (let* ((loc (string-split line " " t)) + (id (string-join (cdr loc) " ")) + (loc (string-split (nth 0 loc) ":" t))) + (xref-make id + (xref-make-file-location (nth 0 loc) + (string-to-number (nth 1 loc)) + (string-to-number (nth 2 loc)))))) + lines))) + (provide 'haredoc) ;;; haredoc.el ends here