Add hook to customize @ file completion#518
Open
nohzafk wants to merge 1 commit into
Open
Conversation
Owner
|
Thanks for the PR. Sorry about the delay. Working my way through the backlog from #500. How about we make this a little more versatile with something like? (defcustom agent-shell-file-completion-function
#'completion-at-point
"Function called when @ is typed at a word boundary.
The function takes no arguments and is responsible for performing
the completion (e.g. calling `completion-at-point' or invoking a
custom completion UI). Set to nil to disable @ completion."
:type '(choice (const :tag "Disabled" nil)
function)
:group 'agent-shell)
(cond
((eq (char-before) ?@)
(when agent-shell-file-completion-function
(funcall agent-shell-file-completion-function)))
((and (eq (char-before) ?/)
(agent-shell--command-completion-at-point))
(completion-at-point)))ps. Don't you need a similar thing for completing commands? |
Author
|
Yes, I might need similar things for command completion. However, I suggest we add another custom variable for command completion that is symmetric to file completion. |
Owner
SGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
@ completion is hardcoded to CAPF/projectile, preventing fuzzy or alternative backends.
Without corfu/company it faills through to Completions buffer with prefix mathching.
Solution
agent-shell-file-completion-functiondefcustom to handle @ completion; if it returns non-nil, CAPF is skipped.My Hack
Because I dont' use courfu/company, currently I use this hack to make agent-shell completion to use with another backend, it would be nice that agent-shell provide an option for user to provide custom function
Checklist
M-x checkdocandM-x byte-compile-file.