summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/plugin_api
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-11-30 18:10:50 +0100
committerGitHub <noreply@github.com>2023-11-30 18:10:50 +0100
commitb0f36540fe3cb439fd0981cbb1ef5df6668ddbdf (patch)
tree6d1d7329361ad25506cc7e1cb7ea135b9434191b /zellij-utils/src/plugin_api
parent65bea269a45784d5b70bf4290bf55c2ddcd670e4 (diff)
feat(plugins): skip plugin cache flag (#2971)
* feat(plugins): allow explicitly skipping the plugin cache when loading * style(fmt): rustfmt * fix tests
Diffstat (limited to 'zellij-utils/src/plugin_api')
-rw-r--r--zellij-utils/src/plugin_api/action.proto2
-rw-r--r--zellij-utils/src/plugin_api/action.rs34
2 files changed, 31 insertions, 5 deletions
diff --git a/zellij-utils/src/plugin_api/action.proto b/zellij-utils/src/plugin_api/action.proto
index e9d2a293f..da10d82a8 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 dc8c29380..71eaaa130 100644
--- a/zellij-utils/src/plugin_api/action.rs
+++ b/zellij-utils/src/plugin_api/action.rs
@@ -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,
},
)),
})