diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-04-19 10:09:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-19 10:09:39 +0200 |
commit | caaee30179cf8e3d20ad103b898e4bad9ebf648b (patch) | |
tree | 6348896d80031befd553d71340e99c02f8f0d078 /zellij-utils | |
parent | 26fcf8470295f0ce37f70d0f7bdd557296f88539 (diff) |
feat(plugins): reload plugin at runtime (#2372)
* fix(plugins): proper error when wasm file does not exist
* reload working
* race condition handling
* refactor(plugins): start plugin
* refactor(plugins): plugin-loader
* refactor(plugins): load/reload plugin
* refactor(plugins): apply cached events
* fix(plugins): gittery loading
* chore(plugins): rename reload-plugin to start-or-reload-plugin
* chore(styling): small cleanups
* style(fmt): rustfmt
* style(fmt): cleanups
* style(fmt): cleanups
* test(e2e): update snapshots
* test(e2e): update snapshots
* chore(repo): comment plugin optimization because it doubles the CI time
Diffstat (limited to 'zellij-utils')
-rwxr-xr-x[-rw-r--r--] | zellij-utils/assets/compact-bar.wasm | bin | 397489 -> 488843 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/compact-bar.wasm | bin | 488843 -> 794980 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/status-bar.wasm | bin | 621120 -> 921339 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/strider.wasm | bin | 502993 -> 809895 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/tab-bar.wasm | bin | 459471 -> 765705 bytes | |||
-rwxr-xr-x[-rw-r--r--] | zellij-utils/assets/status-bar.wasm | bin | 485616 -> 621120 bytes | |||
-rwxr-xr-x[-rw-r--r--] | zellij-utils/assets/strider.wasm | bin | 413509 -> 502993 bytes | |||
-rwxr-xr-x[-rw-r--r--] | zellij-utils/assets/tab-bar.wasm | bin | 373679 -> 459471 bytes | |||
-rw-r--r-- | zellij-utils/src/cli.rs | 4 | ||||
-rw-r--r-- | zellij-utils/src/errors.rs | 7 | ||||
-rw-r--r-- | zellij-utils/src/input/actions.rs | 3 | ||||
-rw-r--r-- | zellij-utils/src/input/layout.rs | 2 |
12 files changed, 15 insertions, 1 deletions
diff --git a/zellij-utils/assets/compact-bar.wasm b/zellij-utils/assets/compact-bar.wasm Binary files differindex 46267f5e7..00d14d0ea 100644..100755 --- a/zellij-utils/assets/compact-bar.wasm +++ b/zellij-utils/assets/compact-bar.wasm diff --git a/zellij-utils/assets/plugins/compact-bar.wasm b/zellij-utils/assets/plugins/compact-bar.wasm Binary files differindex 00d14d0ea..0e3598d0b 100755 --- a/zellij-utils/assets/plugins/compact-bar.wasm +++ b/zellij-utils/assets/plugins/compact-bar.wasm diff --git a/zellij-utils/assets/plugins/status-bar.wasm b/zellij-utils/assets/plugins/status-bar.wasm Binary files differindex 66e6b10d4..a1d0c8179 100755 --- a/zellij-utils/assets/plugins/status-bar.wasm +++ b/zellij-utils/assets/plugins/status-bar.wasm diff --git a/zellij-utils/assets/plugins/strider.wasm b/zellij-utils/assets/plugins/strider.wasm Binary files differindex 287385a54..37da81bcc 100755 --- a/zellij-utils/assets/plugins/strider.wasm +++ b/zellij-utils/assets/plugins/strider.wasm diff --git a/zellij-utils/assets/plugins/tab-bar.wasm b/zellij-utils/assets/plugins/tab-bar.wasm Binary files differindex b22bcf103..38f17dfc1 100755 --- a/zellij-utils/assets/plugins/tab-bar.wasm +++ b/zellij-utils/assets/plugins/tab-bar.wasm diff --git a/zellij-utils/assets/status-bar.wasm b/zellij-utils/assets/status-bar.wasm Binary files differindex 5b4f6eb06..66e6b10d4 100644..100755 --- a/zellij-utils/assets/status-bar.wasm +++ b/zellij-utils/assets/status-bar.wasm diff --git a/zellij-utils/assets/strider.wasm b/zellij-utils/assets/strider.wasm Binary files differindex 0af68b2f2..287385a54 100644..100755 --- a/zellij-utils/assets/strider.wasm +++ b/zellij-utils/assets/strider.wasm diff --git a/zellij-utils/assets/tab-bar.wasm b/zellij-utils/assets/tab-bar.wasm Binary files differindex 1166de83c..b22bcf103 100644..100755 --- a/zellij-utils/assets/tab-bar.wasm +++ b/zellij-utils/assets/tab-bar.wasm diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs index aa8a27ea3..14bcfae7a 100644 --- a/zellij-utils/src/cli.rs +++ b/zellij-utils/src/cli.rs @@ -7,6 +7,7 @@ use crate::{ use clap::{Parser, Subcommand}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; +use url::Url; #[derive(Parser, Default, Debug, Clone, Serialize, Deserialize)] #[clap(version, name = "zellij")] @@ -373,4 +374,7 @@ pub enum CliAction { NextSwapLayout, /// Query all tab names QueryTabNames, + StartOrReloadPlugin { + url: Url, + }, } diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs index e23c22bb0..8b49112b9 100644 --- a/zellij-utils/src/errors.rs +++ b/zellij-utils/src/errors.rs @@ -326,10 +326,13 @@ pub enum ScreenContext { NextSwapLayout, QueryTabNames, NewTiledPluginPane, + StartOrReloadPluginPane, NewFloatingPluginPane, AddPlugin, UpdatePluginLoadingStage, ProgressPluginLoadingOffset, + StartPluginLoadingIndication, + RequestStateUpdateForPlugins, } /// Stack call representations corresponding to the different types of [`PtyInstruction`]s. @@ -355,6 +358,7 @@ pub enum PluginContext { Update, Render, Unload, + Reload, Resize, Exit, AddClient, @@ -489,6 +493,9 @@ open an issue on GitHub: #[error("Client {client_id} is too slow to handle incoming messages")] ClientTooSlow { client_id: u16 }, + + #[error("The plugin does not exist")] + PluginDoesNotExist, } #[cfg(not(target_family = "wasm"))] diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index d03fd1202..c288b8d2b 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; use std::path::PathBuf; use std::str::FromStr; +use url::Url; use crate::position::Position; @@ -231,6 +232,7 @@ pub enum Action { /// Open a new tiled (embedded, non-floating) plugin pane NewTiledPluginPane(RunPluginLocation, Option<String>), // String is an optional name NewFloatingPluginPane(RunPluginLocation, Option<String>), // String is an optional name + StartOrReloadPlugin(Url), } impl Action { @@ -471,6 +473,7 @@ impl Action { CliAction::PreviousSwapLayout => Ok(vec![Action::PreviousSwapLayout]), CliAction::NextSwapLayout => Ok(vec![Action::NextSwapLayout]), CliAction::QueryTabNames => Ok(vec![Action::QueryTabNames]), + CliAction::StartOrReloadPlugin { url } => Ok(vec![Action::StartOrReloadPlugin(url)]), } } } diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 830f7c028..713b2775a 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -207,7 +207,7 @@ impl Run { } } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] pub struct RunPlugin { #[serde(default)] pub _allow_exec_host_cmd: bool, |