Skip to content

fix: 「在文件夹中显示」改为在资源管理器中揭示(不再把目录当文件开进编辑器) - #94

Open
GammaChineYov wants to merge 1 commit into
omdsh-dev:mainfrom
GammaChineYov:fix/show-in-folder-reveals-in-explorer
Open

fix: 「在文件夹中显示」改为在资源管理器中揭示(不再把目录当文件开进编辑器)#94
GammaChineYov wants to merge 1 commit into
omdsh-dev:mainfrom
GammaChineYov:fix/show-in-folder-reveals-in-explorer

Conversation

@GammaChineYov

Copy link
Copy Markdown

问题

openPath 拦截会把聊天内所有文件打开都送进侧边栏编辑器——包括 DSH 原生产物行(ui-deliverables)的**「在文件夹中显示」**按钮。该按钮按设计传入 "."(chat 视图解析为 "<cwd>/.",即工作区目录本身);目录没有编辑器内容,插件后端会拒绝:

"<cwd>" is a directory

结果:点击「在文件夹中显示」不再打开/聚焦系统文件管理器,而是冒出一个显示 "..." is a directory 的空白编辑器标签页。

修复

  • openpath-intercept.ts:识别文件夹揭示手势("." / "./" / "<cwd>/."),改走新的 revealInExplorer 依赖,不再进编辑器。
  • intercept.tsxrevealInExplorer 切换到资源管理器标签页(面板折叠时自动展开)、展开产出文件所在父目录、高亮并滚动到本轮产出文件;拦截后的产物行在存在隐藏文件时也渲染自己的「在文件夹中显示」按钮。
  • produced-files.tsselectProducedFiles 改读引擎 Turn 数据(owner.turn.data.get("deliverables"))——与 ui-deliverables 同源;原实现读 owner.nodes,而真实的 TurnTailOwnerProps{turn, seq, openFile}(没有 nodes),导致插件接管从未生效。节点副本保留为兜底。
  • state.ts:新增瞬态 revealed 集合(不持久化)+ revealPaths reducer(展开祖先目录)。
  • ExplorerView.tsx / Sidebar.tsx / builtins/tabs.tsx / service.ts:高亮与滚动被揭示的行,revealedTabComponentProps 透传。
  • 测试:文件夹手势路由、引擎数据形态的 selector、wiring seat、中英文案。

验证

  • pnpm typecheck 通过。
  • pnpm test:与本次修改相关的测试全部通过(本机 Windows 下 fs-tree/a/b 盘符语义断言、side-card-section 的 locale 断言、smoke 的 git 身份断言属环境性失败,与本次改动无关;CI 的 ubuntu 干净环境不受影响)。
  • 已在本地安装版(0.10.3)实测:点击「在文件夹中显示」→ 侧边栏切到资源管理器并高亮本轮产出文件。

备注

  • 修复同时覆盖两条路径:插件自己的产物行(onShowInFolder(matched))与原生行兜底(拦截层用最近一次匹配的产出路径,未知时揭示工作区根)。
  • 需要重启/刷新 DSH web 页面后生效(client bundle 每次请求重新读取)。

…rectory in the editor

The open-path interception reroutes EVERY chat-side file open into the
sidebar editor, including the stock "Show in folder" gesture: the
ui-deliverables row passes "." (resolved to "<cwd>/." by the chat view),
so clicking it opened a bogus editor tab for the workspace directory
(host error: '"..." is a directory').

- openpath-intercept: detect the folder-reveal gesture ("." / "./" /
  "<cwd>/.") and route it to a new revealInExplorer dep instead of the editor.
- intercept: revealInExplorer switches to the explorer tab (expanding the
  panel), expands the produced files' parent directories, and highlights /
  scrolls to them; the intercepted produced-files row now also renders its
  own "Show in folder" button when files are hidden.
- produced-files: selectProducedFiles reads the engine Turn data
  (owner.turn.data.get("deliverables")) — the same source ui-deliverables
  uses — with the node replica as fallback. The old code read owner.nodes,
  which the real TurnTailOwnerProps ({turn, seq, openFile}) does not carry,
  so the takeover never claimed the chain.
- state: transient `revealed` set (never persisted) plus a revealPaths
  reducer that expands ancestor directories.
- ExplorerView: highlight + scroll revealed rows; Sidebar/tabs/service
  thread `revealed` through TabComponentProps.
- tests: folder-gesture routing, engine-data selector, wiring seat, zh/en copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant