Repository navigation
feat(tree): 项目树右键“打开于”——打开方式列出系统关联应用、访达、终端 - #2131
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 18, 2026 04:05
26 of 29 tasks
2 tasks done
15 of 18 tasks
12 of 15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
Closes #…。PR 类型 / Type
改动说明 / What changes
背景 / Why
/Applications里找;底部“在访达中显示”是另一条单独的项。改动 / Changes
菜单(
desktop/internal/workbench/filetree_openin.go、filetree_menu.go)/Applications和~/Applications各一份)名称后带所在文件夹。revealPath)。treeApps,每帧由root.go的endPaint收尾),菜单关闭后丢弃,下次重新查,系统关联的修改立刻反映。open -a会等命令结束);系统已不再提供该应用时提示“‘{名称}’已不能打开这类文件”,其他失败提示系统原因。openTreeFileWith,filetree_open.go只改了注释)。app.action.performed(新动作workspace.tree.openWithApp、workspace.tree.openInTerminal;访达沿用workspace.tree.reveal),打开失败记app.notification.operation_failed(project_tree_open_with),查询失败记app.background.operation_failed(project_tree_list_apps)。系统查询(新包
desktop/internal/fileapps)List(path)返回系统为该文件提供的应用(默认在前),Open(path, app)用选中的应用打开,Labels给同名应用加位置。只接受绝对路径。fileapps_darwin.go,cgo + Objective-C):NSWorkspace的URLForApplicationToOpenURL/URLsForApplicationsToOpenURL,名称用displayNameAtPath,按localizedStandardCompare排序、去重。打开交给 Viva 的app.OpenWith。这和 Finder“打开方式”用的是同一份 LaunchServices 数据。fileapps_windows.go,纯 syscall/COM,无 cgo):SHAssocEnumHandlers(ASSOC_FILTER_RECOMMENDED)列出资源管理器“打开方式”的推荐处理器;默认项用AssocQueryStringW查出的程序路径或友好名称匹配后移到最前,其余保持系统顺序。打开时重新列出处理器、按名称找到同一个,调用IAssocHandler::Invoke(数据对象来自SHCreateItemFromParsingName+BindToHandler(BHID_DataObject)),这样商店应用也能打开。COM 调用在锁定的 OS 线程上以 STA 初始化,处理器数量有上限 64。fileapps_other.go):不列应用,Linux 只显示“其他…”。文案(
shared/i18n/,已重新生成shared.generated.go)desktop.files.openIn(打开于 / Open In)、openWithDefault、openWithAppPath、openWithFinding、openWithOther、openWithGone、openInFinder(访达 / Finder)、openInExplorer(资源管理器 / File Explorer)、openInTerminal(终端 / Terminal)。desktop.files.openWith改为子菜单标题“打开方式 / Open With”(原为“用其他应用打开… / Open With…”)。文档
.agents/notes/implemented/feature/2026-11-03-macos-open-with.md整体重写:原决策“只做应用选择器、不把系统应用列表放进菜单”被本决策取代,记录菜单结构、两端的系统接口、为什么放在 Lithe 的fileapps而不是 Viva 或 Rust Core、“终端”为什么打开内置终端。file-open-with更新能力描述、两端证据和 Viva 验证动作(两端保持pending);workspace-files的说明把“在 Finder/资源管理器中显示”改为“打开于”。docs/assets/project-tree-open-in/(含改动前后对照和说明)。测试
filetree_openin_test.go(替换系统查询和打开):菜单结构(顶层不再有旧两项,“打开于”含三项,文件夹和项目根没有“打开方式”);列表标签(默认、同名带位置、其他…)、选中后以完整路径和所选应用打开、只查询一次;系统无应用或查询失败时只剩“其他…”;两种打开失败的提示;“访达”显示完整路径;“终端”在文件夹 / 文件所在文件夹启动(用脚本 shell 写出pwd -P比对,非 Windows)。fileapps_test.go:查询本机真实数据库并记录列表(默认只可能在最前;macOS 上都是.app绝对路径);相对路径和空应用被拒绝;Labels只给同名应用加位置。fileapps_windows_test.go:默认项按程序路径(忽略大小写)或打包应用名称匹配并移到最前。filetree_openin_visual_test.go(vivahead,lithevisual):生成上述截图。不在本 PR 范围内 / Out of scope
revealLabel仍被它们使用)。.exe,不会列出商店应用。pending。fileapps可以整个迁过去;Viva 固定版本由维护团队负责,本 PR 不改 Viva 固定版本。类型专属:feat
多平台对齐
SHAssocEnumHandlers;Windows 只完成交叉编译和go vet,实机验收 pending,见“验证”)platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/file-open-with.json和workspace-files.json:能力描述、两端证据、验证动作;两端验证状态保持pending./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空shared/i18n/UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… ../scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual ./internal/workbench -run '^TestVisualProjectTreeOpenIn$' -count=1(在desktop/下),窗口 1100×680,深色中文、浅色英文;场景:文件行菜单、“打开于”、“打开方式”、文件夹行“打开于”。“打开方式”里的应用由测试替换的列表给出before/由改动前的filetree_menu.go和 i18n 生成);macOS 原生窗口和 Windows 原生窗口验收未做统一日志系统 / Structured logging
app.action.performed、app.notification.operation_failed、app.background.operation_failed,action/operation是固定 token;没有print、直接写 stderr 或手写事件 IDopenTreeFileWithApp的结果处理处记录一次;查询失败降级为只显示“其他…”并记一次后台失败documentLogError记录界面文案 / i18n
shared/i18n/补齐中英词条,运行node scripts/i18n/generate-i18n.mjs并提交生成结果;Viva 代码通过desktop/internal/i18n/读取node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check和node --test scripts/i18n/test-i18n.mjs,没有放宽脚本逻辑归属 / Logic placement
desktop/internal/fileapps性能与内存 / Performance and memory
设置 / Settings
N/A:没有新增或修改设置。
插件契约 / Plugin contract
N/A:不涉及插件契约、宿主方法或 Core 修订。
发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh无用代码与重构 / Dead code and refactoring
revealLabel仍被编辑器标签、Git 评审、全局搜索和图片查看器使用,保留验证 / Verification
../scripts/desktop/desktop-go.sh test ./... -count=1(desktop/)../scripts/desktop/desktop-go.sh test -race ./internal/fileapps ./internal/workbench -run 'TestList|TestLabels|TestProjectTreeOpen' -count=1test-stability-macos.sh --package ./internal/workbench -- --filter 'TestProjectTreeOpen'.artifacts/test-stability/index.htmlTestListAnswersInTheSystemsOrder -v(真实 LaunchServices,notes.txt)TestVisualProjectTreeOpenInGOOS=windows GOARCH=amd64 CGO_ENABLED=0 go vet ./internal/fileapps与go test -cGOOS=linux go vet ./internal/fileappsverify-test-stability.sh与--base origin/mainverify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/main HEADverify-agent-notes.shverify-runtime-bundle-immutability.shrg未能执行的检查和原因:
fileapps_windows.go的 COM 调用只经过交叉编译和go vet;标记 ready 后的 Windows CI 会运行fileapps的测试(含真实关联数据库查询和默认项排序)。Windows 原生窗口中的菜单、打开商店应用仍需人工验收。提交前确认 / Final checks
main创建(已 rebase 到bc5c0f8a3);目标分支main