Function: eca-editor--xref-locations

eca-editor--xref-locations is a natively compiled function defined in eca-editor.el.

Signature

(eca-editor--xref-locations BACKEND POSITION REFERENCES-P INCLUDE-DECLARATION)

Documentation

Compute eca locations via xref BACKEND for the symbol at POSITION.

When REFERENCES-P find references, otherwise definitions. When INCLUDE-DECLARATION is nil, reference locations matching a definition of the symbol are filtered out, since LSP-backed xref backends always include the declaration.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-editor.el
(defun eca-editor--xref-locations (backend position references-p include-declaration)
  "Compute eca locations via xref BACKEND for the symbol at POSITION.
When REFERENCES-P find references, otherwise definitions.  When
INCLUDE-DECLARATION is nil, reference locations matching a
definition of the symbol are filtered out, since LSP-backed xref
backends always include the declaration."
  (save-excursion
    (eca-editor--goto-position position)
    (let ((identifier (xref-backend-identifier-at-point backend)))
      (cond
       ((null identifier) (vector))
       ((not references-p)
        (eca-editor--xref-items->locations
         (xref-backend-definitions backend identifier)))
       (t
        (let ((references (append (eca-editor--xref-items->locations
                                   (xref-backend-references backend identifier))
                                  nil)))
          (unless include-declaration
            (let ((declarations (append (eca-editor--xref-items->locations
                                         (xref-backend-definitions backend identifier))
                                        nil)))
              (setq references
                    (-remove (lambda (location) (member location declarations))
                             references))))
          (vconcat references)))))))