[FEATURE] Plugin-provided inline autocomplete with custom trigger (e.g. `#` for issues)
Summary
Let plugins register their own inline autocomplete for the prompt input, triggered by a character or prefix (for example #). It would work like the built-in @ file picker, but the suggestions would come from a plugin.
Use case
I'm building claude-issue-picker, a plugin that lets you reference GitHub issues from the prompt. The UX I want:
> fix this bug #lo
┌─────────────────────────────────┐
│ #42 Login crash on cold start │
│ #38 Logout button misaligned │
└─────────────────────────────────┘
Type # and a filtered list of open issues shows up while you type. Picking one inserts #42 into the prompt before you submit.
Why it can't be built today
- Hooks only run after submit.
UserPromptSubmitgets the finished prompt. No hook runs while you're typing. - Hooks can't rewrite the prompt. They can only add
additionalContext. My workaround has Claude callAskUserQuestionafter the prompt is sent. That costs a model turn, the transcript keeps the raw#, and it feels much slower than inline completion. fileSuggestiondoesn't fit. It only runs after@, it's meant for file paths, and it's a user setting, so a plugin can't ship it. If I put issues in the@list, they get mixed in with files.- Keybindings can't do it either. A keybinding can't open a picker filled by a command.
Proposal (any one of these would unblock it)
- Plugin autocomplete providers. Something like this in
plugin.json:
``json`
"autocomplete": [
{ "trigger": "#", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/suggest.js" }
]
{"query": "lo", "cwd": "..."}
The command gets the current token on stdin (for example ) and returns [{ "insert": "#42", "label": "Login crash on cold start", "detail": "bug" }]. It could use the same debounce and timeout rules as fileSuggestion`.
- A generic
fileSuggestionwith a configurable trigger. Allow more than one entry, each with its own trigger character, and let plugins contribute entries. - Prompt rewriting in
UserPromptSubmit. Let the hook return anupdatedPrompt. This isn't inline, but it would at least keep the transcript accurate and avoid the extra turn.
Option 1 fits best. Plugins could use it for Jira and Linear tickets, Slack channels, snippets, and so on.
Question
If there's already a supported way to do this that I've missed, I'd love a pointer.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗