Skip to content

Commit 83e386e

Browse files
authored
Merge pull request #88 from hexedtech/fix/py/add-missing-workspace-event-class
properly export the event object to the python glue
2 parents 3c996bb + 02d7e71 commit 83e386e

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

dist/py/src/codemp/codemp.pyi

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Tuple, Optional, Callable
1+
from typing import Optional, Callable
22

33
def version() -> str: ...
44

@@ -61,8 +61,32 @@ class Client:
6161
def current_user(self) -> User: ...
6262
def refresh(self) -> Promise[None]: ...
6363

64+
class FileTreeUpdated:
65+
"""
66+
Fired when the file tree changes.
67+
Contains the modified buffer path (deleted, created or renamed)
68+
"""
69+
path: str
70+
71+
class UserJoin:
72+
"""
73+
Fired when a user joins the workspace
74+
"""
75+
name: str
76+
77+
class UserLeave:
78+
"""
79+
Fired when a user leaves the workspace
80+
"""
81+
name: str
82+
6483
class Event:
65-
pass
84+
"""
85+
Workspace events to notify users of changes happening in the workspace.
86+
"""
87+
FileTreeUpdated: FileTreeUpdated
88+
UserJoin: UserJoin
89+
UserLeave: UserLeave
6690

6791
class Workspace:
6892
"""

src/ffi/python/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod controllers;
33
pub mod workspace;
44

55
use crate::{
6-
api::{BufferUpdate, Config, Cursor, Selection, TextChange, User},
6+
api::{BufferUpdate, Config, Cursor, Event, Selection, TextChange, User},
77
buffer::Controller as BufferController,
88
cursor::Controller as CursorController,
99
Client, Workspace,
@@ -391,6 +391,7 @@ fn codemp(m: &Bound<'_, PyModule>) -> PyResult<()> {
391391
m.add_class::<User>()?;
392392

393393
m.add_class::<Workspace>()?;
394+
m.add_class::<Event>()?;
394395
m.add_class::<Client>()?;
395396
m.add_class::<Config>()?;
396397

0 commit comments

Comments
 (0)