diff options
| author | Aram Drevekenin <aram@poor.dev> | 2023-08-09 22:26:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-09 22:26:00 +0200 |
| commit | 1bedfc90021558cb201695444107afe5bddd2c17 (patch) | |
| tree | 38dd31b5ab112aa9b1c3a54edb07331013bf7d87 /default-plugins/fixture-plugin-for-tests | |
| parent | docs(changelog): plug memory leak (diff) | |
| download | sl0ppij-1bedfc90021558cb201695444107afe5bddd2c17.tar.gz sl0ppij-1bedfc90021558cb201695444107afe5bddd2c17.tar.xz sl0ppij-1bedfc90021558cb201695444107afe5bddd2c17.zip | |
feat(plugins): use protocol buffers for serializing across the wasm boundary (#2686)
* work
* almost done with command protobuffers
* done translating command data structures
* mid transferring of every command to protobuff command
* transferred plugin_command.rs, now moving on to shim.rs
* plugin command working with protobufs
* protobuffers in update
* protobuf event tests
* various TODOs and comments
* fix zellij-tile
* clean up prost deps
* remove version mismatch error
* fix panic
* some cleanups
* clean up event protobuffers
* clean up command protobuffers
* clean up various protobufs
* refactor protobufs
* update comments
* some transformation fixes
* use protobufs for workers
* style(fmt): rustfmt
* style(fmt): rustfmt
* chore(build): add protoc
* chore(build): authenticate protoc
Diffstat (limited to 'default-plugins/fixture-plugin-for-tests')
| -rw-r--r-- | default-plugins/fixture-plugin-for-tests/src/main.rs | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 074aa1a4..fe8b034b 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -22,13 +22,14 @@ impl<'de> ZellijWorker<'de> for TestWorker { fn on_message(&mut self, message: String, payload: String) { if message == "ping" { self.number_of_messages_received += 1; - post_message_to_plugin( - "pong".into(), - format!( + post_message_to_plugin(PluginMessage { + worker_name: None, + name: "pong".into(), + payload: format!( "{}, received {} messages", payload, self.number_of_messages_received ), - ); + }); } } } @@ -143,22 +144,30 @@ impl ZellijPlugin for State { start_or_reload_plugin(plugin_url) }, Key::Ctrl('g') => { - open_file(std::path::PathBuf::from("/path/to/my/file.rs").as_path()); + open_file(FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + ..Default::default() + }); }, Key::Ctrl('h') => { - open_file_floating(std::path::PathBuf::from("/path/to/my/file.rs").as_path()); + open_file_floating(FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + ..Default::default() + }); }, Key::Ctrl('i') => { - open_file_with_line( - std::path::PathBuf::from("/path/to/my/file.rs").as_path(), - 42, - ); + open_file(FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + line_number: Some(42), + ..Default::default() + }); }, Key::Ctrl('j') => { - open_file_with_line_floating( - std::path::PathBuf::from("/path/to/my/file.rs").as_path(), - 42, - ); + open_file_floating(FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + line_number: Some(42), + ..Default::default() + }); }, Key::Ctrl('k') => { open_terminal(std::path::PathBuf::from("/path/to/my/file.rs").as_path()); @@ -169,16 +178,18 @@ impl ZellijPlugin for State { ); }, Key::Ctrl('m') => { - open_command_pane( - std::path::PathBuf::from("/path/to/my/file.rs").as_path(), - vec!["arg1".to_owned(), "arg2".to_owned()], - ); + open_command_pane(CommandToRun { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + ..Default::default() + }); }, Key::Ctrl('n') => { - open_command_pane_floating( - std::path::PathBuf::from("/path/to/my/file.rs").as_path(), - vec!["arg1".to_owned(), "arg2".to_owned()], - ); + open_command_pane_floating(CommandToRun { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + ..Default::default() + }); }, Key::Ctrl('o') => { switch_tab_to(1); @@ -225,7 +236,11 @@ impl ZellijPlugin for State { }, Event::SystemClipboardFailure => { // this is just to trigger the worker message - post_message_to("test", "ping", "gimme_back_my_payload"); + post_message_to(PluginMessage { + worker_name: Some("test".into()), + name: "ping".into(), + payload: "gimme_back_my_payload".into(), + }); }, _ => {}, } |
