pub trait InputExtras: Default + 'static {
// Provided methods
fn decoration_layers(&self) -> Vec<&[TextDecoration]> { ... }
fn semantic_token_styles(
&self,
_text: &Rope,
_range: &Range<usize>,
_resolver: &dyn HighlightStyleResolver,
) -> Vec<(Range<usize>, HighlightStyle)> { ... }
fn document_color_swatches(
&self,
_text: &Rope,
_range: &Range<usize>,
) -> Vec<(Range<usize>, Hsla)> { ... }
fn hover_symbol_range(&self) -> Option<Range<usize>> { ... }
fn inline_completion_item(&self) -> Option<&InlineCompletionItem> { ... }
fn context_menu_capabilities(&self) -> (bool, bool) { ... }
}Expand description
What the renderer may read out of a mode’s extra state.
Kept apart from InputModeKind on purpose. This trait is data: the
renderer is generic over the mode, so it cannot name EditorExtras and
reach its fields directly, and these are the accessors it goes through
instead. Every one of them has an empty answer, which is what a plain input
and a textarea give.
InputModeKind is behavior: points where the engine hands control back
during an edit. Adding a field an editor renders belongs here and leaves
the engine’s callbacks alone.
Provided Methods§
Sourcefn decoration_layers(&self) -> Vec<&[TextDecoration]>
fn decoration_layers(&self) -> Vec<&[TextDecoration]>
Decoration ranges to paint, innermost collection first.
Sourcefn semantic_token_styles(
&self,
_text: &Rope,
_range: &Range<usize>,
_resolver: &dyn HighlightStyleResolver,
) -> Vec<(Range<usize>, HighlightStyle)>
fn semantic_token_styles( &self, _text: &Rope, _range: &Range<usize>, _resolver: &dyn HighlightStyleResolver, ) -> Vec<(Range<usize>, HighlightStyle)>
Semantic-token styles for a visible range, when an LSP supplies them.
Sourcefn document_color_swatches(
&self,
_text: &Rope,
_range: &Range<usize>,
) -> Vec<(Range<usize>, Hsla)>
fn document_color_swatches( &self, _text: &Rope, _range: &Range<usize>, ) -> Vec<(Range<usize>, Hsla)>
Document colours to paint as swatches, when an LSP supplies them.
Sourcefn hover_symbol_range(&self) -> Option<Range<usize>>
fn hover_symbol_range(&self) -> Option<Range<usize>>
The symbol range the hover popover is anchored to.
Sourcefn inline_completion_item(&self) -> Option<&InlineCompletionItem>
fn inline_completion_item(&self) -> Option<&InlineCompletionItem>
The inline completion to paint as ghost text.
What this mode can offer its context menu: go-to-definition, code actions.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
impl InputExtras for ()
A mode with nothing extra to render.
Implementors§
impl InputExtras for EditorExtras
What a code editor exposes to the renderer. See crate::input::InputExtras.