pi-web icon indicating copy to clipboard operation
pi-web copied to clipboard

功能请求:最近工作区(recent cwd)下拉列表支持移除过期条目

Open cking000bigdemon opened this issue 4 months ago • 0 comments

场景

侧边栏的工作区下拉列表(recent cwd picker)由会话自动推导、只增不减。长时间使用后列表会积累大量一次性/临时目录(比如仓库里被误打开的临时文件夹、__MACOSX 之类的杂项目录),没有清理入口,列表越来越长、越来越难找目标工作区。

期望行为

  • 每个非当前工作区条目上提供移除入口(如行尾 × 按钮),点击后该条目从下拉列表消失;
  • 移除只影响列表显示,不删除会话、不删除磁盘目录;
  • 移除状态持久化(localStorage 即可);
  • 之后若用户通过 "Custom path" / "Use default directory" 再次选中该目录,条目自动恢复显示(防止误移除后无法找回)。

参考实现

我的 fork(cking000bigdemon/pi-web)的 feat/cwd-delete 分支已按上述思路实现,可参考或直接基于它提 PR:

  • commit d41fd17 — feat(cwd): remove stale entries from the recent cwd picker https://github.com/cking000bigdemon/pi-web/commit/d41fd17187399e156e5940ef26d6c1eefed4f254

改动集中在 components/SessionSidebar.tsx(+60/-11):

  • 新增 hideCwd / unhideCwd,localStorage key pi-hidden-cwds 持久化;
  • 非当前条目行尾显示 ×,hover 变红;当前工作区不显示 ×;
  • 重新选中隐藏目录时自动取消隐藏。

环境

cking000bigdemon avatar Aug 01 '26 10:08 cking000bigdemon