From 2ce8b0f2a884c8a6caf5ba187e81c13168fd841b Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Tue, 17 Nov 2026 02:46:33 -0800 Subject: [PATCH] fix(desktop): surface unavailable LSP details in plugin settings and deduplicate toolchain retry notices --- .../internal/pluginbackend/pluginbackend.go | 20 ++++ desktop/internal/settingswindow/controller.go | 1 + .../plugin_settings_actions_view_test.go | 70 +++++++++++ .../settingswindow/plugin_settings_view.go | 6 +- .../plugin_settings_visual_test.go | 82 +++++++++++++ desktop/internal/workbench/debug_start.go | 12 +- desktop/internal/workbench/pluginbackends.go | 1 - .../internal/workbench/pluginbackends_test.go | 110 ++++++++++++++++++ .../workbench/settings_plugin_effects.go | 11 +- .../workbench/settings_plugin_effects_test.go | 26 +++++ .../workbench/settings_plugin_restart.go | 8 ++ .../features/declarative-plugin-settings.json | 16 ++- 12 files changed, 356 insertions(+), 7 deletions(-) diff --git a/desktop/internal/pluginbackend/pluginbackend.go b/desktop/internal/pluginbackend/pluginbackend.go index f1b04fe4e5..38f00b9c2f 100644 --- a/desktop/internal/pluginbackend/pluginbackend.go +++ b/desktop/internal/pluginbackend/pluginbackend.go @@ -56,6 +56,26 @@ func (e *SharedProviderError) Error() string { return fmt.Sprintf("build provider %s shares the %s language-server session", e.BuildSystemID, e.LanguageID) } +// SessionUnavailableError reports that a plugin server is not running and +// preserves any startup or exit diagnostic recorded for the user. +type SessionUnavailableError struct { + PluginID string + LanguageID string + Detail string +} + +func (e *SessionUnavailableError) Error() string { + base := fmt.Sprintf("the %s language server of %s is not running", e.LanguageID, e.PluginID) + if e.Detail != "" { + return base + ": " + e.Detail + } + return base +} + +func (e *SessionUnavailableError) Unwrap() error { + return ErrNoSession +} + // Kernel is the part of the Core client this package uses. *core.Client // satisfies it. type Kernel interface { diff --git a/desktop/internal/settingswindow/controller.go b/desktop/internal/settingswindow/controller.go index 6e141eb092..0d4e3fd76a 100644 --- a/desktop/internal/settingswindow/controller.go +++ b/desktop/internal/settingswindow/controller.go @@ -37,6 +37,7 @@ type PluginState struct { // PluginRuntimeState is a memory-only view of the current native session. type PluginRuntimeState struct { Running bool + Failed bool RestartRequired bool Restarting bool Version string diff --git a/desktop/internal/settingswindow/plugin_settings_actions_view_test.go b/desktop/internal/settingswindow/plugin_settings_actions_view_test.go index e00c6d4add..718e5c4fb2 100644 --- a/desktop/internal/settingswindow/plugin_settings_actions_view_test.go +++ b/desktop/internal/settingswindow/plugin_settings_actions_view_test.go @@ -12,6 +12,7 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/marketplace" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginbackend" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginsettings" "github.com/vivaui/viva/app" @@ -106,3 +107,72 @@ func TestSettingsActionButtonsConfirmDismissAndPreserveUnsavedInput(t *testing.T t.Fatalf("action saved preferences: %v", err) } } + +type unavailableActionSource struct { + settingsFormSource + err error +} + +func (s unavailableActionSource) Action(context.Context, pluginservice.SettingsEditor, string, bool) (pluginservice.SettingsActionResult, error) { + return pluginservice.SettingsActionResult{}, s.err +} + +func TestSettingsActionUnavailableShowsProviderReasonAndRestartForFailedServer(t *testing.T) { + data, err := os.ReadFile(contractfixture.CoreFixture("plugins/settings-documents.json")) + if err != nil { + t.Fatal(err) + } + var fixture struct{ Manifest map[string]any } + if err := json.Unmarshal(data, &fixture); err != nil { + t.Fatal(err) + } + fixture.Manifest["settings"] = []any{map[string]any{"id": "count", "type": "integer", "title": "Count", "default": 3, "minimum": 1, "maximum": 10}} + fixture.Manifest["settingActions"] = []any{map[string]any{"id": "read", "title": "Read compiler settings", "function": "compiler.read"}} + manifest, err := json.Marshal(fixture.Manifest) + if err != nil { + t.Fatal(err) + } + workspace := t.TempDir() + source := unavailableActionSource{ + settingsFormSource: settingsFormSource{store: pluginsettings.New(core.NewClient(), t.TempDir()), manifest: manifest, workspace: workspace}, + err: &pluginbackend.SessionUnavailableError{PluginID: "dev.example.settings", LanguageID: "java", Detail: "missing jdtls"}, + } + fetch := func(context.Context) (marketplace.Snapshot, error) { + return marketplace.Snapshot{Index: core.MarketplaceIndex{Plugins: []core.MarketplacePlugin{{ID: "dev.example.settings", Name: "Settings", LatestVersion: "1.0.0"}}}}, nil + } + restartCalls := 0 + w := newWindow(NewController(Options{ + PluginSettings: source, + Marketplace: fetch, MarketplaceInstalled: fetch, + PluginState: func(string) PluginState { return PluginState{Installed: true} }, + InstalledPlugins: func() []PluginFacts { + return []PluginFacts{{ID: "dev.example.settings", Name: "Settings", Version: "1.0.0", Settings: 1}} + }, + PluginRuntime: func(string) PluginRuntimeState { + return PluginRuntimeState{Failed: true, RestartRequired: true, Version: "1.0.0", Workspace: workspace} + }, + RestartPlugin: func(string, string, string, string) { restartCalls++ }, + }), Values{}) + w.sess.page = pagePlugins + w.installed.tab = installedSettings + d := openWindow(t, w, func(config *app.Config) { config.Height = 1100 }) + words := func(key string) string { return i18n.Shared(i18n.English, "desktop.pluginSettings."+key) } + d.until("the plugin form", func() bool { return w.pluginSettings.loaded }) + d.click("Read compiler settings") + d.until("the action failure", func() bool { return w.pluginSettings.failed != nil && !w.pluginSettings.running }) + d.pump() + + if !d.textContaining("no running provider") { + t.Fatalf("missing provider-unavailable guidance, labels=%+v", d.driver.Snapshot().Labels) + } + if !d.textContaining("missing jdtls") { + t.Fatalf("missing recorded language-server startup detail, labels=%+v", d.driver.Snapshot().Labels) + } + if d.textContaining("Unable to read or save settings") { + t.Fatalf("still displayed misleading generic save failure %q", words("failed")) + } + d.click(words("restart")) + if restartCalls != 1 { + t.Fatalf("restart calls for failed server = %d, want 1", restartCalls) + } +} diff --git a/desktop/internal/settingswindow/plugin_settings_view.go b/desktop/internal/settingswindow/plugin_settings_view.go index 0d1163f31b..1319da6a54 100644 --- a/desktop/internal/settingswindow/plugin_settings_view.go +++ b/desktop/internal/settingswindow/plugin_settings_view.go @@ -105,6 +105,10 @@ func (w *window) pluginSettingsPanel(c ui.C, id string) { message = i18n.Shared(language, "desktop.pluginSettings.conflict") } ui.Wrap(c, message).FontSize(12).Color(w.pal.danger) + var unavailable *pluginbackend.SessionUnavailableError + if errors.As(p.failed, &unavailable) && unavailable.Detail != "" { + ui.Wrap(c, unavailable.Detail).FontSize(12).Color(w.pal.danger) + } } if p.running { ui.Text(c, i18n.Shared(language, "native.loading")).FontSize(12).Color(w.pal.muted) @@ -113,7 +117,7 @@ func (w *window) pluginSettingsPanel(c ui.C, id string) { runtime := w.ctrl.opts.PluginRuntime(id) if runtime.RestartRequired || runtime.Restarting { ui.Wrap(c, i18n.Shared(language, "desktop.pluginSettings.restartRequired")).FontSize(12).Color(w.pal.muted) - if w.ctrl.opts.RestartPlugin != nil && ui.Button(c, i18n.Shared(language, "desktop.pluginSettings.restart")).Disabled(!runtime.Running || runtime.Restarting || p.running || !p.loaded || runtime.Version != p.editor.Snapshot.State.Metadata.Version).Clicked() { + if w.ctrl.opts.RestartPlugin != nil && ui.Button(c, i18n.Shared(language, "desktop.pluginSettings.restart")).Disabled((!runtime.Running && !runtime.Failed) || runtime.Restarting || p.running || !p.loaded || runtime.Version != p.editor.Snapshot.State.Metadata.Version).Clicked() { scope := "global" if p.scope == 1 { scope = "project" diff --git a/desktop/internal/settingswindow/plugin_settings_visual_test.go b/desktop/internal/settingswindow/plugin_settings_visual_test.go index b87f9b6691..3f01bf6419 100644 --- a/desktop/internal/settingswindow/plugin_settings_visual_test.go +++ b/desktop/internal/settingswindow/plugin_settings_visual_test.go @@ -13,6 +13,8 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/marketplace" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginbackend" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginsettings" "github.com/vivaui/viva/headless" ) @@ -158,3 +160,83 @@ func TestVisualPluginSettingsPage(t *testing.T) { }) } } + +type visualUnavailableActionSource struct { + settingsFormSource + err error +} + +func (s visualUnavailableActionSource) Action(context.Context, pluginservice.SettingsEditor, string, bool) (pluginservice.SettingsActionResult, error) { + return pluginservice.SettingsActionResult{}, s.err +} + +func TestVisualPluginSettingsUnavailableAction(t *testing.T) { + out := os.Getenv("LITHE_VISUAL_OUTPUT_DIR") + if out == "" { + t.Skip("set LITHE_VISUAL_OUTPUT_DIR to capture the unavailable plugin settings action") + } + if err := os.MkdirAll(out, 0755); err != nil { + t.Fatal(err) + } + data, err := os.ReadFile(contractfixture.CoreFixture("plugins/settings-documents.json")) + if err != nil { + t.Fatal(err) + } + var fixture struct { + Manifest map[string]any `json:"manifest"` + } + if err := json.Unmarshal(data, &fixture); err != nil { + t.Fatal(err) + } + fixture.Manifest["settings"] = []any{map[string]any{"id": "languageServerFolder", "type": "directory", "title": "Language server folder", "default": "", "page": map[string]any{"languageID": "fixture"}, "effect": "restart"}} + fixture.Manifest["settingActions"] = []any{map[string]any{"id": "read", "title": "Read compiler settings", "function": "compiler.read", "page": map[string]any{"languageID": "fixture"}}} + manifest, err := json.Marshal(fixture.Manifest) + if err != nil { + t.Fatal(err) + } + workspace := t.TempDir() + for _, look := range []struct { + theme string + language i18n.Language + }{{"dark", i18n.Chinese}, {"light", i18n.English}} { + t.Run(look.theme, func(t *testing.T) { + source := visualUnavailableActionSource{ + settingsFormSource: settingsFormSource{store: pluginsettings.New(core.NewClient(), t.TempDir()), manifest: manifest, workspace: workspace}, + err: &pluginbackend.SessionUnavailableError{PluginID: "dev.example.settings", LanguageID: "fixture", Detail: "resolve the fixture launch: executable not found"}, + } + fetch := func(context.Context) (marketplace.Snapshot, error) { + return marketplace.Snapshot{Index: core.MarketplaceIndex{Plugins: []core.MarketplacePlugin{{ID: "dev.example.settings", Name: "Fixture Support", LatestVersion: "1.0.0"}}}}, nil + } + w := newWindow(NewController(Options{ + Text: func() *i18n.Messages { return i18n.For(look.language) }, Language: func() i18n.Language { return look.language }, + SystemLanguage: look.language, SystemDark: func() bool { return look.theme == "dark" }, + Marketplace: fetch, MarketplaceInstalled: fetch, PluginSettings: source, + PluginState: func(string) PluginState { return PluginState{Installed: true, Enabled: true, Version: "1.0.0"} }, + InstalledPlugins: func() []PluginFacts { + return []PluginFacts{{ID: "dev.example.settings", Name: "Fixture Support", Version: "1.0.0", Settings: 1}} + }, + PluginRuntime: func(string) PluginRuntimeState { + return PluginRuntimeState{Failed: true, RestartRequired: true, Version: "1.0.0", Workspace: workspace} + }, + RestartPlugin: func(string, string, string, string) {}, + }), Values{Theme: look.theme, Language: look.language.Code()}) + w.sess.page = pagePlugins + w.installed.tab = installedSettings + config := w.config() + config.Height = 760 + session, err := headless.Open(config, nil, headless.Options{}) + if err != nil { + t.Fatal(err) + } + t.Cleanup(session.Close) + d := &windowDriver{t: t, w: w, driver: session.Driver()} + d.until("the plugin form", func() bool { return w.pluginSettings.loaded }) + d.click("Read compiler settings") + d.until("the action failure", func() bool { return w.pluginSettings.failed != nil && !w.pluginSettings.running }) + d.pump() + if err := session.Screenshot(filepath.Join(out, "plugin-settings-unavailable-"+look.theme+".png")); err != nil { + t.Fatal(err) + } + }) + } +} diff --git a/desktop/internal/workbench/debug_start.go b/desktop/internal/workbench/debug_start.go index 2285b6a4c3..fb3f72debd 100644 --- a/desktop/internal/workbench/debug_start.go +++ b/desktop/internal/workbench/debug_start.go @@ -18,6 +18,7 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/buildprocess" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginbackend" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginhost" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginpkg" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" @@ -895,6 +896,7 @@ func (a *App) waitReadyPluginServer(ctx context.Context, p *project, pluginID, l a.pluginServerMu.Lock() server := a.pluginServers[pluginID] starting := a.pluginServerStarting[languageID] + failed := a.pluginServerFailed[languageID] a.pluginServerMu.Unlock() switch { case server != nil && server.project == p && server.isReady(): @@ -902,7 +904,15 @@ func (a *App) waitReadyPluginServer(ctx context.Context, p *project, pluginID, l case server == nil && !starting: idle++ if idle >= 3 { - return nil, fmt.Errorf("the %s language server of %s is not running", languageID, pluginID) + detail := "" + if failed != nil && failed.project == p { + detail = failed.message + } + return nil, &pluginbackend.SessionUnavailableError{ + PluginID: pluginID, + LanguageID: languageID, + Detail: detail, + } } default: idle = 0 diff --git a/desktop/internal/workbench/pluginbackends.go b/desktop/internal/workbench/pluginbackends.go index 5ba1907313..b72260c782 100644 --- a/desktop/internal/workbench/pluginbackends.go +++ b/desktop/internal/workbench/pluginbackends.go @@ -624,7 +624,6 @@ func (a *App) retryFailedPluginServers() { seen := make(map[string]bool) var languages []string a.pluginServerMu.Lock() - a.pluginServerNotifiedErrors = nil for lang, failed := range a.pluginServerFailed { if failed != nil && failed.project == a.project && !seen[lang] { seen[lang] = true diff --git a/desktop/internal/workbench/pluginbackends_test.go b/desktop/internal/workbench/pluginbackends_test.go index 21e8825302..21e54911be 100644 --- a/desktop/internal/workbench/pluginbackends_test.go +++ b/desktop/internal/workbench/pluginbackends_test.go @@ -2,14 +2,22 @@ package workbench import ( "context" + "encoding/json" "errors" + "os" + "path/filepath" "strings" + "sync" "testing" + "time" "github.com/1lck/Lithe-IDEA/desktop/internal/buildprovider" + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginbackend" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginpkg" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" + "github.com/1lck/Lithe-IDEA/desktop/internal/store" "github.com/vivaui/viva/ui" ) @@ -171,3 +179,105 @@ func TestRetryFailedLSPServerClearsFailureState(t *testing.T) { t.Fatalf("retryFailedLSPServer did not clear failure state: failed=%v notified=%v", h.app.pluginServerFailed, h.app.pluginServerNotifiedErrors) } } + +type failingLSPPlanKernel struct { + *testKernel + mu sync.Mutex + msg string +} + +func (k *failingLSPPlanKernel) PlanPluginLanguageServer(context.Context, json.RawMessage, string, core.PluginBackendDirectories) (core.PluginBackendPlan, error) { + k.mu.Lock() + msg := k.msg + k.mu.Unlock() + return core.PluginBackendPlan{}, errors.New(msg) +} + +func TestRetryFailedPluginServersPreservesNotifiedErrorDeduplication(t *testing.T) { + kernel := &failingLSPPlanKernel{testKernel: &testKernel{Client: core.NewClient()}, msg: "missing jdtls"} + h := newHarness(t, kernel) + preferences, plugins := t.TempDir(), t.TempDir() + raw, err := os.ReadFile(contractfixture.CoreFixture("plugins/settings-documents.json")) + if err != nil { + t.Fatal(err) + } + var fixture struct { + Manifest json.RawMessage `json:"manifest"` + } + if err := json.Unmarshal(raw, &fixture); err != nil { + t.Fatal(err) + } + dir := filepath.Join(plugins, "dev.example.settings", "1.0.0") + if err := os.MkdirAll(dir, 0o700); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(dir, pluginpkg.ManifestFile), fixture.Manifest, 0o600); err != nil { + t.Fatal(err) + } + service, err := pluginservice.Open(kernel, store.At(preferences), plugins) + if err != nil { + t.Fatal(err) + } + if err := service.Manager.SetEnabled("dev.example.settings", true); err != nil { + t.Fatal(err) + } + h.app.plugins = service + h.open(t.TempDir()) + + h.app.startPluginServer("fixture") + awaitStateWithin(t, h, 5*time.Second, "initial lsp failure", func() bool { + h.app.pluginServerMu.Lock() + defer h.app.pluginServerMu.Unlock() + return !h.app.pluginServerStarting["fixture"] && h.app.pluginServerFailed["fixture"] != nil + }) + if len(h.app.notifications.list) != 1 { + t.Fatalf("initial notifications = %d, want 1", len(h.app.notifications.list)) + } + + // Retrying after a toolchain save must not spam the exact same error toast again. + h.app.retryFailedPluginServers() + awaitStateWithin(t, h, 5*time.Second, "retried lsp failure", func() bool { + h.app.pluginServerMu.Lock() + defer h.app.pluginServerMu.Unlock() + return !h.app.pluginServerStarting["fixture"] && h.app.pluginServerFailed["fixture"] != nil + }) + if len(h.app.notifications.list) != 1 || h.app.notifications.list[0].count != 1 { + t.Fatalf("notifications after identical retry failure = %+v, want 1 with count=1 (deduplicated)", h.app.notifications.list) + } + + // A new failure message after changing toolchains must still notify the user. + kernel.mu.Lock() + kernel.msg = "bad jdk version" + kernel.mu.Unlock() + h.app.retryFailedPluginServers() + awaitStateWithin(t, h, 5*time.Second, "updated lsp failure", func() bool { + h.app.pluginServerMu.Lock() + defer h.app.pluginServerMu.Unlock() + failed := h.app.pluginServerFailed["fixture"] + return !h.app.pluginServerStarting["fixture"] && failed != nil && strings.Contains(failed.message, "bad jdk version") + }) + if len(h.app.notifications.list) != 2 { + t.Fatalf("notifications after new failure = %d, want 2: %+v", len(h.app.notifications.list), h.app.notifications.list) + } +} + +func TestWaitReadyPluginServerWrapsErrNoSession(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + h.open(t.TempDir()) + p := h.app.project + h.app.pluginServerMu.Lock() + h.app.pluginServerFailed = map[string]*failedPluginServer{ + "java": {pluginID: "dev.lithe.test.lsp", languageID: "java", project: p, message: "missing jdtls"}, + } + h.app.pluginServerMu.Unlock() + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + _, err := h.app.waitReadyPluginServer(ctx, p, "dev.lithe.test.lsp", "java") + if !errors.Is(err, pluginbackend.ErrNoSession) { + t.Fatalf("waitReadyPluginServer err = %v, want errors.Is(_, pluginbackend.ErrNoSession)", err) + } + if err == nil || !strings.Contains(err.Error(), "missing jdtls") { + t.Fatalf("waitReadyPluginServer err = %v, want recorded detail %q", err, "missing jdtls") + } +} diff --git a/desktop/internal/workbench/settings_plugin_effects.go b/desktop/internal/workbench/settings_plugin_effects.go index 8d6e842add..da0528f74d 100644 --- a/desktop/internal/workbench/settings_plugin_effects.go +++ b/desktop/internal/workbench/settings_plugin_effects.go @@ -23,8 +23,17 @@ func (a *App) applyPluginSettingsEffects(owner core.PluginSettingsOwner, effects a.pluginServerMu.Lock() server := a.pluginServers[id] running := server != nil && server.project == p && server.session != nil && server.session.Version == owner.Version + failed := false + if !running { + for _, entry := range a.pluginServerFailed { + if entry != nil && entry.pluginID == id && entry.project == p && entry.version == owner.Version { + failed = true + break + } + } + } a.pluginServerMu.Unlock() - if running { + if running || failed { a.pluginSettingsRestart.Store(id, true) } case "immediate": diff --git a/desktop/internal/workbench/settings_plugin_effects_test.go b/desktop/internal/workbench/settings_plugin_effects_test.go index 774db0c6f6..e774413803 100644 --- a/desktop/internal/workbench/settings_plugin_effects_test.go +++ b/desktop/internal/workbench/settings_plugin_effects_test.go @@ -62,3 +62,29 @@ func TestPluginSettingsLatestQueuedDeadlineRequiresRestart(t *testing.T) { t.Fatal("latest queued deadline silently discarded its saved configuration") } } + +func TestPluginSettingsRestartEffectMarksFailedServerRetryable(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + h.open(t.TempDir()) + p := h.app.project + original := h.app.plugins + h.app.plugins = &pluginservice.Service{} + defer func() { h.app.plugins = original }() + h.app.pluginServerMu.Lock() + h.app.pluginServerFailed = map[string]*failedPluginServer{ + "fixture": {pluginID: "dev.lithe.test.lsp", languageID: "fixture", version: "1.0.0", project: p, message: "missing jdtls"}, + } + h.app.pluginServerMu.Unlock() + + h.app.applyPluginSettingsEffects(core.PluginSettingsOwner{PluginID: "dev.lithe.test.lsp", Version: "1.0.0"}, []string{"restart"}) + runtime := h.app.pluginSettingsRuntime("dev.lithe.test.lsp") + if !runtime.RestartRequired { + t.Fatal("saving a restart-effect setting for a failed server did not set RestartRequired") + } + if runtime.Running { + t.Fatal("failed server must still report Running=false") + } + if runtime.Version != "1.0.0" || runtime.Workspace != p.root { + t.Fatalf("runtime = %+v, want version=1.0.0 workspace=%s", runtime, p.root) + } +} diff --git a/desktop/internal/workbench/settings_plugin_restart.go b/desktop/internal/workbench/settings_plugin_restart.go index d8f96b83e2..bde38c53e4 100644 --- a/desktop/internal/workbench/settings_plugin_restart.go +++ b/desktop/internal/workbench/settings_plugin_restart.go @@ -16,6 +16,13 @@ func (a *App) pluginSettingsRuntime(id string) settingswindow.PluginRuntimeState server := a.pluginServers[id] if server != nil && server.session != nil && server.project != nil { state.Running, state.Version, state.Workspace = true, server.session.Version, server.project.root + return state + } + for _, failed := range a.pluginServerFailed { + if failed != nil && failed.pluginID == id && failed.project != nil { + state.Failed, state.Version, state.Workspace = true, failed.version, failed.project.root + break + } } return state } @@ -41,6 +48,7 @@ func (a *App) restartSettingsPlugin(id, version, scope, workspace string) { a.clearFailedPluginServerLocked(id, "") delete(a.pluginServerSuppressed, id) a.pluginServerMu.Unlock() + a.pluginSettingsRestart.Delete(id) a.invalidator.Invalidate() for _, lang := range retryLanguages { a.startPluginServer(lang) diff --git a/shared/platform-feature-matrix/features/declarative-plugin-settings.json b/shared/platform-feature-matrix/features/declarative-plugin-settings.json index ccd3af2091..40bba8d66f 100644 --- a/shared/platform-feature-matrix/features/declarative-plugin-settings.json +++ b/shared/platform-feature-matrix/features/declarative-plugin-settings.json @@ -51,7 +51,12 @@ "desktop/internal/workbench/settings_plugin_sources.go", "desktop/internal/settingswindow/source_settings_entries.go", "desktop/internal/settingswindow/source_settings_entries_view.go", - "desktop/internal/settingswindow/source_settings_modules_test.go" + "desktop/internal/settingswindow/source_settings_modules_test.go", + "desktop/internal/workbench/settings_plugin_restart.go", + "desktop/internal/workbench/settings_plugin_restart_test.go", + "desktop/internal/workbench/debug_start.go", + "desktop/internal/workbench/pluginbackends_test.go", + "desktop/internal/settingswindow/plugin_settings_visual_test.go" ] }, "windows": { @@ -102,11 +107,16 @@ "desktop/internal/workbench/settings_plugin_sources.go", "desktop/internal/settingswindow/source_settings_entries.go", "desktop/internal/settingswindow/source_settings_entries_view.go", - "desktop/internal/settingswindow/source_settings_modules_test.go" + "desktop/internal/settingswindow/source_settings_modules_test.go", + "desktop/internal/workbench/settings_plugin_restart.go", + "desktop/internal/workbench/settings_plugin_restart_test.go", + "desktop/internal/workbench/debug_start.go", + "desktop/internal/workbench/pluginbackends_test.go", + "desktop/internal/settingswindow/plugin_settings_visual_test.go" ] }, "owner": "Plugin Platform", - "verification": "Viva:共享 settings-documents fixture 经真实 Core C ABI 验证类型、作用层、整批拒绝及文档保留;原生来源覆盖权限/元数据、冲突、取消、捕获来源回读、提交后回读失败。Build/Debug 读取实际文件,明确失效路径不能静默回退;Build 全局专属程序不能被项目文件替换。LSP 启动同时传全局/项目设置、初始化选项与 Core 展开的 workspaceConfiguration。真实协议子进程在同一 Core 会话接收更新通知并重新拉取值;保存来源后服务层回读、展开并更新现有会话,损坏来源不推空配置。macOS 有定向测试与真实子进程证据;此前设置动作节点已在 Lithe-dev 通过完整消费者与定向 race;本节点结果按独立报告记录。已安装本地目录独立于商店网络,Core 绑定注册 ID/版本;原生快照拒绝安装替换。七种控件与全局/项目草稿已接线,macOS 无头驱动验证原生文本输入、明确保存回读、冲突保留、重新加载;共享模型验证七种类型及非法整数原文。保存后的即时通知与所属插件模型刷新已接线,旧模型回包不会覆盖待刷新状态,运行任务及无关模型保持。动作原生窗体、重启与完整生效状态、目标平台原生 UI 及正式市场准入尚未验收,宿主仍不声明 settings 2。 动作节点增加:实际按钮确认/取消,草稿不保存;真实提供方函数成功与取消、原进程复用、会话关闭后不可用;拒绝不同工作区/版本/未注册函数,显示版本不可替代私有身份,项目同路径重开不能接受过期动作。 动态页面节点验证 Core 启用过滤、多个贡献者、动作独立页面、搜索保留父节点、作用域/版本通知规则;Viva 验证页面/动作筛选与切页草稿保留;多工作台驱动验证同偏好目录全局通知、同项目通知、项目覆盖隔离、私有身份及旧生命周期拒绝。同一应用进程内通知不代表独立进程实时同步,也不新增多工作台创建入口。 设置列表填满表单标题下的高度、最少 160 像素,窗口放不下时滚动整页而不截断;Viva 无头驱动在最小窗口、800、1000 高度下验证语言页与已安装插件“设置”标签页的列表随窗口等量增长、底部与确定按钮间距不变、最后一项完整显示。 插件语言文件:契约 localization-cases 的 13 个用例经真实 Core 逐条比对 applied/rejected;保存回读保留译文;从已安装包读取前后,文件清单与字节不变;Viva 无头驱动验证切换界面语言、有草稿时不重读、确认弹窗用译后的按钮标题;读不了或被拒绝的语言文件各记一条 WARN。 模块结构节点:Core settings-sources-modules fixture 经真实 C ABI 读取;Viva 无头驱动验证模块侧栏按父子缩进且只显示所选模块、标签页只显示本组字段、浏览不产生草稿;排序、勾选导出、从候选项对话框添加后保存,Core 规划的写入按顺序且去掉显示文字;全部移除为显式空列表,插件给出继承值时才提供重置;只读模块无编辑控件且条目不可选。自动化:TestSourceModuleListShowsTheSelectedModuleOneTabAtATime、TestSourceEntryListEditsReachThePluginWithoutDisplayText、TestSourceEntryListRemovesToAnExplicitEmptyListAndResets、TestReadOnlyModuleShowsEntriesWithoutEditing、TestEntryDraftsCompareWithoutDisplayTextAndSkipDuplicatePaths;截图 TestVisualModuleStructureForm(中英、深浅主题)。原生文件/目录选择器只在实机验收,Windows 实机未执行。", + "verification": "Viva:共享 settings-documents fixture 经真实 Core C ABI 验证类型、作用层、整批拒绝及文档保留;原生来源覆盖权限/元数据、冲突、取消、捕获来源回读、提交后回读失败。Build/Debug 读取实际文件,明确失效路径不能静默回退;Build 全局专属程序不能被项目文件替换。LSP 启动同时传全局/项目设置、初始化选项与 Core 展开的 workspaceConfiguration。真实协议子进程在同一 Core 会话接收更新通知并重新拉取值;保存来源后服务层回读、展开并更新现有会话,损坏来源不推空配置。macOS 有定向测试与真实子进程证据;此前设置动作节点已在 Lithe-dev 通过完整消费者与定向 race;本节点结果按独立报告记录。已安装本地目录独立于商店网络,Core 绑定注册 ID/版本;原生快照拒绝安装替换。七种控件与全局/项目草稿已接线,macOS 无头驱动验证原生文本输入、明确保存回读、冲突保留、重新加载;共享模型验证七种类型及非法整数原文。保存后的即时通知与所属插件模型刷新已接线,旧模型回包不会覆盖待刷新状态,运行任务及无关模型保持。动作原生窗体、重启与完整生效状态、目标平台原生 UI 及正式市场准入尚未验收,宿主仍不声明 settings 2。 动作节点增加:实际按钮确认/取消,草稿不保存;真实提供方函数成功与取消、原进程复用、会话关闭后不可用;拒绝不同工作区/版本/未注册函数,显示版本不可替代私有身份,项目同路径重开不能接受过期动作。 动态页面节点验证 Core 启用过滤、多个贡献者、动作独立页面、搜索保留父节点、作用域/版本通知规则;Viva 验证页面/动作筛选与切页草稿保留;多工作台驱动验证同偏好目录全局通知、同项目通知、项目覆盖隔离、私有身份及旧生命周期拒绝。同一应用进程内通知不代表独立进程实时同步,也不新增多工作台创建入口。 设置列表填满表单标题下的高度、最少 160 像素,窗口放不下时滚动整页而不截断;Viva 无头驱动在最小窗口、800、1000 高度下验证语言页与已安装插件“设置”标签页的列表随窗口等量增长、底部与确定按钮间距不变、最后一项完整显示。 插件语言文件:契约 localization-cases 的 13 个用例经真实 Core 逐条比对 applied/rejected;保存回读保留译文;从已安装包读取前后,文件清单与字节不变;Viva 无头驱动验证切换界面语言、有草稿时不重读、确认弹窗用译后的按钮标题;读不了或被拒绝的语言文件各记一条 WARN。 模块结构节点:Core settings-sources-modules fixture 经真实 C ABI 读取;Viva 无头驱动验证模块侧栏按父子缩进且只显示所选模块、标签页只显示本组字段、浏览不产生草稿;排序、勾选导出、从候选项对话框添加后保存,Core 规划的写入按顺序且去掉显示文字;全部移除为显式空列表,插件给出继承值时才提供重置;只读模块无编辑控件且条目不可选。自动化:TestSourceModuleListShowsTheSelectedModuleOneTabAtATime、TestSourceEntryListEditsReachThePluginWithoutDisplayText、TestSourceEntryListRemovesToAnExplicitEmptyListAndResets、TestReadOnlyModuleShowsEntriesWithoutEditing、TestEntryDraftsCompareWithoutDisplayTextAndSkipDuplicatePaths;截图 TestVisualModuleStructureForm(中英、深浅主题)。原生文件/目录选择器只在实机验收,Windows 实机未执行。 #2079 修复:动作依赖的语言服务器未运行时返回携带失败详情的 ErrNoSession,设置页显示提供方未运行指引与原始启动失败原因;保存 restart 效果设置对失败态语言服务器同样展示可点击的重启按钮;工具链保存后的自动重试保留已通知错误去重。macOS 自动化与 -race 验证通过:TestRetryFailedPluginServersPreservesNotifiedErrorDeduplication、TestWaitReadyPluginServerWrapsErrNoSession、TestPluginSettingsRestartEffectMarksFailedServerRetryable、TestSettingsActionUnavailableShowsProviderReasonAndRestartForFailedServer 及截图 TestVisualPluginSettingsUnavailableAction;Windows 原生窗口未在本机实机验收。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": {