Skip to content

Commit

Permalink
fix(plugins): start plugin pane in cwd of focused pane if possible (#…
Browse files Browse the repository at this point in the history
…2905)

* fix(plugins): start plugin pane in cwd of focused pane if possible

* disable clippy - I have had enough

* fix tests
  • Loading branch information
imsnif authored Nov 6, 2023
1 parent 9ed8569 commit a3d63be
Show file tree
Hide file tree
Showing 9 changed files with 257 additions and 109 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,3 @@ jobs:
run: rustup show
- name: Check Format
run: cargo xtask format --check

clippy:
name: Check Clippy Lints
runs-on: ubuntu-latest

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
- name: Check clippy lints
run: cargo xtask clippy
15 changes: 11 additions & 4 deletions zellij-server/src/plugins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub enum PluginInstruction {
Option<PaneId>, // pane id to replace if this is to be opened "in-place"
ClientId,
Size,
Option<PathBuf>, // cwd
),
Update(Vec<(Option<PluginId>, Option<ClientId>, Event)>), // Focused plugin / broadcast, client_id, event data
Unload(PluginId), // plugin_id
Expand Down Expand Up @@ -182,7 +183,8 @@ pub(crate) fn plugin_thread_main(
pane_id_to_replace,
client_id,
size,
) => match wasm_bridge.load_plugin(&run, tab_index, size, Some(client_id)) {
cwd,
) => match wasm_bridge.load_plugin(&run, tab_index, size, cwd, Some(client_id)) {
Ok(plugin_id) => {
drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin(
should_float,
Expand Down Expand Up @@ -217,7 +219,7 @@ 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) {
match wasm_bridge.load_plugin(&run, tab_index, size, None, None) {
Ok(plugin_id) => {
let should_be_open_in_place = false;
drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin(
Expand Down Expand Up @@ -281,8 +283,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 plugin_id =
wasm_bridge.load_plugin(&run, tab_index, size, Some(client_id))?;
let plugin_id = wasm_bridge.load_plugin(
&run,
tab_index,
size,
None,
Some(client_id),
)?;
plugin_ids
.entry((run.location, run.configuration))
.or_default()
Expand Down
Loading

0 comments on commit a3d63be

Please sign in to comment.