Function: consult-eglot--make-async-source

consult-eglot--make-async-source is a natively compiled function defined in consult-eglot.el.

Signature

(consult-eglot--make-async-source SERVERS)

Documentation

Search for symbols in a consult ASYNC source.

Pipe a consult--read compatible async-source ASYNC to search for symbols in the workspace tied to SERVERS.

Source Code

;; Defined in /nix/store/3v6wy8b5xagm658m9sa8vhwzkykl5mv6-emacs-packages-deps/share/emacs/site-lisp/elpa/consult-eglot-20260613.1443/consult-eglot.el
(defun consult-eglot--make-async-source (servers)
  "Search for symbols in a consult ASYNC source.
Pipe a `consult--read' compatible async-source ASYNC to search for
symbols in the workspace tied to SERVERS."
  (lambda (async)
    (lambda (action)
      (pcase-exhaustive action
        ((or 'setup (pred stringp))
         (let ((query (if (stringp action) action "")))
           (cl-loop
            with responses = nil
            for server in servers
            do (jsonrpc-async-request
                server :workspace/symbol
                `(:query ,query)
                :success-fn
                (lambda (resp)
                  (setq responses (append responses resp nil))
                  (when consult-eglot-sort-results
                    (setq responses
                          (cl-sort responses #'consult-eglot--compare-responses)))
                  (funcall async 'flush)
                  (funcall async responses))
                :error-fn
                (eglot--lambda ((ResponseError) code message)
                  (message "%s: %s" code message))
                :timeout-fn
                (lambda ()
                  (message "error: request timed out"))))
            (funcall async action)))
         (_ (funcall async action))))))