feat(plugins): skip plugin cache flag (#2971)
* feat(plugins): allow explicitly skipping the plugin cache when loading * style(fmt): rustfmt * fix tests
This commit is contained in:
parent
65bea269a4
commit
b0f36540fe
22 changed files with 308 additions and 85 deletions
|
|
@ -245,7 +245,7 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<Key>)> {
|
|||
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, &[
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ pub enum PluginInstruction {
|
|||
ClientId,
|
||||
Size,
|
||||
Option<PathBuf>, // cwd
|
||||
bool, // skip cache
|
||||
),
|
||||
Update(Vec<(Option<PluginId>, Option<ClientId>, 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
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ impl<'a> PluginLoader<'a> {
|
|||
client_attributes: ClientAttributes,
|
||||
default_shell: Option<TerminalAction>,
|
||||
default_layout: Box<Layout>,
|
||||
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(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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![(
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ impl WasmBridge {
|
|||
tab_index: usize,
|
||||
size: Size,
|
||||
cwd: Option<PathBuf>,
|
||||
skip_cache: bool,
|
||||
client_id: Option<ClientId>,
|
||||
) -> Result<PluginId> {
|
||||
// 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(
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ pub enum PtyInstruction {
|
|||
Option<PaneId>, // 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<Layout>) -> 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<Layout>) -> Result<()> {
|
|||
pane_id_to_replace,
|
||||
client_id,
|
||||
size,
|
||||
skip_cache,
|
||||
)?;
|
||||
},
|
||||
PtyInstruction::Exit => break,
|
||||
|
|
@ -1328,6 +1331,7 @@ impl Pty {
|
|||
pane_id_to_replace: Option<PaneId>, // 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(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)?;
|
||||
|
|
|
|||
|
|
@ -272,11 +272,13 @@ pub enum ScreenInstruction {
|
|||
PreviousSwapLayout(ClientId),
|
||||
NextSwapLayout(ClientId),
|
||||
QueryTabNames(ClientId),
|
||||
NewTiledPluginPane(RunPlugin, Option<String>, ClientId), // Option<String> is
|
||||
// optional pane title
|
||||
NewFloatingPluginPane(RunPlugin, Option<String>, ClientId), // Option<String> is an
|
||||
NewInPlacePluginPane(RunPlugin, Option<String>, PaneId, ClientId), // Option<String> is an
|
||||
// optional pane title
|
||||
NewTiledPluginPane(RunPlugin, Option<String>, bool, ClientId), // Option<String> is
|
||||
// optional pane title, bool is skip cache
|
||||
NewFloatingPluginPane(RunPlugin, Option<String>, bool, ClientId), // Option<String> is an
|
||||
// optional pane title, bool
|
||||
// is skip cache
|
||||
NewInPlacePluginPane(RunPlugin, Option<String>, PaneId, bool, ClientId), // Option<String> is an
|
||||
// optional pane title, bool is skip cache
|
||||
StartOrReloadPluginPane(RunPlugin, Option<String>),
|
||||
AddPlugin(
|
||||
Option<bool>, // 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<PaneId>, ClientId), // bools are: should_float, move_to_focused_tab, should_open_in_place Option<PaneId> is the pane id to replace
|
||||
LaunchPlugin(RunPlugin, bool, bool, Option<PaneId>, ClientId), // bools are: should_float, should_open_in_place Option<PaneId> 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<PaneId>, bool, ClientId), // bools are: should_float, move_to_focused_tab, should_open_in_place, Option<PaneId> is the pane id to replace, bool following it is skip_cache
|
||||
LaunchPlugin(RunPlugin, bool, bool, Option<PaneId>, bool, ClientId), // bools are: should_float, should_open_in_place Option<PaneId> 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<u8>),
|
||||
RenameTab(usize, Vec<u8>),
|
||||
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 => {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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<PluginUserConfiguration>,
|
||||
#[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<PluginUserConfiguration>,
|
||||
#[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<PluginUserConfiguration>,
|
||||
#[clap(short, long, value_parser)]
|
||||
skip_plugin_cache: bool,
|
||||
},
|
||||
RenameSession {
|
||||
name: String,
|
||||
|
|
|
|||
|
|
@ -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>), // String is an optional name
|
||||
NewFloatingPluginPane(RunPlugin, Option<String>), // String is an optional name
|
||||
NewInPlacePluginPane(RunPlugin, Option<String>), // String is an optional name
|
||||
NewTiledPluginPane(RunPlugin, Option<String>, bool), // String is an optional name, bool is
|
||||
// skip_cache
|
||||
NewFloatingPluginPane(RunPlugin, Option<String>, bool), // String is an optional name, bool is
|
||||
// skip_cache
|
||||
NewInPlacePluginPane(RunPlugin, Option<String>, 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)]),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -403,11 +403,13 @@ impl TryFrom<ProtobufAction> 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<ProtobufAction> 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<ProtobufAction> 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<ProtobufAction> 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<Action> 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<Action> 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<Action> 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<Action> 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<Action> 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<Action> for ProtobufAction {
|
|||
NewPluginPanePayload {
|
||||
plugin_url: plugin_url.into(),
|
||||
pane_name,
|
||||
skip_plugin_cache,
|
||||
},
|
||||
)),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2507,6 +2507,7 @@ Config {
|
|||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
),
|
||||
SwitchToMode(
|
||||
Normal,
|
||||
|
|
|
|||
|
|
@ -2507,6 +2507,7 @@ Config {
|
|||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
),
|
||||
SwitchToMode(
|
||||
Normal,
|
||||
|
|
|
|||
|
|
@ -2507,6 +2507,7 @@ Config {
|
|||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
),
|
||||
SwitchToMode(
|
||||
Normal,
|
||||
|
|
|
|||
|
|
@ -2507,6 +2507,7 @@ Config {
|
|||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
),
|
||||
SwitchToMode(
|
||||
Normal,
|
||||
|
|
|
|||
|
|
@ -2507,6 +2507,7 @@ Config {
|
|||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
),
|
||||
SwitchToMode(
|
||||
Normal,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue