Repository navigation
fix(desktop): LSP 日志改为普通编辑器页签,⌘W 关闭选中页签(仅 macOS 默认) - #1873
Merged
Merged
Conversation
- 状态栏“LSP 日志”不再弹出模态窗口,改为在编辑组中打开唯一的“LSP 日志”页签,可切换、拖动、分屏和关闭;会话不保存该页签 - 页签一次显示一个服务器(下拉选择):停在末尾时自动跟随新日志,按级别着色,文本筛选,无匹配时有提示,按服务器清空视图,停止/重启按钮 - 选中日志页签时,状态栏显示该页签所示服务器的状态 - 文件菜单与 Find Action 的“关闭标签页”(tab.close) 改为关闭编辑组当前选中的任意页签(文件、Diff、查看器、LSP 日志) - 快捷键目录新增 tab.close:macOS 默认 ⌘W,其他平台不设默认,可在快捷键页自行绑定;焦点在终端时关闭该终端页签,运行中进程沿用确认 - 抽出 placeEditorMember 去掉 Diff/查看器/日志页签的重复放置代码;修正十六进制查看器拖动时的页签图标 - 更新 lsp-status-logs、editor-text-tabs 功能矩阵条目 - 既有债:LSP 日志页签平台层缓冲与筛选迁入 Core 见 #1869
PR 模板、develop-lithe Skill 和插件设置内容提案 Note 仍引用已移除的 scripts/macos/verify/verify-runtime-bundle-immutability.sh,改为现存的 scripts/desktop/verify/verify-runtime-bundle-immutability.sh。
xiaoyumuxi
marked this pull request as ready for review
November 13, 2026 17:59
This was referenced Nov 13, 2026
This was referenced Nov 13, 2026
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
PR 类型 / Type
改动说明 / What changes
背景 / Why
在旧 macOS 客户端里,语言服务器日志是编辑器区的一个普通“LSP 日志”页签。Viva 桌面端(
desktop/)把它做成了模态弹窗,会挡住编辑器,也不能和文件并排看。另外 Viva 的快捷键目录里没有“关闭标签页”,macOS 上按 ⌘W 没有反应;“文件”菜单的“关闭标签页”也只在选中文件时出现,选中 Diff、查看器或日志页签时无法关闭。这个 PR 把日志恢复成普通页签,并让“关闭标签页”对任何选中的页签都有效。macOS 默认绑定 ⌘W;其他平台不设默认值,用户可以在快捷键设置页自己绑定。
改动 / Changes
LSP 日志改为普通编辑器页签(
lsp_status.go、app.go、root.go)lsp:log),可以像文件页签一样切换、拖动、分屏和关闭。关闭后再打开,之前收到的日志仍在。lspLogPopup及a.editor.lsp.open的打开方式。日志页签的查看体验(用户授权在“不影响查看”的前提下自行优化)
logsAdded计数判断有没有新行)。lspLogLine。native.clearLogView,只清空页签中的显示,不影响日志文件。关闭选中页签(
commands.go、root.go、shortcuts.go)tab.close关闭编辑组当前选中的页签,文件、Diff、查看器、LSP 日志都可以,效果和点页签上的关闭按钮一样。原来只在选中文件时提供,现在不再限制类型。另存为、丢弃草稿两项的条件不变,只是挪到前面单独判断。shortcuts.CloseTab = "tab.close"(“项目”分组,放在“关闭项目”之后)。closeTabDefaults()只在darwin上返回 ⌘W,其他平台返回空,所以 Windows 默认不绑定,快捷键设置页会自动列出这个动作供用户绑定。windowShortcuts额外读出聚焦的终端,runShortcut签名改为(id, view, term)。页签公共代码(
difftab.go、viewer.go、tabstrip.go、tabdrag.go、terminals.go、editor_view.go)placeDiff改为通用的placeEditorMember(p, member),并返回所在的编辑组。Diff、查看器、LSP 日志都用它,删掉openViewer里复制的同一段逻辑。shownTab新增lsp,页签栏、拖动预览、分屏放置(dropTab)和编辑组正文(groupBody)都能处理 LSP 日志页签。tabLabel/tabIcon,十六进制查看器等也显示自己的图标。i18n(
shared/i18n/、desktop/internal/i18n/shared.generated.go)desktop.lsp.logTitle。logs.language.tabTitle(“LSP 日志”)和native.clearLogView的平台范围加上desktop,并重新生成。功能矩阵
lsp-status-logs.json:notes 改写为页签行为,证据加上tabstrip.go、editor_view.go。editor-text-tabs.json:notes 写明关闭选中页签的范围、macOS 默认 ⌘W、其他平台可自行绑定,以及终端里的行为;证据加上commands.go、root.go、shortcuts.go、close_tab_shortcut_test.go。过时路径(机械修正)
.github/pull_request_template.md、.agents/skills/develop-lithe/SKILL.md两处、.agents/notes/proposed/architecture/2026-11-12-plugin-authored-settings-content.md中的scripts/macos/verify/verify-runtime-bundle-immutability.sh改为实际存在的scripts/desktop/verify/verify-runtime-bundle-immutability.sh。旧路径已不存在。测试
close_tab_shortcut_test.go:TestCloseTabDefaultsToCommandWOnlyOnMacOSTestCloseTabShortcutClosesTheSelectedEditorTab:非 macOS 上先确认未绑定时 Ctrl-W 不关闭,再按设置页的方式绑定后验证。TestCloseTabShortcutClosesTheFocusedTerminallsp_status_test.go改写或新增:TestLSPStatusFollowsStateAndLogOpensAsAnEditorTabTestLSPLogTabSplitsOffAndClosesTestLSPLogFollowsTheNewestLineUntilScrolledAwayTestLSPLogLineColorFollowsTheEventLevelgit_gutter_test.go跟随runShortcut的新签名。不在本 PR 范围内 / Out of scope
filterLogLines,违反逻辑归属规则,所以本 PR 不加。类型专属:fix
复现与根因
lspLogPopup(ui.ModalWith)以及tab.close只在selectedDocument != nil时添加,都来自 Viva 迁移提交 0faecba(Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799,git log -S lspLogPopup/git log -S '"tab.close"');迁移时快捷键目录没有登记 Close Tab。检查项
desktop/internal/workbench/close_tab_shortcut_test.go、desktop/internal/workbench/lsp_status_test.go。在 preview(cc403726a)上用等价的临时检查测试运行,失败输出:runShortcut只有root.go和git_gutter_test.go调用。placeDiff只有difftab.go调用,已改名。"tab.close"只在commands.go、shortcuts.go和测试中出现。lspLogPopup、desktop.lsp.logTitle已无引用。不涉及契约字段、插件、SDK 或脚本。tabLook),把placeDiff合并为placeEditorMember(日志页签需要复用),并修正过时的脚本路径。发现的既有问题已提交 Issue:[Feature] Viva LSP 日志页签自存 500 行并在 Go 里筛选:改为通过 Core 查询统一 v2 日志,删除平台层缓冲与 filterLogLines #1869、[Feature] Viva 桌面端快捷键目录的默认值、解析与冲突检测改用 Rust Core keymap #1871。.agents/notes/implemented/bug-fix/记录:没有新增需要长期记住的取舍。“日志是普通页签”和“⌘W 只在 macOS 默认”由上面的回归测试和功能矩阵 notes 固定。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/lsp-status-logs.json、editor-text-tabs.json的 notes 和证据路径。两端的实现状态、验证状态没有改,Windows 未实机验证,保持原状态。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD,都通过。.artifacts/下生成的矩阵视图。统一日志系统 / Structured logging
app.action.performed事件,点击状态项记lsp.log.open(surfacebutton),快捷键关闭终端记command.tab.close(surfaceshortcut),没有新事件 ID 或直接输出。node scripts/logging/generate-log-events.mjs --check和node scripts/logging/verify-log-usage.mjs:未完成。scripts/logging/下的门禁脚本已被移除,无法运行;按develop-lithe的 logging 参考页,恢复前这一项标为未完成,恢复工作由 [Feature] 恢复 Viva 日志事件类型生成和目录使用门禁 #1802 跟踪。界面文案 / i18n
logs.language.tabTitle、native.clearLogView(平台范围加上desktop),删除desktop.lsp.logTitle,并用node scripts/i18n/generate-i18n.mjs重新生成;没有手改生成文件。node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过;没有放宽脚本或扩大豁免名单。逻辑归属 / Logic placement
core.OpenEditor/ActivateEditor/CloseEditor)完成,平台层只负责呈现。refactorIssue。filterLogLines只把元素类型从字符串改成带级别的行,用来着色,匹配规则不变,也没有扩大。改读 Core 统一日志并交给 Core 筛选的工作见 [Feature] Viva LSP 日志页签自存 500 行并在 Go 里筛选:改为通过 Core 查询统一 v2 日志,删除平台层缓冲与 filterLogLines #1869。shortcuts.go按现有写法只加了一个动作和它的平台默认值,没有改变解析、合并或冲突规则。整个目录改用 Core keymap 见 [Feature] Viva 桌面端快捷键目录的默认值、解析与冲突检测改用 Rust Core keymap #1871。性能与内存 / Performance and memory
desktop/internal/editor/**、editorview/**),也没有新增依赖。设置 / Settings
N/A:没有新增或修改设置项。快捷键设置页按目录自动列出新动作“关闭标签页”,页面代码没有改。
插件契约 / Plugin contract
N/A:不涉及插件契约、能力版本、插件函数协议或宿主方法。
发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过。无用代码与重构 / Dead code and refactoring
lspLogPopup、a.editor.lsp.open的打开方式、desktop.lsp.logTitle词条、openViewer里重复的放置逻辑。refactor标签的 Issue,没有在本 PR 顺手处理:[Feature] Viva LSP 日志页签自存 500 行并在 Go 里筛选:改为通过 Core 查询统一 v2 日志,删除平台层缓冲与 filterLogLines #1869、[Feature] Viva 桌面端快捷键目录的默认值、解析与冲突检测改用 Rust Core keymap #1871。验证 / Verification
gofmt -l(改动的 Go 文件)scripts/desktop/desktop-go.sh vet ./internal/workbench/ ./internal/shortcuts/ ./internal/settingswindow/scripts/desktop/desktop-go.sh test ./internal/workbench/ ./internal/settingswindow/(合入最新 preview cc40372 之后重跑).agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/workbench --filter '<本 PR 新增和改写的测试>'(静态检查加计时运行)./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEADnode scripts/i18n/verify-app-language-localization.mjsnode scripts/i18n/generate-i18n.mjs --check./scripts/desktop/verify/verify-runtime-bundle-immutability.sh./scripts/agent-notes/verify-agent-notes.sh(改了一份 proposed Note 中的路径)未能执行的检查和原因:
runtime.GOOS分支和测试中的非 darwin 分支覆盖,没有在 Windows 上运行。scripts/logging/*):脚本已被移除,见 [Feature] 恢复 Viva 日志事件类型生成和目录使用门禁 #1802。提交前确认 / Final checks
preview创建,并已合入当前的origin/preview(cc403726a);目标分支为preview。.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图。