Function: eca-completion--show-completion

eca-completion--show-completion is a natively compiled function defined in eca-completion.el.

Signature

(eca-completion--show-completion COMPLETION)

Documentation

Show COMPLETION.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-completion.el
(defun eca-completion--show-completion (completion)
  "Show COMPLETION."
  (-let* (((&plist :text text :id id :range range :docVersion doc-version) completion)
          ((&plist :start start :end end) range)
          ((&plist :line start-line :character start-char) start)
          ((&plist :character end-char) end))
    (when (= doc-version eca-completion--doc-version)
      (save-excursion
        (save-restriction
          (widen)
          (let* ((p (point))
                 (goto-line! (lambda ()
                               (goto-char (point-min))
                               (forward-line (1- (+ (1- start-line) eca-completion--line-bias)))))
                 (start (progn
                          (funcall goto-line!)
                          (forward-char (1- start-char))
                          (let* ((cur-line (buffer-substring-no-properties (line-beginning-position) (line-end-position)))
                                 (common-prefix-len (length (eca-completion--string-common-prefix text cur-line))))
                            (setq text (substring text common-prefix-len))
                            (forward-char common-prefix-len)
                            (point))))
                 (end (progn
                        (funcall goto-line!)
                        (forward-char (1- end-char))
                        (point))))
            (goto-char p)
            (eca-completion--display-overlay-completion text id start end)))))))