pub struct CodeEditor { /* private fields */ }Expand description
Native code editing surface with line numbers, indentation metadata, syntax-highlight preview and pluggable diagnostics.
The current MVP deliberately reuses Liora’s native Input editing core and
CodeBlock highlighter instead of embedding a Web editor runtime. Future
diagnostics providers can update set_diagnostics without changing the UI.
Implementations§
Source§impl CodeEditor
impl CodeEditor
pub fn new(value: impl Into<SharedString>, cx: &mut Context<'_, Self>) -> Self
pub fn entity(value: impl Into<SharedString>, cx: &mut App) -> Entity<Self>
pub fn value(&self, cx: &App) -> SharedString
pub fn set_value( &mut self, value: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
pub fn language(self, language: impl Into<CodeLanguage>) -> Self
pub fn set_language( &mut self, language: impl Into<CodeLanguage>, cx: &mut Context<'_, Self>, )
pub fn theme(self, theme: CodeTheme) -> Self
pub fn line_numbers(self, enabled: bool) -> Self
pub fn tab_size(self, size: usize) -> Self
pub fn soft_tabs(self, enabled: bool) -> Self
pub fn rows(self, rows: usize) -> Self
pub fn height(self, height: impl Into<Pixels>) -> Self
pub fn preview(self, preview: bool) -> Self
pub fn diagnostics( self, diagnostics: impl IntoIterator<Item = CodeDiagnostic>, ) -> Self
pub fn set_diagnostics( &mut self, diagnostics: impl IntoIterator<Item = CodeDiagnostic>, cx: &mut Context<'_, Self>, )
pub fn diagnostics_provider( self, provider: impl Fn(&str) -> Vec<CodeDiagnostic> + 'static, ) -> Self
pub fn set_diagnostics_provider( &mut self, provider: impl Fn(&str) -> Vec<CodeDiagnostic> + 'static, cx: &mut Context<'_, Self>, )
pub fn clear_diagnostics_provider(&mut self, cx: &mut Context<'_, Self>)
pub fn on_change( self, callback: impl Fn(&str, &mut Context<'_, CodeEditor>) + 'static, ) -> Self
pub fn set_on_change( &mut self, callback: impl Fn(&str, &mut Context<'_, CodeEditor>) + 'static, cx: &mut Context<'_, Self>, )
pub fn indent_unit(&self) -> String
pub fn register_key_bindings(cx: &mut App)
Trait Implementations§
Source§impl Focusable for CodeEditor
impl Focusable for CodeEditor
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for CodeEditor
impl Render for CodeEditor
Auto Trait Implementations§
impl !RefUnwindSafe for CodeEditor
impl !Send for CodeEditor
impl !Sync for CodeEditor
impl !UnwindSafe for CodeEditor
impl Freeze for CodeEditor
impl Unpin for CodeEditor
impl UnsafeUnpin for CodeEditor
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more