SyntaxHighlightExtension

Struct SyntaxHighlightExtension 

Source
pub struct SyntaxHighlightExtension { /* private fields */ }
Expand description

Syntax highlighting extension

Implementations§

Source§

impl SyntaxHighlightExtension

Source

pub fn new() -> Self

Create a new syntax highlighting extension

Source

pub fn tokenize_document( &mut self, document: &EditorDocument, ) -> Result<Vec<HighlightToken>>

Tokenize a document

Source

pub fn clear_cache(&mut self)

Clear token cache

Source

pub fn invalidate_document(&mut self, doc_id: &str)

Invalidate cache for a specific document

Trait Implementations§

Source§

impl Default for SyntaxHighlightExtension

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl EditorExtension for SyntaxHighlightExtension

Source§

fn info(&self) -> &ExtensionInfo

Get extension metadata
Source§

fn initialize(&mut self, context: &mut dyn ExtensionContext) -> Result<()>

Initialize the extension
Source§

fn shutdown(&mut self, _context: &mut dyn ExtensionContext) -> Result<()>

Shutdown the extension
Source§

fn state(&self) -> ExtensionState

Get the current state of the extension
Source§

fn execute_command( &mut self, command_id: &str, _args: &HashMap<String, String>, context: &mut dyn ExtensionContext, ) -> Result<ExtensionResult>

Execute a command provided by this extension
Source§

fn commands(&self) -> Vec<ExtensionCommand>

Get commands provided by this extension
Source§

fn config_schema(&self) -> HashMap<String, String>

Get configuration schema (optional)
Source§

fn handle_event( &mut self, _event: &DocumentEvent, _context: &mut dyn ExtensionContext, ) -> Result<()>

Handle a document event (optional)
Source§

fn validate_config(&self, _config: &HashMap<String, String>) -> Result<()>

Validate configuration (optional)
Source§

fn pause(&mut self) -> Result<()>

Pause the extension (optional)
Source§

fn resume(&mut self) -> Result<()>

Resume the extension (optional)
Source§

fn get_data(&self, _key: &str) -> Option<String>

Get extension-specific data (optional)
Source§

fn set_data(&mut self, _key: String, _value: String) -> Result<()>

Set extension-specific data (optional)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.