pub trait ExtensionContext {
// Required methods
fn current_document(&self) -> Option<&EditorDocument>;
fn current_document_mut(&mut self) -> Option<&mut EditorDocument>;
fn send_event(&mut self, event: DocumentEvent) -> Result<()>;
fn get_config(&self, key: &str) -> Option<String>;
fn set_config(&mut self, key: String, value: String) -> Result<()>;
fn register_command(&mut self, command: ExtensionCommand) -> Result<()>;
fn show_message(&mut self, message: &str, level: MessageLevel) -> Result<()>;
fn get_extension_data(
&self,
extension_name: &str,
key: &str,
) -> Option<String>;
fn set_extension_data(&mut self, key: String, value: String) -> Result<()>;
}Expand description
Extension context providing access to editor functionality
Required Methods§
Sourcefn current_document(&self) -> Option<&EditorDocument>
fn current_document(&self) -> Option<&EditorDocument>
Get the current document (if any)
Sourcefn current_document_mut(&mut self) -> Option<&mut EditorDocument>
fn current_document_mut(&mut self) -> Option<&mut EditorDocument>
Get a mutable reference to the current document
Sourcefn send_event(&mut self, event: DocumentEvent) -> Result<()>
fn send_event(&mut self, event: DocumentEvent) -> Result<()>
Send an event to the event system
Sourcefn get_config(&self, key: &str) -> Option<String>
fn get_config(&self, key: &str) -> Option<String>
Get configuration value
Sourcefn register_command(&mut self, command: ExtensionCommand) -> Result<()>
fn register_command(&mut self, command: ExtensionCommand) -> Result<()>
Register a command with the editor
Sourcefn show_message(&mut self, message: &str, level: MessageLevel) -> Result<()>
fn show_message(&mut self, message: &str, level: MessageLevel) -> Result<()>
Show a message to the user
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".