Skip to main content

PluginServiceBridge

Trait PluginServiceBridge 

Source
pub trait PluginServiceBridge:
    Send
    + Sync
    + 'static {
Show 18 methods // Required methods fn as_any(&self) -> &dyn Any; fn translate( &self, plugin_name: &str, key: &str, args: &HashMap<String, String>, ) -> String; fn current_locale(&self) -> String; fn set_js_execution_state(&self, state: String); fn clear_js_execution_state(&self); fn get_theme_schema(&self) -> Value; fn get_builtin_themes(&self) -> Value; fn register_command(&self, command: Command); fn unregister_command(&self, name: &str); fn unregister_commands_by_prefix(&self, prefix: &str); fn unregister_commands_by_plugin(&self, plugin_name: &str); fn plugins_dir(&self) -> PathBuf; fn config_dir(&self) -> PathBuf; // Provided methods fn register_plugin_strings( &self, _plugin_name: &str, _strings: HashMap<String, HashMap<String, String>>, ) { ... } fn unregister_plugin_strings(&self, _plugin_name: &str) { ... } fn get_theme_data(&self, _name: &str) -> Option<Value> { ... } fn save_theme_file( &self, _name: &str, _content: &str, ) -> Result<String, String> { ... } fn theme_file_exists(&self, _name: &str) -> bool { ... }
}
Expand description

Trait for the editor to provide services to the plugin runtime without the runtime depending directly on UI or complex system logic.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Support downcasting for tests

Source

fn translate( &self, plugin_name: &str, key: &str, args: &HashMap<String, String>, ) -> String

Translate a string for a plugin

Source

fn current_locale(&self) -> String

Get the current locale

Source

fn set_js_execution_state(&self, state: String)

Update the current JavaScript execution state (for debugging/signal handlers)

Source

fn clear_js_execution_state(&self)

Clear the JavaScript execution state

Source

fn get_theme_schema(&self) -> Value

Get the JSON schema for themes

Source

fn get_builtin_themes(&self) -> Value

Get a list of builtin theme names

Source

fn register_command(&self, command: Command)

Register a plugin command

Source

fn unregister_command(&self, name: &str)

Unregister a command by name

Source

fn unregister_commands_by_prefix(&self, prefix: &str)

Unregister all commands with a given prefix

Source

fn unregister_commands_by_plugin(&self, plugin_name: &str)

Unregister all commands registered by a specific plugin

Source

fn plugins_dir(&self) -> PathBuf

Get the plugins directory path

Source

fn config_dir(&self) -> PathBuf

Get the config directory path

Provided Methods§

Source

fn register_plugin_strings( &self, _plugin_name: &str, _strings: HashMap<String, HashMap<String, String>>, )

Register custom i18n strings for a plugin

Source

fn unregister_plugin_strings(&self, _plugin_name: &str)

Unregister custom i18n strings for a plugin

Source

fn get_theme_data(&self, _name: &str) -> Option<Value>

Get theme data (JSON) by name from the in-memory cache.

Source

fn save_theme_file(&self, _name: &str, _content: &str) -> Result<String, String>

Save a theme file to the user themes directory. Returns the path where the file was written.

Source

fn theme_file_exists(&self, _name: &str) -> bool

Check if a user theme file exists (for overwrite confirmation).

Implementors§