From b0f36540fe3cb439fd0981cbb1ef5df6668ddbdf Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 30 Nov 2023 18:10:50 +0100 Subject: [PATCH] feat(plugins): skip plugin cache flag (#2971) * feat(plugins): allow explicitly skipping the plugin cache when loading * style(fmt): rustfmt * fix tests --- default-plugins/status-bar/src/second_line.rs | 2 +- src/main.rs | 4 + zellij-server/src/plugins/mod.rs | 19 +++- zellij-server/src/plugins/plugin_loader.rs | 65 ++++++++----- .../src/plugins/unit/plugin_tests.rs | 70 ++++++++++++++ zellij-server/src/plugins/wasm_bridge.rs | 2 + zellij-server/src/pty.rs | 5 + zellij-server/src/route.rs | 17 ++-- zellij-server/src/screen.rs | 92 +++++++++++-------- zellij-server/src/unit/screen_tests.rs | 5 + ...end_cli_launch_or_focus_plugin_action.snap | 3 +- zellij-utils/assets/prost/api.action.rs | 4 + zellij-utils/src/cli.rs | 10 ++ zellij-utils/src/input/actions.rs | 46 +++++++--- zellij-utils/src/kdl/mod.rs | 8 ++ zellij-utils/src/plugin_api/action.proto | 2 + zellij-utils/src/plugin_api/action.rs | 34 ++++++- ..._default_config_with_no_cli_arguments.snap | 1 + ...out_env_vars_override_config_env_vars.snap | 1 + ...ayout_plugins_override_config_plugins.snap | 1 + ..._layout_themes_override_config_themes.snap | 1 + ..._ui_config_overrides_config_ui_config.snap | 1 + 22 files changed, 308 insertions(+), 85 deletions(-) diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index d33ddad8..53fbc6ec 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -245,7 +245,7 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec)> { action_key(&km, &[A::SearchToggleOption(SOpt::WholeWord)])), ]} else if mi.mode == IM::Session { vec![ (s("Detach"), s("Detach"), action_key(&km, &[Action::Detach])), - (s("Session Manager"), s("Manager"), action_key(&km, &[A::LaunchOrFocusPlugin(Default::default(), true, true, false), TO_NORMAL])), // not entirely accurate + (s("Session Manager"), s("Manager"), action_key(&km, &[A::LaunchOrFocusPlugin(Default::default(), true, true, false, false), TO_NORMAL])), // not entirely accurate (s("Select pane"), s("Select"), to_normal_key), ]} else if mi.mode == IM::Tmux { vec![ (s("Move focus"), s("Move"), action_key_group(&km, &[ diff --git a/src/main.rs b/src/main.rs index 72dce0d2..955a982b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,6 +31,7 @@ fn main() { start_suspended, })) = opts.command { + let skip_plugin_cache = false; // N/A for this action let command_cli_action = CliAction::NewPane { command, plugin: None, @@ -42,6 +43,7 @@ fn main() { close_on_exit, start_suspended, configuration: None, + skip_plugin_cache, }; commands::send_action_to_session(command_cli_action, opts.session, config); std::process::exit(0); @@ -51,6 +53,7 @@ fn main() { floating, in_place, configuration, + skip_plugin_cache, })) = opts.command { let command_cli_action = CliAction::NewPane { @@ -64,6 +67,7 @@ fn main() { close_on_exit: false, start_suspended: false, configuration, + skip_plugin_cache, }; commands::send_action_to_session(command_cli_action, opts.session, config); std::process::exit(0); diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 2086268d..9dbacd5c 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -51,6 +51,7 @@ pub enum PluginInstruction { ClientId, Size, Option, // cwd + bool, // skip cache ), Update(Vec<(Option, Option, Event)>), // Focused plugin / broadcast, client_id, event data Unload(PluginId), // plugin_id @@ -184,8 +185,15 @@ pub(crate) fn plugin_thread_main( client_id, size, cwd, - ) => match wasm_bridge.load_plugin(&run, tab_index, size, cwd.clone(), Some(client_id)) - { + skip_cache, + ) => match wasm_bridge.load_plugin( + &run, + tab_index, + size, + cwd.clone(), + skip_cache, + Some(client_id), + ) { Ok(plugin_id) => { drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin( should_float, @@ -221,7 +229,10 @@ pub(crate) fn plugin_thread_main( log::warn!("Plugin {} not found, starting it instead", run.location); // we intentionally do not provide the client_id here because it belongs to // the cli who spawned the command and is not an existing client_id - match wasm_bridge.load_plugin(&run, tab_index, size, None, None) { + let skip_cache = true; // when reloading we always skip cache + match wasm_bridge + .load_plugin(&run, tab_index, size, None, skip_cache, None) + { Ok(plugin_id) => { let should_be_open_in_place = false; drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin( @@ -286,11 +297,13 @@ pub(crate) fn plugin_thread_main( extracted_run_instructions.append(&mut extracted_floating_plugins); for run_instruction in extracted_run_instructions { if let Some(Run::Plugin(run)) = run_instruction { + let skip_cache = false; let plugin_id = wasm_bridge.load_plugin( &run, tab_index, size, None, + skip_cache, Some(client_id), )?; plugin_ids diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 39cb4362..1f001db1 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -148,6 +148,7 @@ impl<'a> PluginLoader<'a> { client_attributes: ClientAttributes, default_shell: Option, default_layout: Box, + skip_cache: bool, ) -> Result<()> { let err_context = || format!("failed to start plugin {plugin_id} for client {client_id}"); let mut plugin_loader = PluginLoader::new( @@ -168,27 +169,49 @@ impl<'a> PluginLoader<'a> { default_shell, default_layout, )?; - plugin_loader - .load_module_from_memory() - .or_else(|_e| plugin_loader.load_module_from_hd_cache()) - .or_else(|_e| plugin_loader.compile_module()) - .and_then(|module| plugin_loader.create_plugin_environment(module)) - .and_then(|(store, instance, plugin_env, subscriptions)| { - plugin_loader.load_plugin_instance( - store, - &instance, - &plugin_env, - &plugin_map, - &subscriptions, - ) - }) - .and_then(|_| { - plugin_loader.clone_instance_for_other_clients( - &connected_clients.lock().unwrap(), - &plugin_map, - ) - }) - .with_context(err_context)?; + if skip_cache { + plugin_loader + .compile_module() + .and_then(|module| plugin_loader.create_plugin_environment(module)) + .and_then(|(store, instance, plugin_env, subscriptions)| { + plugin_loader.load_plugin_instance( + store, + &instance, + &plugin_env, + &plugin_map, + &subscriptions, + ) + }) + .and_then(|_| { + plugin_loader.clone_instance_for_other_clients( + &connected_clients.lock().unwrap(), + &plugin_map, + ) + }) + .with_context(err_context)?; + } else { + plugin_loader + .load_module_from_memory() + .or_else(|_e| plugin_loader.load_module_from_hd_cache()) + .or_else(|_e| plugin_loader.compile_module()) + .and_then(|module| plugin_loader.create_plugin_environment(module)) + .and_then(|(store, instance, plugin_env, subscriptions)| { + plugin_loader.load_plugin_instance( + store, + &instance, + &plugin_env, + &plugin_map, + &subscriptions, + ) + }) + .and_then(|_| { + plugin_loader.clone_instance_for_other_clients( + &connected_clients.lock().unwrap(), + &plugin_map, + ) + }) + .with_context(err_context)?; + }; display_loading_stage!(end, loading_indication, senders, plugin_id); Ok(()) } diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index 08ac5b83..ca843358 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -617,6 +617,7 @@ pub fn load_new_plugin_from_hd() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -688,6 +689,7 @@ pub fn plugin_workers() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); // we send a SystemClipboardFailure to trigger the custom handler in the fixture plugin that @@ -763,6 +765,7 @@ pub fn plugin_workers_persist_state() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); // we send a SystemClipboardFailure to trigger the custom handler in the fixture plugin that @@ -842,6 +845,7 @@ pub fn can_subscribe_to_hd_events() { client_id, size, None, + false, )); // extra long time because we only start the fs watcher on plugin load std::thread::sleep(std::time::Duration::from_millis(5000)); @@ -915,6 +919,7 @@ pub fn switch_to_mode_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -985,6 +990,7 @@ pub fn switch_to_mode_plugin_command_permission_denied() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1055,6 +1061,7 @@ pub fn new_tabs_with_layout_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1139,6 +1146,7 @@ pub fn new_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1209,6 +1217,7 @@ pub fn go_to_next_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1278,6 +1287,7 @@ pub fn go_to_previous_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1347,6 +1357,7 @@ pub fn resize_focused_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1416,6 +1427,7 @@ pub fn resize_focused_pane_with_direction_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1485,6 +1497,7 @@ pub fn focus_next_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1554,6 +1567,7 @@ pub fn focus_previous_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1623,6 +1637,7 @@ pub fn move_focus_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1692,6 +1707,7 @@ pub fn move_focus_or_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1761,6 +1777,7 @@ pub fn edit_scrollback_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1830,6 +1847,7 @@ pub fn write_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1899,6 +1917,7 @@ pub fn write_chars_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -1968,6 +1987,7 @@ pub fn toggle_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2037,6 +2057,7 @@ pub fn move_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2106,6 +2127,7 @@ pub fn move_pane_with_direction_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2176,6 +2198,7 @@ pub fn clear_screen_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2246,6 +2269,7 @@ pub fn scroll_up_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2315,6 +2339,7 @@ pub fn scroll_down_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2384,6 +2409,7 @@ pub fn scroll_to_top_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2453,6 +2479,7 @@ pub fn scroll_to_bottom_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2522,6 +2549,7 @@ pub fn page_scroll_up_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2591,6 +2619,7 @@ pub fn page_scroll_down_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2660,6 +2689,7 @@ pub fn toggle_focus_fullscreen_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2729,6 +2759,7 @@ pub fn toggle_pane_frames_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2798,6 +2829,7 @@ pub fn toggle_pane_embed_or_eject_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2867,6 +2899,7 @@ pub fn undo_rename_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -2936,6 +2969,7 @@ pub fn close_focus_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3005,6 +3039,7 @@ pub fn toggle_active_tab_sync_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3074,6 +3109,7 @@ pub fn close_focused_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3143,6 +3179,7 @@ pub fn undo_rename_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3212,6 +3249,7 @@ pub fn previous_swap_layout_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3281,6 +3319,7 @@ pub fn next_swap_layout_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3350,6 +3389,7 @@ pub fn go_to_tab_name_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3419,6 +3459,7 @@ pub fn focus_or_create_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3488,6 +3529,7 @@ pub fn go_to_tab() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3557,6 +3599,7 @@ pub fn start_or_reload_plugin() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3633,6 +3676,7 @@ pub fn quit_zellij_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3709,6 +3753,7 @@ pub fn detach_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3785,6 +3830,7 @@ pub fn open_file_floating_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3861,6 +3907,7 @@ pub fn open_file_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -3938,6 +3985,7 @@ pub fn open_file_with_line_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4014,6 +4062,7 @@ pub fn open_file_with_line_floating_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4090,6 +4139,7 @@ pub fn open_terminal_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4166,6 +4216,7 @@ pub fn open_terminal_floating_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4242,6 +4293,7 @@ pub fn open_command_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4318,6 +4370,7 @@ pub fn open_command_pane_floating_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4387,6 +4440,7 @@ pub fn switch_to_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4451,6 +4505,7 @@ pub fn hide_self_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4515,6 +4570,7 @@ pub fn show_self_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4584,6 +4640,7 @@ pub fn close_terminal_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4653,6 +4710,7 @@ pub fn close_plugin_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4722,6 +4780,7 @@ pub fn focus_terminal_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4791,6 +4850,7 @@ pub fn focus_plugin_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4860,6 +4920,7 @@ pub fn rename_terminal_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4929,6 +4990,7 @@ pub fn rename_plugin_pane_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -4998,6 +5060,7 @@ pub fn rename_tab_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5076,6 +5139,7 @@ pub fn send_configuration_to_plugins() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5142,6 +5206,7 @@ pub fn request_plugin_permissions() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5232,6 +5297,7 @@ pub fn granted_permission_request_result() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5321,6 +5387,7 @@ pub fn denied_permission_request_result() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5389,6 +5456,7 @@ pub fn run_command_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5465,6 +5533,7 @@ pub fn run_command_with_env_vars_and_cwd_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( @@ -5541,6 +5610,7 @@ pub fn web_request_plugin_command() { client_id, size, None, + false, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index bb58d611..b89cc73b 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -114,6 +114,7 @@ impl WasmBridge { tab_index: usize, size: Size, cwd: Option, + skip_cache: bool, client_id: Option, ) -> Result { // returns the plugin id @@ -209,6 +210,7 @@ impl WasmBridge { client_attributes, default_shell, default_layout, + skip_cache, ) { Ok(_) => handle_plugin_successful_loading(&senders, plugin_id), Err(e) => handle_plugin_loading_failure( diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 43cabba0..54fea251 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -88,6 +88,7 @@ pub enum PtyInstruction { Option, // pane id to replace if this is to be opened "in-place" ClientId, Size, + bool, // skip cache ), Exit, } @@ -653,6 +654,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { pane_id_to_replace, client_id, size, + skip_cache, ) => { pty.fill_plugin_cwd( should_float, @@ -663,6 +665,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { pane_id_to_replace, client_id, size, + skip_cache, )?; }, PtyInstruction::Exit => break, @@ -1328,6 +1331,7 @@ impl Pty { pane_id_to_replace: Option, // pane id to replace if this is to be opened "in-place" client_id: ClientId, size: Size, + skip_cache: bool, ) -> Result<()> { let cwd = self .active_panes @@ -1353,6 +1357,7 @@ impl Pty { client_id, size, cwd, + skip_cache, ))?; Ok(()) } diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 8c9da6b5..17fcc3de 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -658,25 +658,25 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::QueryTabNames(client_id)) .with_context(err_context)?; }, - Action::NewTiledPluginPane(run_plugin, name) => { + Action::NewTiledPluginPane(run_plugin, name, skip_cache) => { senders .send_to_screen(ScreenInstruction::NewTiledPluginPane( - run_plugin, name, client_id, + run_plugin, name, skip_cache, client_id, )) .with_context(err_context)?; }, - Action::NewFloatingPluginPane(run_plugin, name) => { + Action::NewFloatingPluginPane(run_plugin, name, skip_cache) => { senders .send_to_screen(ScreenInstruction::NewFloatingPluginPane( - run_plugin, name, client_id, + run_plugin, name, skip_cache, client_id, )) .with_context(err_context)?; }, - Action::NewInPlacePluginPane(run_plugin, name) => { + Action::NewInPlacePluginPane(run_plugin, name, skip_cache) => { if let Some(pane_id) = pane_id { senders .send_to_screen(ScreenInstruction::NewInPlacePluginPane( - run_plugin, name, pane_id, client_id, + run_plugin, name, pane_id, skip_cache, client_id, )) .with_context(err_context)?; } else { @@ -693,6 +693,7 @@ pub(crate) fn route_action( should_float, move_to_focused_tab, should_open_in_place, + skip_cache, ) => { senders .send_to_screen(ScreenInstruction::LaunchOrFocusPlugin( @@ -701,17 +702,19 @@ pub(crate) fn route_action( move_to_focused_tab, should_open_in_place, pane_id, + skip_cache, client_id, )) .with_context(err_context)?; }, - Action::LaunchPlugin(run_plugin, should_float, should_open_in_place) => { + Action::LaunchPlugin(run_plugin, should_float, should_open_in_place, skip_cache) => { senders .send_to_screen(ScreenInstruction::LaunchPlugin( run_plugin, should_float, should_open_in_place, pane_id, + skip_cache, client_id, )) .with_context(err_context)?; diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 902351c5..409a1854 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -272,11 +272,13 @@ pub enum ScreenInstruction { PreviousSwapLayout(ClientId), NextSwapLayout(ClientId), QueryTabNames(ClientId), - NewTiledPluginPane(RunPlugin, Option, ClientId), // Option is - // optional pane title - NewFloatingPluginPane(RunPlugin, Option, ClientId), // Option is an - NewInPlacePluginPane(RunPlugin, Option, PaneId, ClientId), // Option is an - // optional pane title + NewTiledPluginPane(RunPlugin, Option, bool, ClientId), // Option is + // optional pane title, bool is skip cache + NewFloatingPluginPane(RunPlugin, Option, bool, ClientId), // Option is an + // optional pane title, bool + // is skip cache + NewInPlacePluginPane(RunPlugin, Option, PaneId, bool, ClientId), // Option is an + // optional pane title, bool is skip cache StartOrReloadPluginPane(RunPlugin, Option), AddPlugin( Option, // should_float @@ -293,10 +295,10 @@ pub enum ScreenInstruction { StartPluginLoadingIndication(u32, LoadingIndication), // u32 - plugin_id ProgressPluginLoadingOffset(u32), // u32 - plugin id RequestStateUpdateForPlugins, - LaunchOrFocusPlugin(RunPlugin, bool, bool, bool, Option, ClientId), // bools are: should_float, move_to_focused_tab, should_open_in_place Option is the pane id to replace - LaunchPlugin(RunPlugin, bool, bool, Option, ClientId), // bools are: should_float, should_open_in_place Option is the pane id to replace - SuppressPane(PaneId, ClientId), // bool is should_float - FocusPaneWithId(PaneId, bool, ClientId), // bool is should_float + LaunchOrFocusPlugin(RunPlugin, bool, bool, bool, Option, bool, ClientId), // bools are: should_float, move_to_focused_tab, should_open_in_place, Option is the pane id to replace, bool following it is skip_cache + LaunchPlugin(RunPlugin, bool, bool, Option, bool, ClientId), // bools are: should_float, should_open_in_place Option is the pane id to replace, bool after is skip_cache + SuppressPane(PaneId, ClientId), // bool is should_float + FocusPaneWithId(PaneId, bool, ClientId), // bool is should_float RenamePane(PaneId, Vec), RenameTab(usize, Vec), RequestPluginPermissions( @@ -3145,7 +3147,12 @@ pub(crate) fn screen_thread_main( .senders .send_to_server(ServerInstruction::Log(tab_names, client_id))?; }, - ScreenInstruction::NewTiledPluginPane(run_plugin, pane_title, client_id) => { + ScreenInstruction::NewTiledPluginPane( + run_plugin, + pane_title, + skip_cache, + client_id, + ) => { let tab_index = screen.active_tab_indices.values().next().unwrap_or(&1); let size = Size::default(); let should_float = Some(false); @@ -3162,39 +3169,45 @@ pub(crate) fn screen_thread_main( None, client_id, size, + skip_cache, ))?; }, - ScreenInstruction::NewFloatingPluginPane(run_plugin, pane_title, client_id) => { - match screen.active_tab_indices.values().next() { - Some(tab_index) => { - let size = Size::default(); - let should_float = Some(true); - let should_be_opened_in_place = false; - screen - .bus - .senders - .send_to_pty(PtyInstruction::FillPluginCwd( - should_float, - should_be_opened_in_place, - pane_title, - run_plugin, - *tab_index, - None, - client_id, - size, - ))?; - }, - None => { - log::error!( - "Could not find an active tab - is there at least 1 connected user?" - ); - }, - } + ScreenInstruction::NewFloatingPluginPane( + run_plugin, + pane_title, + skip_cache, + client_id, + ) => match screen.active_tab_indices.values().next() { + Some(tab_index) => { + let size = Size::default(); + let should_float = Some(true); + let should_be_opened_in_place = false; + screen + .bus + .senders + .send_to_pty(PtyInstruction::FillPluginCwd( + should_float, + should_be_opened_in_place, + pane_title, + run_plugin, + *tab_index, + None, + client_id, + size, + skip_cache, + ))?; + }, + None => { + log::error!( + "Could not find an active tab - is there at least 1 connected user?" + ); + }, }, ScreenInstruction::NewInPlacePluginPane( run_plugin, pane_title, pane_id_to_replace, + skip_cache, client_id, ) => match screen.active_tab_indices.values().next() { Some(tab_index) => { @@ -3213,6 +3226,7 @@ pub(crate) fn screen_thread_main( Some(pane_id_to_replace), client_id, size, + skip_cache, ))?; }, None => { @@ -3340,6 +3354,7 @@ pub(crate) fn screen_thread_main( move_to_focused_tab, should_open_in_place, pane_id_to_replace, + skip_cache, client_id, ) => match pane_id_to_replace { Some(pane_id_to_replace) => match screen.active_tab_indices.values().next() { @@ -3357,6 +3372,7 @@ pub(crate) fn screen_thread_main( Some(pane_id_to_replace), client_id, size, + skip_cache, ))?; }, None => { @@ -3400,6 +3416,7 @@ pub(crate) fn screen_thread_main( None, client_id, Size::default(), + skip_cache, ))?; } }, @@ -3414,6 +3431,7 @@ pub(crate) fn screen_thread_main( should_float, should_open_in_place, pane_id_to_replace, + skip_cache, client_id, ) => match pane_id_to_replace { Some(pane_id_to_replace) => match screen.active_tab_indices.values().next() { @@ -3431,6 +3449,7 @@ pub(crate) fn screen_thread_main( Some(pane_id_to_replace), client_id, size, + skip_cache, ))?; }, None => { @@ -3465,6 +3484,7 @@ pub(crate) fn screen_thread_main( None, client_id, Size::default(), + skip_cache, ))?; }, None => { diff --git a/zellij-server/src/unit/screen_tests.rs b/zellij-server/src/unit/screen_tests.rs index f0ed8452..6296d60d 100644 --- a/zellij-server/src/unit/screen_tests.rs +++ b/zellij-server/src/unit/screen_tests.rs @@ -1892,6 +1892,7 @@ pub fn send_cli_new_pane_action_with_default_parameters() { close_on_exit: false, start_suspended: false, configuration: None, + skip_plugin_cache: false, }; send_cli_action_to_server(&session_metadata, cli_new_pane_action, client_id); std::thread::sleep(std::time::Duration::from_millis(100)); // give time for actions to be @@ -1930,6 +1931,7 @@ pub fn send_cli_new_pane_action_with_split_direction() { close_on_exit: false, start_suspended: false, configuration: None, + skip_plugin_cache: false, }; send_cli_action_to_server(&session_metadata, cli_new_pane_action, client_id); std::thread::sleep(std::time::Duration::from_millis(100)); // give time for actions to be @@ -1968,6 +1970,7 @@ pub fn send_cli_new_pane_action_with_command_and_cwd() { close_on_exit: false, start_suspended: false, configuration: None, + skip_plugin_cache: false, }; send_cli_action_to_server(&session_metadata, cli_new_pane_action, client_id); std::thread::sleep(std::time::Duration::from_millis(100)); // give time for actions to be @@ -2598,6 +2601,7 @@ pub fn send_cli_launch_or_focus_plugin_action() { move_to_focused_tab: true, url: url::Url::parse("file:/path/to/fake/plugin").unwrap(), configuration: Default::default(), + skip_plugin_cache: false, }; send_cli_action_to_server(&session_metadata, cli_action, client_id); std::thread::sleep(std::time::Duration::from_millis(100)); // give time for actions to be @@ -2657,6 +2661,7 @@ pub fn send_cli_launch_or_focus_plugin_action_when_plugin_is_already_loaded() { move_to_focused_tab: true, url: url::Url::parse("file:/path/to/fake/plugin").unwrap(), configuration: Default::default(), + skip_plugin_cache: false, }; send_cli_action_to_server(&session_metadata, cli_action, client_id); std::thread::sleep(std::time::Duration::from_millis(100)); // give time for actions to be diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap index bfde747e..7ff22158 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/./unit/screen_tests.rs -assertion_line: 2614 +assertion_line: 2620 expression: "format!(\"{:#?}\", pty_fill_plugin_cwd_instruction)" --- Some( @@ -26,5 +26,6 @@ Some( rows: 0, cols: 0, }, + false, ), ) diff --git a/zellij-utils/assets/prost/api.action.rs b/zellij-utils/assets/prost/api.action.rs index 171ae804..908fffa7 100644 --- a/zellij-utils/assets/prost/api.action.rs +++ b/zellij-utils/assets/prost/api.action.rs @@ -129,6 +129,8 @@ pub struct NewPluginPanePayload { pub plugin_url: ::prost::alloc::string::String, #[prost(string, optional, tag = "2")] pub pane_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag = "3")] + pub skip_plugin_cache: bool, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -143,6 +145,8 @@ pub struct LaunchOrFocusPluginPayload { pub move_to_focused_tab: bool, #[prost(bool, tag = "5")] pub should_open_in_place: bool, + #[prost(bool, tag = "6")] + pub skip_plugin_cache: bool, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs index ee402449..97a0cd77 100644 --- a/zellij-utils/src/cli.rs +++ b/zellij-utils/src/cli.rs @@ -242,6 +242,10 @@ pub enum Sessions { conflicts_with("floating") )] in_place: bool, + + /// Skip the memory and HD cache and force recompile of the plugin (good for development) + #[clap(short, long, value_parser, default_value("false"), takes_value(false))] + skip_plugin_cache: bool, }, /// Edit file with default $EDITOR / $VISUAL #[clap(visible_alias = "e")] @@ -417,6 +421,8 @@ pub enum CliAction { start_suspended: bool, #[clap(long, value_parser)] configuration: Option, + #[clap(short, long, value_parser)] + skip_plugin_cache: bool, }, /// Open the specified file in a new zellij pane with your default EDITOR Edit { @@ -526,6 +532,8 @@ pub enum CliAction { url: Url, #[clap(short, long, value_parser)] configuration: Option, + #[clap(short, long, value_parser)] + skip_plugin_cache: bool, }, LaunchPlugin { #[clap(short, long, value_parser)] @@ -535,6 +543,8 @@ pub enum CliAction { url: Url, #[clap(short, long, value_parser)] configuration: Option, + #[clap(short, long, value_parser)] + skip_plugin_cache: bool, }, RenameSession { name: String, diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index 8fe0a328..8af5d28e 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -209,10 +209,10 @@ pub enum Action { LeftClick(Position), RightClick(Position), MiddleClick(Position), - LaunchOrFocusPlugin(RunPlugin, bool, bool, bool), // bools => should float, - // move_to_focused_tab, should_open_in_place - LaunchPlugin(RunPlugin, bool, bool), // bools => should float, - // should_open_in_place + LaunchOrFocusPlugin(RunPlugin, bool, bool, bool, bool), // bools => should float, + // move_to_focused_tab, should_open_in_place, skip_cache + LaunchPlugin(RunPlugin, bool, bool, bool), // bools => should float, + // should_open_in_place, skip_cache LeftMouseRelease(Position), RightMouseRelease(Position), MiddleMouseRelease(Position), @@ -238,9 +238,12 @@ pub enum Action { /// Query all tab names QueryTabNames, /// Open a new tiled (embedded, non-floating) plugin pane - NewTiledPluginPane(RunPlugin, Option), // String is an optional name - NewFloatingPluginPane(RunPlugin, Option), // String is an optional name - NewInPlacePluginPane(RunPlugin, Option), // String is an optional name + NewTiledPluginPane(RunPlugin, Option, bool), // String is an optional name, bool is + // skip_cache + NewFloatingPluginPane(RunPlugin, Option, bool), // String is an optional name, bool is + // skip_cache + NewInPlacePluginPane(RunPlugin, Option, bool), // String is an optional name, bool is + // skip_cache StartOrReloadPlugin(RunPlugin), CloseTerminalPane(u32), ClosePluginPane(u32), @@ -310,6 +313,7 @@ impl Action { close_on_exit, start_suspended, configuration, + skip_plugin_cache, } => { let current_dir = get_current_dir(); let cwd = cwd @@ -325,9 +329,17 @@ impl Action { configuration: user_configuration, }; if floating { - Ok(vec![Action::NewFloatingPluginPane(plugin, name)]) + Ok(vec![Action::NewFloatingPluginPane( + plugin, + name, + skip_plugin_cache, + )]) } else if in_place { - Ok(vec![Action::NewInPlacePluginPane(plugin, name)]) + Ok(vec![Action::NewInPlacePluginPane( + plugin, + name, + skip_plugin_cache, + )]) } else { // it is intentional that a new tiled plugin pane cannot include a // direction @@ -337,7 +349,11 @@ impl Action { // is being loaded // this is not the case with terminal panes for historical reasons of // backwards compatibility to a time before we had auto layouts - Ok(vec![Action::NewTiledPluginPane(plugin, name)]) + Ok(vec![Action::NewTiledPluginPane( + plugin, + name, + skip_plugin_cache, + )]) } } else if !command.is_empty() { let mut command = command.clone(); @@ -525,6 +541,7 @@ impl Action { in_place, move_to_focused_tab, configuration, + skip_plugin_cache, } => { let current_dir = get_current_dir(); let run_plugin_location = RunPluginLocation::parse(url.as_str(), Some(current_dir)) @@ -539,6 +556,7 @@ impl Action { floating, move_to_focused_tab, in_place, + skip_plugin_cache, )]) }, CliAction::LaunchPlugin { @@ -546,6 +564,7 @@ impl Action { floating, in_place, configuration, + skip_plugin_cache, } => { let current_dir = get_current_dir(); let run_plugin_location = RunPluginLocation::parse(url.as_str(), Some(current_dir)) @@ -555,7 +574,12 @@ impl Action { _allow_exec_host_cmd: false, configuration: configuration.unwrap_or_default(), }; - Ok(vec![Action::LaunchPlugin(run_plugin, floating, in_place)]) + Ok(vec![Action::LaunchPlugin( + run_plugin, + floating, + in_place, + skip_plugin_cache, + )]) }, CliAction::RenameSession { name } => Ok(vec![Action::RenameSession(name)]), } diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 8353b6e7..71f48fc4 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -938,6 +938,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action { let should_open_in_place = command_metadata .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "in_place")) .unwrap_or(false); + let skip_plugin_cache = command_metadata + .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "skip_plugin_cache")) + .unwrap_or(false); let current_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); let location = RunPluginLocation::parse(&plugin_path, Some(current_dir))?; let configuration = KdlLayoutParser::parse_plugin_user_configuration(&kdl_action)?; @@ -951,6 +954,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action { should_float, move_to_focused_tab, should_open_in_place, + skip_plugin_cache, )) }, "LaunchPlugin" => { @@ -972,6 +976,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action { let should_open_in_place = command_metadata .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "in_place")) .unwrap_or(false); + let skip_plugin_cache = command_metadata + .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "skip_plugin_cache")) + .unwrap_or(false); let current_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); let location = RunPluginLocation::parse(&plugin_path, Some(current_dir))?; let configuration = KdlLayoutParser::parse_plugin_user_configuration(&kdl_action)?; @@ -984,6 +991,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action { run_plugin, should_float, should_open_in_place, + skip_plugin_cache, )) }, "PreviousSwapLayout" => Ok(Action::PreviousSwapLayout), diff --git a/zellij-utils/src/plugin_api/action.proto b/zellij-utils/src/plugin_api/action.proto index e9d2a293..da10d82a 100644 --- a/zellij-utils/src/plugin_api/action.proto +++ b/zellij-utils/src/plugin_api/action.proto @@ -69,6 +69,7 @@ message PaneIdAndShouldFloat { message NewPluginPanePayload { string plugin_url = 1; optional string pane_name = 2; + bool skip_plugin_cache = 3; } enum SearchDirection { @@ -88,6 +89,7 @@ message LaunchOrFocusPluginPayload { optional PluginConfiguration plugin_configuration = 3; bool move_to_focused_tab = 4; bool should_open_in_place = 5; + bool skip_plugin_cache = 6; } message GoToTabNamePayload { diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs index dc8c2938..71eaaa13 100644 --- a/zellij-utils/src/plugin_api/action.rs +++ b/zellij-utils/src/plugin_api/action.rs @@ -403,11 +403,13 @@ impl TryFrom for Action { let should_float = payload.should_float; let move_to_focused_tab = payload.move_to_focused_tab; let should_open_in_place = payload.should_open_in_place; + let skip_plugin_cache = payload.skip_plugin_cache; Ok(Action::LaunchOrFocusPlugin( run_plugin, should_float, move_to_focused_tab, should_open_in_place, + skip_plugin_cache, )) }, _ => Err("Wrong payload for Action::LaunchOrFocusPlugin"), @@ -431,10 +433,12 @@ impl TryFrom for Action { let _move_to_focused_tab = payload.move_to_focused_tab; // not actually used in // this action let should_open_in_place = payload.should_open_in_place; + let skip_plugin_cache = payload.skip_plugin_cache; Ok(Action::LaunchPlugin( run_plugin, should_float, should_open_in_place, + skip_plugin_cache, )) }, _ => Err("Wrong payload for Action::LaunchOrFocusPlugin"), @@ -539,7 +543,12 @@ impl TryFrom for Action { configuration: PluginUserConfiguration::default(), }; let pane_name = payload.pane_name; - Ok(Action::NewTiledPluginPane(run_plugin, pane_name)) + let skip_plugin_cache = payload.skip_plugin_cache; + Ok(Action::NewTiledPluginPane( + run_plugin, + pane_name, + skip_plugin_cache, + )) }, _ => Err("Wrong payload for Action::NewTiledPluginPane"), } @@ -556,7 +565,12 @@ impl TryFrom for Action { configuration: PluginUserConfiguration::default(), }; let pane_name = payload.pane_name; - Ok(Action::NewFloatingPluginPane(run_plugin, pane_name)) + let skip_plugin_cache = payload.skip_plugin_cache; + Ok(Action::NewFloatingPluginPane( + run_plugin, + pane_name, + skip_plugin_cache, + )) }, _ => Err("Wrong payload for Action::MiddleClick"), } @@ -1007,6 +1021,7 @@ impl TryFrom for ProtobufAction { should_float, move_to_focused_tab, should_open_in_place, + skip_plugin_cache, ) => { let url: Url = Url::from(&run_plugin.location); Ok(ProtobufAction { @@ -1018,11 +1033,17 @@ impl TryFrom for ProtobufAction { move_to_focused_tab, should_open_in_place, plugin_configuration: Some(run_plugin.configuration.try_into()?), + skip_plugin_cache, }, )), }) }, - Action::LaunchPlugin(run_plugin, should_float, should_open_in_place) => { + Action::LaunchPlugin( + run_plugin, + should_float, + should_open_in_place, + skip_plugin_cache, + ) => { let url: Url = Url::from(&run_plugin.location); Ok(ProtobufAction { name: ProtobufActionName::LaunchPlugin as i32, @@ -1033,6 +1054,7 @@ impl TryFrom for ProtobufAction { move_to_focused_tab: false, should_open_in_place, plugin_configuration: Some(run_plugin.configuration.try_into()?), + skip_plugin_cache, }, )), }) @@ -1115,7 +1137,7 @@ impl TryFrom for ProtobufAction { name: ProtobufActionName::QueryTabNames as i32, optional_payload: None, }), - Action::NewTiledPluginPane(run_plugin, pane_name) => { + Action::NewTiledPluginPane(run_plugin, pane_name, skip_plugin_cache) => { let plugin_url: Url = Url::from(&run_plugin.location); Ok(ProtobufAction { name: ProtobufActionName::NewTiledPluginPane as i32, @@ -1123,11 +1145,12 @@ impl TryFrom for ProtobufAction { NewPluginPanePayload { plugin_url: plugin_url.into(), pane_name, + skip_plugin_cache, }, )), }) }, - Action::NewFloatingPluginPane(run_plugin, pane_name) => { + Action::NewFloatingPluginPane(run_plugin, pane_name, skip_plugin_cache) => { let plugin_url: Url = Url::from(&run_plugin.location); Ok(ProtobufAction { name: ProtobufActionName::NewFloatingPluginPane as i32, @@ -1135,6 +1158,7 @@ impl TryFrom for ProtobufAction { NewPluginPanePayload { plugin_url: plugin_url.into(), pane_name, + skip_plugin_cache, }, )), }) diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap index 7d5072a2..35aa55a4 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap @@ -2507,6 +2507,7 @@ Config { true, true, false, + false, ), SwitchToMode( Normal, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap index 9c5e198e..636b8d0d 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap @@ -2507,6 +2507,7 @@ Config { true, true, false, + false, ), SwitchToMode( Normal, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap index 31a92174..f183a0fa 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap @@ -2507,6 +2507,7 @@ Config { true, true, false, + false, ), SwitchToMode( Normal, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap index a6382c05..f70502e6 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap @@ -2507,6 +2507,7 @@ Config { true, true, false, + false, ), SwitchToMode( Normal, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap index 9dc3f74e..b0329b32 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap @@ -2507,6 +2507,7 @@ Config { true, true, false, + false, ), SwitchToMode( Normal,