DocumentEvent

Enum DocumentEvent 

Source
pub enum DocumentEvent {
Show 15 variants TextInserted { position: Position, text: String, length: usize, }, TextDeleted { range: Range, deleted_text: String, }, TextReplaced { range: Range, old_text: String, new_text: String, }, SelectionChanged { old_selection: Option<Range>, new_selection: Option<Range>, }, CursorMoved { old_position: Position, new_position: Position, }, DocumentSaved { file_path: String, save_as: bool, }, DocumentLoaded { file_path: String, size: usize, }, UndoPerformed { action_description: String, changes_count: usize, }, RedoPerformed { action_description: String, changes_count: usize, }, ValidationCompleted { issues_count: usize, error_count: usize, warning_count: usize, validation_time_ms: u64, }, SearchCompleted { pattern: String, matches_count: usize, hit_limit: bool, search_time_us: u64, }, ParsingCompleted { success: bool, sections_count: usize, parse_time_ms: u64, error_message: Option<String>, }, ExtensionChanged { extension_name: String, loaded: bool, }, ConfigChanged { key: String, old_value: Option<String>, new_value: String, }, CustomEvent { event_type: String, data: HashMap<String, String>, },
}
Expand description

Types of events that can occur in the editor

Variants§

§

TextInserted

Text was inserted at a position

Fields

§position: Position

Position where text was inserted

§text: String

Text that was inserted

§length: usize

Length of inserted text in bytes

§

TextDeleted

Text was deleted from a range

Fields

§range: Range

Range where text was deleted

§deleted_text: String

Text that was deleted (for undo purposes)

§

TextReplaced

Text was replaced in a range

Fields

§range: Range

Range where text was replaced

§old_text: String

Old text that was replaced

§new_text: String

New text that replaced the old text

§

SelectionChanged

Selection changed

Fields

§old_selection: Option<Range>

Previous selection range (if any)

§new_selection: Option<Range>

New selection range (if any)

§

CursorMoved

Cursor position changed

Fields

§old_position: Position

Previous cursor position

§new_position: Position

New cursor position

§

DocumentSaved

Document was saved to a file

Fields

§file_path: String

File path where document was saved

§save_as: bool

Whether this was a “save as” operation

§

DocumentLoaded

Document was loaded from a file

Fields

§file_path: String

File path from which document was loaded

§size: usize

Size of loaded document in bytes

§

UndoPerformed

Undo operation was performed

Fields

§action_description: String

Description of the undone action

§changes_count: usize

Number of changes undone

§

RedoPerformed

Redo operation was performed

Fields

§action_description: String

Description of the redone action

§changes_count: usize

Number of changes redone

§

ValidationCompleted

Validation completed with results

Fields

§issues_count: usize

Number of issues found

§error_count: usize

Number of errors found

§warning_count: usize

Number of warnings found

§validation_time_ms: u64

Time taken for validation in milliseconds

§

SearchCompleted

Search operation completed

Fields

§pattern: String

Search pattern that was used

§matches_count: usize

Number of matches found

§hit_limit: bool

Whether the search hit the result limit

§search_time_us: u64

Time taken for search in microseconds

§

ParsingCompleted

Document parsing completed

Fields

§success: bool

Whether parsing was successful

§sections_count: usize

Number of sections parsed

§parse_time_ms: u64

Time taken for parsing in milliseconds

§error_message: Option<String>

Any error message if parsing failed

§

ExtensionChanged

Extension was loaded or unloaded

Fields

§extension_name: String

Name of the extension

§loaded: bool

Whether the extension was loaded (true) or unloaded (false)

§

ConfigChanged

Configuration setting changed

Fields

§key: String

Name of the configuration key

§old_value: Option<String>

Old value (if any)

§new_value: String

New value

§

CustomEvent

Generic custom event for extensions

Fields

§event_type: String

Event type identifier

§data: HashMap<String, String>

Event data as key-value pairs

Implementations§

Source§

impl DocumentEvent

Source

pub fn description(&self) -> String

Get a human-readable description of the event

Source

pub fn is_modification(&self) -> bool

Check if this event represents a document modification

Source

pub fn affects_text(&self) -> bool

Check if this event affects the document’s text content

Source

pub fn affected_range(&self) -> Option<Range>

Get the affected range for events that modify text

Source§

impl DocumentEvent

Convenience functions for creating common events

Source

pub fn text_inserted(position: Position, text: String) -> Self

Create a text insertion event

Source

pub fn text_deleted(range: Range, deleted_text: String) -> Self

Create a text deletion event

Source

pub fn text_replaced(range: Range, old_text: String, new_text: String) -> Self

Create a text replacement event

Source

pub fn cursor_moved(old_position: Position, new_position: Position) -> Self

Create a cursor moved event

Source

pub fn document_saved(file_path: String, save_as: bool) -> Self

Create a document saved event

Source

pub fn validation_completed( issues_count: usize, error_count: usize, warning_count: usize, validation_time_ms: u64, ) -> Self

Create a validation completed event

Trait Implementations§

Source§

impl Clone for DocumentEvent

Source§

fn clone(&self) -> DocumentEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DocumentEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DocumentEvent

Source§

fn eq(&self, other: &DocumentEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for DocumentEvent

Source§

impl StructuralPartialEq for DocumentEvent

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.