Skip to content

fix(desktop): 文件面板右键新增「显示文件所在位置」#3583

Merged
esengine merged 1 commit into
esengine:main-v2from
Li-Charles-One:fix/3539-reveal-in-file-manager
Jun 10, 2026
Merged

fix(desktop): 文件面板右键新增「显示文件所在位置」#3583
esengine merged 1 commit into
esengine:main-v2from
Li-Charles-One:fix/3539-reveal-in-file-manager

Conversation

@Li-Charles-One

Copy link
Copy Markdown
Contributor

问题

当前文件面板右键菜单只有「添加文件引用」和「添加文件内容」,无法快速定位文件在系统中的位置。用户需要手动打开资源管理器再导航到对应目录。

关联 issue: #3539

修复

在 WorkspacePanel 的文件/文件夹右键菜单中新增「显示文件所在位置」选项,调用已有的 \�pp.RevealWorkspacePath()\ Go 绑定:

  • Windows → \�xplorer /select\ 定位文件
  • macOS → \open -R\ 在 Finder 中显示
  • Linux → 调用系统文件管理器

改动

  • \WorkspacePanel.tsx: 新增
    evealInFileManager\ 函数 + 菜单项 + 更新 estimatedHeight 常量
  • \locales/zh.ts: 新增 \workspace.revealInFileManager\
  • \locales/en.ts: 新增 \workspace.revealInFileManager\

验证


  • pm run typecheck\ 通过

  • pm run check:css\ 通过

  • pm test\ 通过
  • \wails dev\ 桌面端实测右键菜单 → 资源管理器正确定位

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 8, 2026
@SivanCola

Copy link
Copy Markdown
Collaborator

这次改动整体方向没问题,RevealWorkspacePath 复用已有 Go 绑定也比较合适。我这边看到两个小问题,建议合并前顺手修一下:

  1. Changes 视图里已删除文件也会显示「显示文件所在位置」。这类 row 对应路径已经不存在,点击后在各平台基本会静默失败或打开失败。建议对 deleted change 隐藏/禁用该菜单项,或者改为打开父目录。

  2. WORKSPACE_CONTEXT_MENU_REF_HEIGHT 现在从 48 改成 92,但 selection menu 也复用了这个常量。这样在预览区选中文本并靠近窗口底部右键时,单项菜单会被多上移一段距离。建议拆一个独立的 selection menu 高度常量,避免两个菜单互相影响。

验证方面我跑了 wails generate modulenpm run typechecknpm run check:cssnpm testnpm run build,都通过。go test ./... 失败在既有配置持久化测试,和这次前端菜单改动无关。

@Li-Charles-One Li-Charles-One force-pushed the fix/3539-reveal-in-file-manager branch from bcc8e12 to 272c4bb Compare June 9, 2026 08:03
@Li-Charles-One

Copy link
Copy Markdown
Contributor Author

已根据 @SivanCola 的 review 意见更新:

  1. 拆分常量:新增 \WORKSPACE_CONTEXT_MENU_SELECTION_HEIGHT = 48\,selection menu 不再受 tree menu 高度影响
  2. 常量调整:\WORKSPACE_CONTEXT_MENU_FILE_HEIGHT\ 从 92 改为 136(3 项),\WORKSPACE_CONTEXT_MENU_REF_HEIGHT\ 从 48 改为 92(2 项,目录菜单)

关于 deleted file 的问题:当前 main-v2 的 Changes 视图是 Git 历史视图,不是工作区变更列表,所以不存在 deleted file 显示「显示文件所在位置」的情况。如果后续有工作区变更视图,需要在那里对 deleted 状态隐藏该菜单项。

验证:typecheck ✅ check:css ✅ test ✅

…3539)

- Add 'Show in file manager' option to file tree right-click menu
- Call app.RevealWorkspacePath to open file in system file manager
- Split context menu height constants to avoid selection menu offset issue
- Add locale strings for en/zh
@Li-Charles-One Li-Charles-One force-pushed the fix/3539-reveal-in-file-manager branch from 272c4bb to 94dcd81 Compare June 10, 2026 03:45
@Li-Charles-One

Copy link
Copy Markdown
Contributor Author

已 rebase 到最新 main-v2 并 force push。

关于 review 提到的两个问题:

  1. 常量拆分 ✅ 已修复 — 新增 \WORKSPACE_CONTEXT_MENU_SELECTION_HEIGHT = 48\,selection menu 不再受 tree menu 高度影响。\WORKSPACE_CONTEXT_MENU_FILE_HEIGHT\ 调整为 136(4 项菜单)。

  2. 已删除文件显示「显示文件所在位置」 — 这个实际上不会发生。\ reeMenu\(包含该菜单项)只在文件树的 \onContextMenu\ 中触发,而文件树只展示磁盘上实际存在的文件(通过 \loadDir\ 读取真实目录)。Changes 视图里的 git 文件列表没有绑定 \onContextMenu\,不会弹出 treeMenu。所以已删除的文件不会出现在文件树中,自然也不会有这个菜单项。

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handy addition, thanks for contributing!

@esengine esengine merged commit 345821b into esengine:main-v2 Jun 10, 2026
13 checks passed
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
…sengine#3539) (esengine#3583)

- Add 'Show in file manager' option to file tree right-click menu
- Call app.RevealWorkspacePath to open file in system file manager
- Split context menu height constants to avoid selection menu offset issue
- Add locale strings for en/zh

Co-authored-by: Li-Charles-One <Li-Charles-One@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants