From 02d7e711803a50e95d32432a84701c7d73063a12 Mon Sep 17 00:00:00 2001 From: cschen Date: Sun, 23 Feb 2025 12:41:01 +0100 Subject: [PATCH] properly export the event object to the python glue --- dist/py/src/codemp/codemp.pyi | 28 ++++++++++++++++++++++++++-- src/ffi/python/mod.rs | 3 ++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/dist/py/src/codemp/codemp.pyi b/dist/py/src/codemp/codemp.pyi index 4b0afdc..f383f04 100644 --- a/dist/py/src/codemp/codemp.pyi +++ b/dist/py/src/codemp/codemp.pyi @@ -1,4 +1,4 @@ -from typing import Tuple, Optional, Callable +from typing import Optional, Callable def version() -> str: ... @@ -61,8 +61,32 @@ class Client: def current_user(self) -> User: ... def refresh(self) -> Promise[None]: ... +class FileTreeUpdated: + """ + Fired when the file tree changes. + Contains the modified buffer path (deleted, created or renamed) + """ + path: str + +class UserJoin: + """ + Fired when a user joins the workspace + """ + name: str + +class UserLeave: + """ + Fired when a user leaves the workspace + """ + name: str + class Event: - pass + """ + Workspace events to notify users of changes happening in the workspace. + """ + FileTreeUpdated: FileTreeUpdated + UserJoin: UserJoin + UserLeave: UserLeave class Workspace: """ diff --git a/src/ffi/python/mod.rs b/src/ffi/python/mod.rs index 7032e16..a68e5e6 100644 --- a/src/ffi/python/mod.rs +++ b/src/ffi/python/mod.rs @@ -3,7 +3,7 @@ pub mod controllers; pub mod workspace; use crate::{ - api::{BufferUpdate, Config, Cursor, Selection, TextChange, User}, + api::{BufferUpdate, Config, Cursor, Event, Selection, TextChange, User}, buffer::Controller as BufferController, cursor::Controller as CursorController, Client, Workspace, @@ -391,6 +391,7 @@ fn codemp(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_class::()?; m.add_class::()?; + m.add_class::()?; m.add_class::()?; m.add_class::()?;