feat(plugin): wire on_cursor_move and preview wires through IPC plugin runner

This commit is contained in:
yztink committed 2026-09-23 11:33:37 -07:00
1 parent 5eda52626e
commit 358103c1e4
4 files changed
+88

No files matched your search

+30
View File
@@ -243,6 +243,21 @@ fn handle_host_request(
None => HostResponse::Error(format!("unknown interactive command {command_id}")),
}
}
HostRequest::CursorMove { command_id, pt } => {
let result = {
let mut registry = interactive.borrow_mut();
registry.get_mut(&command_id).map(|cmd| {
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
cmd.on_cursor_move(pt)
}))
})
};
match result {
Some(Ok(wires)) => HostResponse::PreviewWires(wires),
Some(Err(_)) => HostResponse::PreviewWires(Vec::new()),
None => HostResponse::PreviewWires(Vec::new()),
}
}
HostRequest::ExecuteCode { .. } => {
HostResponse::Error("ExecuteCode requires V4 protocol".to_string())
}
@@ -366,6 +381,21 @@ fn handle_host_request_v4(
None => Some(HostResponse::Error(format!("unknown interactive command {command_id}"))),
}
}
HostRequest::CursorMove { command_id, pt } => {
let result = {
let mut registry = interactive.borrow_mut();
registry.get_mut(&command_id).map(|cmd| {
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
cmd.on_cursor_move(pt)
}))
})
};
match result {
Some(Ok(wires)) => Some(HostResponse::PreviewWires(wires)),
Some(Err(_)) => Some(HostResponse::PreviewWires(Vec::new())),
None => Some(HostResponse::PreviewWires(Vec::new())),
}
}
HostRequest::ExecuteCode {
command_id,
source,