Skip to content

feat: 右键在资源管理器中打开/显示 + 使用默认应用打开;文件查看页 ⋯ 菜单 - #40

Open
ma15803216102 wants to merge 2 commits into
omdsh-dev:mainfrom
ma15803216102:feat/sidebar-open-file-manager
Open

feat: 右键在资源管理器中打开/显示 + 使用默认应用打开;文件查看页 ⋯ 菜单#40
ma15803216102 wants to merge 2 commits into
omdsh-dev:mainfrom
ma15803216102:feat/sidebar-open-file-manager

Conversation

@ma15803216102

Copy link
Copy Markdown
Contributor

变更内容

为侧边栏补齐"在系统文件管理器打开 / 默认应用打开"能力,三平台(Windows / macOS / Linux)适配:

1. Explorer 资源管理器右键

  • 目录 → 「在资源管理器中打开」(就地打开该目录)
  • 文件 → 「在资源管理器中显示」(在所在文件夹中选中该文件)+「使用默认应用打开」

2. Git 面板文件行右键

  • 同样新增「在资源管理器中显示」+「使用默认应用打开」(路径经 resolveGitPath 解析,repo-root 相对路径可用)

3. 文件查看页操作面板

  • 头部右侧新增 菜单:复制相对路径、复制绝对路径、在文件管理器中显示、使用默认应用打开(所有文件类型查看页共享)

实现

  • 新增 host 路由 fs.open-in-explorer / fs.open-defaultsrc/index.ts
  • 新增 src/open-external.ts 跨平台实现:
    • Windows: cmd /c explorer /select,"path"(显示)/ explorer "dir"start "" "path"(默认应用)
    • macOS: open -R path(Finder 显示)/ open path
    • Linux: xdg-open(打开所在目录,无便携"选中"动词)或目录本身
  • src/wire.ts 新增 open-error 错误码;zh/en 文案(moreActions 等)与 README 同步

验证

  • 已 rebase 到最新 main(含 v0.11)
  • tsc + tsdown 构建通过
  • vitest 409 通过;13 个失败均为 Windows 环境既有问题(node-pty 启动 / git \r\n 行尾 / POSIX 路径断言 / 设置页渲染计数,基线同样失败,本 PR 无新增失败)
  • Windows 实测 explorer /select,start "" 拉起成功

- 新增 host 路由 fs.open-in-explorer(目录就地打开、文件在所在文件夹中选中显示)与
  fs.open-default(系统默认应用打开),路径经 resolveGitPath 解析(git 面板相对路径可用)
- 新增 src/open-external.ts 跨平台实现:
  * Windows: cmd /c explorer /select,path(显示)/ explorer dir;start "" path(默认应用)
  * macOS: open -R path(Finder 显示)/ open path
  * Linux: xdg-open 打开所在目录(无便携选中动词)或目录本身
- Explorer 右键:目录 → 在资源管理器中打开;文件 → 在资源管理器中显示 + 使用默认应用打开
- Git 面板文件右键:同样新增 在资源管理器中显示 + 使用默认应用打开
- wire.ts 新增 open-error 错误码;zh/en 文案与 README 同步
- EditorHost 头部(所有文件类型查看页共享的操作面板)右侧新增三个点按钮,
  弹出菜单:复制相对路径、复制绝对路径、在文件管理器中显示、使用默认应用打开
- 复用现有 fsOpenInExplorer / fsOpenDefault 路由与 writeClipboard;打开失败在
  头部下方内联显示错误
- 新增 moreActions 文案(zh/en),README 快捷键表补充文件页更多操作一行
@ma15803216102

Copy link
Copy Markdown
Contributor Author

请求审阅 🙏:本 PR 为侧边栏新增「在资源管理器中打开/显示」与「使用默认应用打开」(Explorer/Git 右键 + 文件查看页 菜单,Windows/macOS/Linux 三平台适配)。

@EvanLuo42 @morlay 有空的话请帮忙 review 一下,谢谢!

说明:

  • 已 rebase 到最新 main(含 v0.11),tsc/tsdown 构建通过
  • vitest 409 通过;13 个失败均为 Windows 环境既有问题(node-pty / git \r\n / POSIX 路径断言,基线同样失败,无新增)
  • 代码变更集中在 src/open-external.ts(新增)、src/index.ts(两条 host 路由)、ExplorerView / GitView / EditorHost(右键菜单与 菜单)

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