Repository navigation
feat(desktop): 语言服务器启动失败或异常退出时发送通知并显示 LSP 出错状态与重试入口 - #2090
Merged
Merged
Conversation
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
当插件语言服务器在启动前置阶段(
StartLanguageServer)失败或在ServeLanguageSession阶段非主动取消异常退出时,此前工作台只记录operationFailed诊断日志并删除会话条目,既不弹出用户可见通知,也让底部状态栏回退显示灰色的LSP 未启动,用户无法得知失败原因也无法从状态栏菜单直接重试或查看日志。改动 / Changes
shared/i18n/messages.json、desktop/internal/i18n/shared.generated.go:为native.languageServerFailedToStart与native.languageServerFailedToStart.variant2启用desktop平台生成。desktop/internal/workbench/app.go、desktop/internal/workbench/pluginbackends.go):finishPluginServerStart(err != nil且非切项目/插件被禁用卸载)和pluginServerExited(serveErr != nil且非主动取消/停服)路径中,通过notifyPluginServerFailure调用a.notifyError(...)发送用户可见错误通知,并按工作区 + 语言对相同错误去重,避免重复刷屏。pluginServerFailed记录失败条目(含pluginID、languageID、version、失败原因及退出前保留的日志 +[ERROR]原因行),与运行中的a.pluginServers隔离,避免影响documentSyncServer和设置页Running状态判断;在成功启动、手动停止/禁用/卸载或关闭项目时清理。desktop/internal/workbench/lsp_status.go):lspStatusText()/lspStatusColor()在当前文档对应语言服务器失败时显示LSP 出错(desktop.status.lspFailed)与a.theme.Danger红点。lspStatusMenu()列出失败的语言服务器条目,子菜单显示失败原因并提供“查看日志”与“重启服务器”(调用retryFailedLSPServer),“重启所有服务器”同步重试失败条目。lspLogView()/lspLogBar()支持查看失败服务器的日志与失败原因,并提供“重启服务器”入口。desktop/internal/workbench/settings_toolchains.go、desktop/internal/workbench/settings_plugin_restart.go):settingsToolchains.Save成功保存全局或项目级工具链后,调用retryFailedPluginServers()清除失败去重并重新触发失败/未启动语言的语言服务器启动。restartSettingsPlugin在插件处于失败状态时也可重新触发其语言服务器启动。desktop/internal/workbench/pluginbackends_test.go、desktop/internal/workbench/lsp_status_test.go、desktop/internal/workbench/problems_test.go):TestFinishPluginServerStartFailureNotifiesAndDeduplicates、TestPluginServerExitedWithErrorRetainsFailureAndLogs、TestRetryFailedLSPServerClearsFailureState、TestLSPStatusAndMenuShowFailedServerAndLog。不在本 PR 范围内 / Out of scope
无
类型专属:feat
多平台对齐
desktop/internal/workbench跨平台实现)范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json:完善既有lsp-status-logs能力的失败态呈现与通知行为,未新增独立功能矩阵条目.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
dev.lithe.test.lsp)和现有测试夹具,不依赖任何真实插件shared/i18n/UI 验证 / UI evidence
TestLSPStatusAndMenuShowFailedServerAndLog验证状态栏文本、红点颜色、菜单子项、失败原因展示与日志页打开行为统一日志系统 / Structured logging
a.operationFailed("plugin_server_start", err)与a.operationFailed("plugin_server", serveErr)结构化失败事件,未新增手写日志或print界面文案 / i18n
shared/i18n/messages.json启用desktop平台,运行node scripts/i18n/generate-i18n.mjs并提交生成结果node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check通过逻辑归属 / Logic placement
性能与内存 / Performance and memory
lspLogLines),无新增轮询或主线程阻塞 I/O,关闭项目时释放状态设置 / Settings
插件契约 / Plugin contract
发行包与资源 / Bundle and resources
无用代码与重构 / Dead code and refactoring
验证 / Verification
./scripts/desktop/desktop-go.sh test -race ./internal/workbench -run "TestLSPStatus|TestLSP|TestPluginServer|TestStopPluginServer|TestStartPluginServer|TestFinishPluginServerStart|TestRetryFailedLSPServer|TestRestartSettingsPlugin|TestExitedServerWithdrawsDiagnostics" -count=1ok 5.597s)node scripts/i18n/generate-i18n.mjs --check && node scripts/i18n/verify-app-language-localization.mjs./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh未能执行的检查和原因:
提交前确认 / Final checks
origin/main创建(fix/2088-lsp-failure-notification).artifacts/等产物