Function: eca-chat--completion-type-at-point

eca-chat--completion-type-at-point is a natively compiled function defined in eca-chat-context.el.

Signature

(eca-chat--completion-type-at-point)

Documentation

Return the kind of completion available at point, or nil.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-context.el
;;;; Completion-at-point function

(defun eca-chat--completion-type-at-point ()
  "Return the kind of completion available at point, or nil."
  (let ((full-text (buffer-substring-no-properties (line-beginning-position) (point))))
    (cond
     ;; completing contexts
     ((eca-chat--point-at-new-context-p)
      'contexts-from-new-context)

     ((when-let (last-word (car (last (string-split full-text "[\s]"))))
        (string-match-p (concat "\\(?:^\\|[^[:alnum:]]\\)" (regexp-quote eca-chat-context-prefix)) last-word))
      'contexts-from-prompt)

     ((when-let (last-word (car (last (string-split full-text "[\s]"))))
        (string-match-p (concat "\\(?:^\\|[^[:alnum:]]\\)" (regexp-quote eca-chat-filepath-prefix)) last-word))
      'files-from-prompt)

     ;; completing commands with `/`
     ((and (eca-chat--point-at-prompt-field-p)
           (string-prefix-p "/" full-text))
      'prompts)

     (t nil))))