summaryrefslogtreecommitdiffstats
path: root/zellij-server/src/plugins
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-02-21 10:17:06 +0100
committerAram Drevekenin <aram@poor.dev>2024-02-21 10:17:06 +0100
commit46886c12d41fbad151a4c5712c7188c4c985459a (patch)
treeabe83aa29fdf3ab3526b36e28e41ef4503f7737a /zellij-server/src/plugins
parent8183fe1f1cef448aecc57a1024d63d24b89c0763 (diff)
style(code): cleanups
Diffstat (limited to 'zellij-server/src/plugins')
-rw-r--r--zellij-server/src/plugins/mod.rs19
-rw-r--r--zellij-server/src/plugins/unit/plugin_tests.rs8
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs12
3 files changed, 3 insertions, 36 deletions
diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs
index 5c5903bc2..5179c6f00 100644
--- a/zellij-server/src/plugins/mod.rs
+++ b/zellij-server/src/plugins/mod.rs
@@ -237,7 +237,6 @@ pub(crate) fn plugin_thread_main(
cwd,
skip_cache,
) => {
- log::info!("run_plugin_or_alias: {:?}", run_plugin_or_alias);
run_plugin_or_alias.populate_run_plugin_if_needed(&plugin_aliases);
let run_plugin = run_plugin_or_alias.get_run_plugin();
match wasm_bridge.load_plugin(
@@ -349,8 +348,7 @@ pub(crate) fn plugin_thread_main(
RunPluginOrAlias,
Vec<PluginId>,
> = HashMap::new();
- tab_layout = tab_layout.or_else(|| Some(layout.new_tab().0)); // TODO: does this ruin the
- // universe???
+ tab_layout = tab_layout.or_else(|| Some(layout.new_tab().0));
tab_layout.as_mut().map(|t| t.populate_plugin_aliases_in_layout(&plugin_aliases));
floating_panes_layout
.iter_mut().for_each(|f| {
@@ -373,16 +371,7 @@ pub(crate) fn plugin_thread_main(
.collect();
extracted_run_instructions.append(&mut extracted_floating_plugins);
for run_instruction in extracted_run_instructions {
- // if let Some(Run::Plugin(run)) = run_instruction {
- // TODO: handle plugin alias
- // if let Some(Run::Plugin(RunPluginOrAlias::RunPlugin(run))) = run_instruction {
if let Some(Run::Plugin(run_plugin_or_alias)) = run_instruction {
- // TODO: add the ability to add an alias to plugin_ids, then add the
- // alias here and get a new plugin id from wasm_bridge
- // (wasm_bridge.plugin_not_found(alias)?)
- // then when applying the layout get it from there if it is None
- // the above method should use the error capabilities to send a plugin
- // not found message to said pane
let run_plugin = run_plugin_or_alias.get_run_plugin();
let skip_cache = false;
let (plugin_id, _client_id) = wasm_bridge.load_plugin(
@@ -713,11 +702,7 @@ fn pipe_to_specific_plugins(
let is_private = true;
let size = Size::default();
match RunPluginOrAlias::from_url(&plugin_url, configuration, Some(plugin_aliases), cwd.clone()) {
- // match RunPlugin::from_url(&plugin_url) {
Ok(run_plugin_or_alias) => {
-// if let Some(configuration) = configuration {
-// run_plugin.configuration = PluginUserConfiguration::new(configuration.clone());
-// }
let all_plugin_ids = wasm_bridge.get_or_load_plugins(
run_plugin_or_alias,
size,
@@ -733,7 +718,7 @@ fn pipe_to_specific_plugins(
pipe_messages.push((
Some(plugin_id),
client_id,
- PipeMessage::new(pipe_source.clone(), name, payload, args, is_private), // PipeMessage::new(PipeSource::Cli(pipe_id.clone()), &name, &payload, &args, is_private)
+ PipeMessage::new(pipe_source.clone(), name, payload, args, is_private),
));
}
},
diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs
index 5b2c71feb..d8ef6ca2e 100644
--- a/zellij-server/src/plugins/unit/plugin_tests.rs
+++ b/zellij-server/src/plugins/unit/plugin_tests.rs
@@ -633,14 +633,6 @@ pub fn load_new_plugin_with_plugin_alias() {
let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None);
let plugin_should_float = Some(false);
let plugin_title = Some("test_plugin".to_owned());
- // TODO: CONTINUE HERE (16/2)
- // - add an alias version of this test - DONE
- // - then make a version of the layout_with_plugin_panes test that also includes aliases (or
- // add it to that test?) - N/A
- // - then look through this file to see what other tests we can add, then look at more tests
- // in these files:
- // - plugin_tests
- // - screen_tests
let run_plugin = RunPluginOrAlias::Alias(PluginAlias {
name: "fixture_plugin_for_tests".to_owned(),
configuration: Default::default(),
diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs
index 89fe8fcb8..c0c5e5999 100644
--- a/zellij-server/src/plugins/zellij_exports.rs
+++ b/zellij-server/src/plugins/zellij_exports.rs
@@ -27,8 +27,6 @@ use zellij_utils::{
ipc::{ClientToServerMsg, IpcSenderWithContext},
};
-use url::Url;
-
use crate::{panes::PaneId, screen::ScreenInstruction};
use zellij_utils::{
@@ -41,7 +39,7 @@ use zellij_utils::{
input::{
actions::Action,
command::{RunCommand, RunCommandAction, TerminalAction},
- layout::{Layout, PluginUserConfiguration, RunPlugin, RunPluginOrAlias, RunPluginLocation},
+ layout::{Layout, RunPluginOrAlias},
plugins::PluginType,
},
plugin_api::{
@@ -1226,14 +1224,6 @@ fn start_or_reload_plugin(env: &ForeignFunctionEnv, url: &str) -> Result<()> {
)
};
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
- // let url = Url::parse(&url).map_err(|e| anyhow!("Failed to parse url: {}", e))?;
-// let run_plugin_location = RunPluginLocation::parse(url.as_str(), Some(cwd))
-// .map_err(|e| anyhow!("Failed to parse plugin location: {}", e))?;
-// let run_plugin = RunPlugin {
-// location: run_plugin_location,
-// _allow_exec_host_cmd: false,
-// configuration: PluginUserConfiguration::new(BTreeMap::new()), // TODO: allow passing configuration
-// };
let run_plugin_or_alias = RunPluginOrAlias::from_url(url, &None, None, Some(cwd))
.map_err(|e| anyhow!("Failed to parse plugin location: {}", e))?;
let action = Action::StartOrReloadPlugin(run_plugin_or_alias);