anomalyco / anomalyco/opencode

@ file autocomplete doesn't trigger after `(` — mentionTriggerIndex only allows whitespace

Open
#46,591 1 comment 1 reaction 1 assignee View on GitHub

@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
  1. Open opencode TUI (opencode 1.18.25)
  2. Type foo (@ or See (@
  3. Observe: no @ autocomplete appears
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.