Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion agent-shell-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
:type 'boolean
:group 'agent-shell)

(defcustom agent-shell-file-completion-function
#'agent-shell--file-completion-at-point
"Function to call for @ file completion.
Called with no arguments when @ is typed at a word boundary.
If it returns non-nil, `completion-at-point' is not called.
If it returns nil, falls through to the standard CAPF."
:type 'function
:group 'agent-shell)

(defun agent-shell--completion-bounds (char-class trigger-char)
"Find completion bounds for CHAR-CLASS, if TRIGGER-CHAR precedes them.
Returns alist with :start and :end if TRIGGER-CHAR is found before
Expand Down Expand Up @@ -105,7 +114,8 @@ preventing spurious completions mid-word or in paths."
(memq (char-before (1- (point))) '(?\s ?\t ?\n))))
(cond
((eq (char-before) ?@)
(completion-at-point))
(unless (funcall agent-shell-file-completion-function)
(completion-at-point)))
((and (eq (char-before) ?/)
(agent-shell--command-completion-at-point))
(completion-at-point)))))
Expand Down