pub struct TextModel { /* private fields */ }
Expand description
Models are a more abstract representation of files that can be “opened” (attached) to an editor.
Cloning this type is cheap to clone.
Implementations§
Source§impl TextModel
impl TextModel
Sourcepub fn on_did_change_content(
&self,
listener: impl FnMut(IModelContentChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelContentChangedEvent)>
pub fn on_did_change_content( &self, listener: impl FnMut(IModelContentChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelContentChangedEvent)>
An event emitted when the contents of the model have changed.
Sourcepub fn on_did_change_decorations(
&self,
listener: impl FnMut(JsValue) + 'static,
) -> DisposableClosure<dyn FnMut(JsValue)>
pub fn on_did_change_decorations( &self, listener: impl FnMut(JsValue) + 'static, ) -> DisposableClosure<dyn FnMut(JsValue)>
An event emitted when decorations of the model have changed.
Sourcepub fn on_did_change_language(
&self,
listener: impl FnMut(IModelLanguageChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelLanguageChangedEvent)>
pub fn on_did_change_language( &self, listener: impl FnMut(IModelLanguageChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelLanguageChangedEvent)>
An event emitted when the language associated with the model has changed.
Sourcepub fn on_did_change_language_configuration(
&self,
listener: impl FnMut(JsValue) + 'static,
) -> DisposableClosure<dyn FnMut(JsValue)>
pub fn on_did_change_language_configuration( &self, listener: impl FnMut(JsValue) + 'static, ) -> DisposableClosure<dyn FnMut(JsValue)>
An event emitted when the language configuration associated with the model has changed.
Sourcepub fn on_did_change_options(
&self,
listener: impl FnMut(IModelOptionsChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelOptionsChangedEvent)>
pub fn on_did_change_options( &self, listener: impl FnMut(IModelOptionsChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelOptionsChangedEvent)>
An event emitted when the model options have changed.
Sourcepub fn on_will_dispose(
&self,
listener: impl FnMut() + 'static,
) -> DisposableClosure<dyn FnMut()>
pub fn on_will_dispose( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>
An event emitted right before disposing the model.
Sourcepub fn create(
value: &str,
language: Option<&str>,
uri: Option<&Uri>,
) -> Result<Self, JsValue>
pub fn create( value: &str, language: Option<&str>, uri: Option<&Uri>, ) -> Result<Self, JsValue>
Create a new model.
Sourcepub fn get_or_create(
uri: &Uri,
value: &str,
language: Option<&str>,
) -> Result<Self, JsValue>
pub fn get_or_create( uri: &Uri, value: &str, language: Option<&str>, ) -> Result<Self, JsValue>
Get the model that has uri
if it exists or create a new one.
If the model exists the given value
and language
will be set on it.
Sourcepub fn get_language(&self) -> String
pub fn get_language(&self) -> String
Get the language for this model.
Sourcepub fn set_language(&self, language_id: &str)
pub fn set_language(&self, language_id: &str)
Change the language for this model.
Trait Implementations§
Source§impl AsRef<ITextModel> for TextModel
impl AsRef<ITextModel> for TextModel
Source§fn as_ref(&self) -> &ITextModel
fn as_ref(&self) -> &ITextModel
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl From<ITextModel> for TextModel
impl From<ITextModel> for TextModel
Source§fn from(js_model: ITextModel) -> Self
fn from(js_model: ITextModel) -> Self
Converts to this type from the input type.
impl Eq for TextModel
impl StructuralPartialEq for TextModel
Auto Trait Implementations§
impl Freeze for TextModel
impl RefUnwindSafe for TextModel
impl !Send for TextModel
impl !Sync for TextModel
impl Unpin for TextModel
impl UnwindSafe for TextModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.