pub struct LspFormattingOptions {
pub tab_size: u32,
pub insert_spaces: bool,
}Expand description
LSP integration types and traits for editor clients. LSP integration types and traits for editor clients. LSP integration types and traits for editor clients. Formatting options sent with a document-formatting request.
Mirrors the two fields of LSP’s FormattingOptions that every server
requires. Build one from the editor’s own indentation setting with the
From<IndentStyle> implementation rather than hardcoding values, so the
server formats the way the editor indents.
§Example
use iced_code_editor::{IndentStyle, LspFormattingOptions};
let options = LspFormattingOptions::from(IndentStyle::Spaces(2));
assert_eq!(options.tab_size, 2);
assert!(options.insert_spaces);Fields§
§tab_size: u32Number of columns a single indentation level spans.
insert_spaces: booltrue to indent with spaces, false to indent with tab characters.
Trait Implementations§
Source§impl Clone for LspFormattingOptions
impl Clone for LspFormattingOptions
impl Copy for LspFormattingOptions
Source§impl Debug for LspFormattingOptions
impl Debug for LspFormattingOptions
impl Eq for LspFormattingOptions
Source§impl From<IndentStyle> for LspFormattingOptions
impl From<IndentStyle> for LspFormattingOptions
Source§fn from(style: IndentStyle) -> Self
fn from(style: IndentStyle) -> Self
Derives formatting options from the editor’s indentation style.
IndentStyle::Tab reports the editor’s own rendered tab width, which
is what the server needs to lay out alignment inside a tab-indented
file. A zero-width spaces style — which no built-in preset produces —
is raised to 1, since tabSize: 0 is not a value any server can act on.
§Example
use iced_code_editor::{IndentStyle, LspFormattingOptions};
let options = LspFormattingOptions::from(IndentStyle::Tab);
assert!(!options.insert_spaces);Source§impl PartialEq for LspFormattingOptions
impl PartialEq for LspFormattingOptions
impl StructuralPartialEq for LspFormattingOptions
Auto Trait Implementations§
impl Forget for LspFormattingOptions
impl Freeze for LspFormattingOptions
impl Move for LspFormattingOptions
impl RefUnwindSafe for LspFormattingOptions
impl Send for LspFormattingOptions
impl Sync for LspFormattingOptions
impl Unpin for LspFormattingOptions
impl UnsafeUnpin for LspFormattingOptions
impl UnwindSafe for LspFormattingOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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§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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.