Manage plugin enabled state

This commit is contained in:
2026-05-07 23:18:49 -04:00
parent 36aefc929c
commit 8ec468f57e
2 changed files with 69 additions and 6 deletions
+23 -1
View File
@@ -1,6 +1,6 @@
use std::path::PathBuf;
use ely_domain::{PluginManifest, PluginPermission};
use ely_domain::{PluginId, PluginManifest, PluginPermission};
use gpui::{Context, PathPromptOptions, Window};
use crate::services::{
@@ -86,6 +86,28 @@ impl ElyShell {
cx.notify();
}
pub(super) fn set_plugin_enabled(
&mut self,
plugin_id: PluginId,
enabled: bool,
cx: &mut Context<Self>,
) {
let result = match &mut self.state {
ShellState::Ready(core) => {
let action = if enabled {
core.enable_plugin(&plugin_id)
} else {
core.disable_plugin(&plugin_id)
};
action.map_err(|error| error.to_string())
}
ShellState::StartupError(message) => Err(message.clone()),
};
self.plugin_install_error = result.err();
cx.notify();
}
fn handle_plugin_package_result(
&mut self,
result: Result<VerifiedPluginPackage, PluginPackageError>,