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§
Sourcefn translate(
&self,
plugin_name: &str,
key: &str,
args: &HashMap<String, String>,
) -> String
fn translate( &self, plugin_name: &str, key: &str, args: &HashMap<String, String>, ) -> String
Translate a string for a plugin
Sourcefn current_locale(&self) -> String
fn current_locale(&self) -> String
Get the current locale
Sourcefn set_js_execution_state(&self, state: String)
fn set_js_execution_state(&self, state: String)
Update the current JavaScript execution state (for debugging/signal handlers)
Sourcefn clear_js_execution_state(&self)
fn clear_js_execution_state(&self)
Clear the JavaScript execution state
Sourcefn get_theme_schema(&self) -> Value
fn get_theme_schema(&self) -> Value
Get the JSON schema for themes
Sourcefn get_builtin_themes(&self) -> Value
fn get_builtin_themes(&self) -> Value
Get a list of builtin theme names
Sourcefn register_command(&self, command: Command)
fn register_command(&self, command: Command)
Register a plugin command
Sourcefn unregister_command(&self, name: &str)
fn unregister_command(&self, name: &str)
Unregister a command by name
Sourcefn unregister_commands_by_prefix(&self, prefix: &str)
fn unregister_commands_by_prefix(&self, prefix: &str)
Unregister all commands with a given prefix
Sourcefn unregister_commands_by_plugin(&self, plugin_name: &str)
fn unregister_commands_by_plugin(&self, plugin_name: &str)
Unregister all commands registered by a specific plugin
Sourcefn plugins_dir(&self) -> PathBuf
fn plugins_dir(&self) -> PathBuf
Get the plugins directory path
Sourcefn config_dir(&self) -> PathBuf
fn config_dir(&self) -> PathBuf
Get the config directory path
Provided Methods§
Sourcefn register_plugin_strings(
&self,
_plugin_name: &str,
_strings: HashMap<String, HashMap<String, String>>,
)
fn register_plugin_strings( &self, _plugin_name: &str, _strings: HashMap<String, HashMap<String, String>>, )
Register custom i18n strings for a plugin
Sourcefn unregister_plugin_strings(&self, _plugin_name: &str)
fn unregister_plugin_strings(&self, _plugin_name: &str)
Unregister custom i18n strings for a plugin
Sourcefn get_theme_data(&self, _name: &str) -> Option<Value>
fn get_theme_data(&self, _name: &str) -> Option<Value>
Get theme data (JSON) by name from the in-memory cache.
Sourcefn save_theme_file(&self, _name: &str, _content: &str) -> Result<String, String>
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.
Sourcefn theme_file_exists(&self, _name: &str) -> bool
fn theme_file_exists(&self, _name: &str) -> bool
Check if a user theme file exists (for overwrite confirmation).