Merge pull request from hexedtech/fix/py/add-missing-workspace-event-class

properly export the event object to the python glue
This commit is contained in:
cschen 2025-03-18 09:22:16 +01:00 committed by GitHub
commit 83e386e136
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 3 deletions
dist/py/src/codemp
src/ffi/python

View file

@ -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:
"""

View file

@ -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::<User>()?;
m.add_class::<Workspace>()?;
m.add_class::<Event>()?;
m.add_class::<Client>()?;
m.add_class::<Config>()?;