Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugins): use protocol buffers for serializing across the wasm boundary #2686

Merged
merged 26 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
options: -v ${{ github.workspace }}/target:/usr/src/zellij --name ssh
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add WASM target
run: rustup target add wasm32-wasi
- name: Install musl-tools
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
Expand All @@ -40,6 +45,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
Expand All @@ -63,6 +72,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
Expand Down
97 changes: 97 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 38 additions & 23 deletions default-plugins/fixture-plugin-for-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
);
});
}
}
}
Expand Down Expand Up @@ -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());
Expand All @@ -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);
Expand Down Expand Up @@ -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(),
});
},
_ => {},
}
Expand Down
Loading