Skip to main content

CodeEditorHandle

Struct CodeEditorHandle 

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

Reactive shared handle to a CodeEditor instance.

Wraps Rc<RefCell<CodeEditor>> alongside a reactive Signal<u64> revision counter so editing, scrolling, folding, and Find & Replace trigger immediate fine-grained UI updates without cloning the underlying B-Tree text rope.

Implementations§

Source§

impl CodeEditorHandle

Source

pub fn new(initial_text: &str, language: Language) -> Self

Creates a new standalone handle initialized with initial_text and language.

Source

pub fn version(&self) -> u64

Reads the reactive revision signal (subscribes callers to editor updates).

Source

pub fn notify(&self)

Bumps the reactive revision counter to schedule a repaint.

Source

pub fn with_editor<R>(&self, f: impl FnOnce(&CodeEditor) -> R) -> R

Executes a read-only closure against the inner CodeEditor.

Source

pub fn with_editor_mut<R>(&self, f: impl FnOnce(&mut CodeEditor) -> R) -> R

Executes a mutating closure against the inner CodeEditor and notifies subscribers.

Source

pub fn text(&self) -> String

Returns the full document text.

Source

pub fn set_text(&self, text: &str)

Replaces document contents and resets history.

Source

pub fn language(&self) -> Language

Returns the active language.

Source

pub fn set_language(&self, language: Language)

Changes syntax language and re-parses the buffer.

Source

pub fn set_theme(&self, theme: EditorTheme)

Updates the active CSS-variable EditorTheme.

Source

pub fn set_diagnostics(&self, diagnostics: Vec<EditorDiagnostic>)

Updates external/LSP diagnostics without clobbering live syntax diagnostics.

Source

pub fn diagnostic_counts(&self) -> DiagnosticCounts

Returns diagnostic severity counts.

Source

pub fn open_find(&self)

Opens the Find bar.

Source

pub fn open_replace(&self)

Opens the Find & Replace bar.

Source

pub fn fold_all(&self)

Collapses all foldable blocks.

Source

pub fn unfold_all(&self)

Expands all folded blocks.

Source

pub fn render_interactive(&self, options: &CodeEditorOptions) -> NodeBlueprint

Renders the complete interactive Monaco-class NodeBlueprint using options.

Source

pub fn render_view(&self, options: &CodeEditorOptions) -> View

Renders the interactive editor wrapped in a Strata View.

Trait Implementations§

Source§

impl Clone for CodeEditorHandle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CodeEditorHandle

Source§

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

Formats the value using the given formatter. Read more

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> IntoInitialState<T> for T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>