Function: eca-chat--completion-path-label
eca-chat--completion-path-label is a natively compiled function
defined in eca-chat-context.el.
Signature
(eca-chat--completion-path-label QUERY ROOTS PATH DIRECTORY?)
Documentation
Return the completion label for PATH given typed QUERY and ROOTS.
Keeps the directory part the user typed as the label prefix so the probe keeps matching while drilling into folders, falling back to a workspace-relative path. Appends a trailing slash when DIRECTORY? is non-nil.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-context.el
(defun eca-chat--completion-path-label (query roots path directory?)
"Return the completion label for PATH given typed QUERY and ROOTS.
Keeps the directory part the user typed as the label prefix so
the probe keeps matching while drilling into folders, falling
back to a workspace-relative path. Appends a trailing slash
when DIRECTORY? is non-nil."
(let* ((qdir (file-name-directory query))
(label
(or
;; Keep what the user typed as prefix (handles ~, ./, ../,
;; absolute and workspace-relative directory parts).
(when qdir
(-some (lambda (base)
(let ((resolved (file-name-as-directory
(expand-file-name qdir base))))
(when (string-prefix-p resolved path)
(concat qdir (substring path (length resolved))))))
(if (file-name-absolute-p qdir) (list nil) roots)))
;; Fallback: relativize to a workspace root.
(-some (lambda (root)
(when (f-ancestor-of? root path)
(f-relative path root)))
roots)
path)))
(if directory? (file-name-as-directory label) label)))