anomalyco / anomalyco/opencode

[BUG] Desktop 端从文件树拖拽文件到对话框生成 @ 链接,第一次有效,第二次及之后无效

Open
#40,361 1 comment 0 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Aug 4, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

在 OpenCode Desktop 的对话框中,从右侧文件树拖拽第一个项目文件到输入框时,可以正常生成 @文件名 格式的链接。但在此之后,继续拖拽第二个文件到输入框,没有任何反应(静默忽略,不生成 @ 链接,也不报错)。
临时绕过:在对话框中先手动输入 @,然后再从文件树拖拽文件,就可以任意拖拽多次,每次都正常生成 @ 链接。但如果直接拖拽(不先输入 @),则只有第一次有效。
根因推测
第一次拖拽成功生成了 @ 链接后,输入框的 @ 文件引用模式未正确重置。后续拖拽事件可能依赖 @ 触发状态(如 isDialogActive 或 autocomplete 上下文),但该状态在第一次拖拽后没有被重新激活。手动键入 @ 可以重新激活该状态,因此绕过问题。
备注
使用键盘输入 @ 并选择文件的方式可以在同一次输入中多次引用文件,没有问题
可能与 #27482(@ mention 一次后失效,根因是 visualCursor.offset 与 props.value.at 偏移不一致)以及 #26064(第二次粘贴图片被忽略)共享类似的状态管理 bug
关联 Issue
#26064 - GUI: second different pasted image is ignored(模式一致:第一次有效,第二次被忽略)
#27482 - @ mention file association stops working after first use(@ 引用文件一次后失效)
#12569 - feat(app): drag-n-drop to @mention file(该功能的原始 PR)

Plugins

No response

OpenCode version

1.18.12 (Desktop)

Steps to reproduce
  1. 打开 OpenCode Desktop,进入一个项目工作区
  2. 在右侧文件树中,用鼠标拖拽第一个文件到对话框输入区域
  3. 观察到输入框中正常生成了 @文件路径 的链接
  4. 再次从文件树拖拽第二个文件到对话框输入区域
  5. 观察到没有任何反应——不生成 @ 链接,不报错,不显示任何提示
Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

No response

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.