Function: eca-chat--context-to-completion
eca-chat--context-to-completion is a natively compiled function
defined in eca-chat-context.el.
Signature
(eca-chat--context-to-completion QUERY ROOTS CONTEXT)
Documentation
Convert CONTEXT to a completion item for typed QUERY and ROOTS.
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--context-to-completion (query roots context)
"Convert CONTEXT to a completion item for typed QUERY and ROOTS."
(let* ((ctx-type (plist-get context :type))
(ctx-path (plist-get context :path))
(raw-label (pcase ctx-type
("file" (eca-chat--completion-path-label query roots ctx-path nil))
("directory" (eca-chat--completion-path-label query roots ctx-path t))
("repoMap" "repoMap")
("cursor" "cursor")
("mcpResource" (concat (plist-get context :server) ":" (plist-get context :name)))
("text" (plist-get context :label))
(_ (concat "Unknown - " ctx-type))))
(face (pcase ctx-type
("file" 'eca-chat-context-file-face)
("directory" 'eca-chat-context-file-face)
("repoMap" 'eca-chat-context-repo-map-face)
("cursor" 'eca-chat-context-cursor-face)
("mcpResource" 'eca-chat-context-mcp-resource-face)
("text" 'eca-chat-context-buffer-face)
(_ nil))))
(propertize raw-label
'eca-chat-completion-item context
'face face)))