anomalyco / anomalyco/opencode
@ file autocomplete doesn't trigger after `(` — mentionTriggerIndex only allows whitespace
Open
@simonklee is already working on this.
Since Sep 1, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Description
Typing @ immediately after ( does not trigger file/autocomplete. e.g. (@ or See (@ shows no dropdown, while @ (space before) works.
Steps to reproduce
- Open opencode TUI (
opencode1.18.25) - Type
foo (@orSee (@ - Observe: no
@autocomplete appears - Type
foo @-> works
Expected
@ should trigger after ( (and other common prefix punctuation like [, {, ", ', `) — typical in Markdown [@label](@file) or func(@file).
Actual
No trigger. Must insert a space (@, pick file, then delete space.
Root cause
packages/tui/src/prompt/display.ts:33 mentionTriggerIndex only allows start-of-line or \s:
const before = index === 0 ? undefined : text[index - 1]
if ((before === undefined || /\s/.test(before)) && !/\s/.test(query)) {
return promptOffsetWidth(text.slice(0, index))
}
( fails /\s/.test("(") so show("@") in packages/tui/src/component/prompt/autocomplete.tsx:308 never fires.
Proposed fix
- if ((before === undefined || /\s/.test(before)) && !/\s/.test(query)) {
+ if ((before === undefined || /[\s\(\[\{"'`]/.test(before)) && !/\s/.test(query)) {
Minimal fix for the reported bug: /[\s\(]/. Extended set covers [@, {@, "@, '@.
Workaround
Type (@, select, delete space.
Environment
- opencode 1.18.25 (Go binary ~/.opencode/bin/opencode)
- macOS Darwin, zsh
### Plugins
_No response_
### OpenCode version
1.18.25
### Steps to reproduce
_No response_
### Screenshot and/or share link
_No response_
### Operating System
macOS Darwin, zsh
### Terminal
Warp
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.