kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

@无法唤起文件选择

Open yhtyanght opened this issue 6 months ago • 8 comments

What version of Kimi Code is running?

0.6.0

Which open platform/subscription were you using?

/login

Which model were you using?

kimi-k2.6

What platform is your computer?

No response

What issue are you seeing?

@无法唤起文件选择

What steps can reproduce the bug?

必现 在文本框切换中英文下@都无法唤醒文件选择

What is the expected behavior?

主动递归识别当前目录下所有文件,@时可以可视化猜测可选项,进行选择

Additional information

No response

yhtyanght avatar Jun 01 '26 06:06 yhtyanght

跟踪了一下 @ 唤起文件选择的逻辑,分享下初步发现。

@ 的触发判断主要在底层依赖 @earendil-works/pi-tui 里,kimi-code 这边的 file-mention-provider.ts 主要负责菜单弹出后的排序。pi-tui 里判断是否触发用的是 char === "@"(半角)。

结合你提到的「切换中英文」,我怀疑原因是:中文输入法在全角标点模式下输入的是全角 @(U+FF20),而不是半角 @(U+0040),所以匹配不上、菜单不弹出。另外也可能与输入法上屏的方式有关,这点还需要确认。

想请你补充几点信息来确认:

  1. 操作系统、终端、以及在用的输入法?
  2. 切到纯英文输入法、把 @ 作为一行开头输入时,菜单能正常弹出吗?
  3. 输入进去的是半角 @ 还是全角 @?
  4. 当前目录是否是 git 仓库、有没有装 fd?

这些信息能帮助进一步定位。

caigee-cmd avatar Jun 01 '26 06:06 caigee-cmd

检查当前目录是否是 git 仓库内,我之前测下来是只有 git 仓库内可以正常使用此功能

Aalivexy avatar Jun 01 '26 08:06 Aalivexy

检查当前目录是否是 git 仓库内,我之前测下来是只有 git 仓库内可以正常使用此功能

我刚刚测了下确实是,git仓库内才生效

zha-ji-tui avatar Jun 01 '26 08:06 zha-ji-tui

没有git初始化,但是不一定只有编码才能用吧。我git init后可以用了。

yhtyanght avatar Jun 01 '26 15:06 yhtyanght

似乎真正的需求是系统里有安装fd

Eric-Song-Nop avatar Jun 01 '26 16:06 Eric-Song-Nop

#305 should help with the root cause behind this: @ completion relies on fd for cross-directory search, and when fd is missing and you're outside a git repository there's no backend, so it failed silently.

#305 makes the dependency explicit — it warns at startup in exactly that case (fd missing + not a git repo) and documents fd as a dependency, while inside a git repo the existing git ls-files fallback keeps @ working. It doesn't auto-install fd, so the fix is still to install fd (or work inside a git repo) — the change just makes the cause visible instead of silent. Builds on the warning idea from #290.

fancyboi999 avatar Jun 02 '26 05:06 fancyboi999

@ 文件选择需要 fd 或者 git 仓库作为后端数据源,当两者都没有时菜单不会弹出。

建议安装 fd(apt install fd-find / brew install fd),安装后 detectFdPath() 会自动识别,在任意目录下 @ 文件选择都能正常工作。

或者如果不想装 fd,在当前目录 git init 也可以让 @ 生效(走 git ls-files 后备)。

chengkeen avatar Jun 02 '26 06:06 chengkeen

在 https://github.com/MoonshotAI/kimi-code/pull/547 修复了,等发新版再试一下

liruifengv avatar Jun 08 '26 12:06 liruifengv