Skip to main content

WorkspacePlugin

Trait WorkspacePlugin 

Source
pub trait WorkspacePlugin: Plugin {
Show 14 methods // Provided methods fn on_workspace_opened<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceOpenedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn on_workspace_closed<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceClosedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn on_workspace_changed<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceChangedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn on_workspace_committed<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceCommittedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_command<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 str, params: JsonValue, ) -> Pin<Box<dyn Future<Output = Option<Result<JsonValue, PluginError>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn notify_workspace_modified<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn on_body_doc_renamed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _old_path: &'life1 str, _new_path: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn on_body_doc_deleted<'life0, 'life1, 'async_trait>( &'life0 self, _path: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn track_file_for_sync<'life0, 'life1, 'async_trait>( &'life0 self, _canonical_path: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn track_content_for_sync(&self, _canonical_path: &str, _content: &str) { ... } fn get_canonical_path(&self, _storage_path: &str) -> Option<String> { ... } fn get_file_title(&self, _canonical_path: &str) -> Option<String> { ... } fn get_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<Value>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn set_config<'life0, 'async_trait>( &'life0 self, _config: Value, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Workspace lifecycle plugin.

Receives events when workspaces are opened, closed, or modified.

Provided Methods§

Source

fn on_workspace_opened<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceOpenedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when a workspace is opened.

Source

fn on_workspace_closed<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceClosedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when a workspace is closed.

Source

fn on_workspace_changed<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceChangedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when workspace metadata changes.

Source

fn on_workspace_committed<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 WorkspaceCommittedEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when a workspace is committed (e.g., git commit or sync checkpoint).

Source

fn handle_command<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 str, params: JsonValue, ) -> Pin<Box<dyn Future<Output = Option<Result<JsonValue, PluginError>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a plugin-specific command.

Returns None if the command is not recognized by this plugin.

Source

fn notify_workspace_modified<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Called after a workspace-modifying operation completes.

Plugins that manage sync state should broadcast CRDT workspace updates to connected peers.

Source

fn on_body_doc_renamed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _old_path: &'life1 str, _new_path: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called when a body document needs to be renamed (file was moved/renamed).

Plugins that manage body CRDTs should rename the underlying Y.Doc.

Source

fn on_body_doc_deleted<'life0, 'life1, 'async_trait>( &'life0 self, _path: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when a body document should be deleted.

Plugins that manage body CRDTs should remove the underlying Y.Doc.

Source

fn track_file_for_sync<'life0, 'life1, 'async_trait>( &'life0 self, _canonical_path: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called after a file operation to track CRDT metadata for echo detection.

Plugins should read their own CRDT file metadata for the given canonical path and register it with the sync echo tracker.

Source

fn track_content_for_sync(&self, _canonical_path: &str, _content: &str)

Track body content for echo detection.

Called after writing body content locally so that the sync system can recognize its own writes when they arrive via remote sync.

Source

fn get_canonical_path(&self, _storage_path: &str) -> Option<String>

Resolve a canonical path from a storage path.

Returns Some(canonical) if the plugin performs path mapping (e.g., guest mode prefix stripping), or None to use the default.

Source

fn get_file_title(&self, _canonical_path: &str) -> Option<String>

Get the title for a file from CRDT metadata.

Returns Some(title) if the plugin has metadata for the given path, or None to use the default filename-based title.

Source

fn get_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<Value>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get this plugin’s configuration (if any).

Source

fn set_config<'life0, 'async_trait>( &'life0 self, _config: Value, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Update this plugin’s configuration.

Implementors§