Function: eglot--collecting-ranged

eglot--collecting-ranged is a macro defined in eglot.el.gz.

Signature

(eglot--collecting-ranged (OBJECT-SYM REGION-SYM OBJECTS &optional KEY) &rest BODY)

Documentation

Iterate over OBJECTS, binding each element and its region.

For each element in OBJECTS, bind OBJECT-SYM to the element and REGION-SYM to its computed Emacs region (a cons of buffer positions). Evaluate BODY and collect the result into a list. Return that list.

KEY, if non-nil, should be a function to extract the LSP range from each element. If nil, elements are assumed to be plists with :range keys.

This macro uses optimized incremental navigation instead of repeatedly calling eglot-range-region, providing significant performance benefits when processing many ranges.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(cl-defmacro eglot--collecting-ranged ((object-sym region-sym
                                                          objects
                                                          &optional key)
                                              &rest body)
  "Iterate over OBJECTS, binding each element and its region.
For each element in OBJECTS, bind OBJECT-SYM to the element and
REGION-SYM to its computed Emacs region (a cons of buffer positions).
Evaluate BODY and collect the result into a list.  Return that list.

KEY, if non-nil, should be a function to extract the LSP range from each
element.  If nil, elements are assumed to be plists with `:range' keys.

This macro uses optimized incremental navigation instead of repeatedly
calling `eglot-range-region', providing significant performance benefits
when processing many ranges."
  (declare (indent 1) (debug t))
  `(eglot--call-with-ranged
    ,objects
    ,key
    (lambda (,object-sym ,region-sym) ,@body)))