pub trait InputExtras: Default + 'static {
Show 16 methods
// Provided methods
fn decoration_layers(&self) -> Vec<&[TextDecoration]> { ... }
fn decorations_revision(&self) -> u64 { ... }
fn range_decorations(
&self,
_ranges: &[Range<usize>],
) -> Vec<&RangeDecoration> { ... }
fn gutter_decorations_width(&self) -> Option<Pixels> { ... }
fn gutter_decorations(&self, _range: Range<usize>) -> Vec<&GutterDecoration> { ... }
fn overview_ruler_decorations(&self) -> Vec<&OverviewRulerDecoration> { ... }
fn overview_ruler_revision(&self) -> u64 { ... }
fn line_decorations(
&self,
_rows: Range<usize>,
_cx: &App,
) -> Vec<LineDecoration> { ... }
fn has_line_decorations(&self) -> bool { ... }
fn has_gutter_icons(&self) -> bool { ... }
fn spacer_provider(&self) -> Option<Rc<dyn SpacerProvider>> { ... }
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
gives; a textarea answers only Self::decoration_layers.
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 decorations_revision(&self) -> u64
fn decorations_revision(&self) -> u64
Changes whenever Self::decoration_layers are set again. Edits that only move
their ranges leave it as it is.
Sourcefn range_decorations(&self, _ranges: &[Range<usize>]) -> Vec<&RangeDecoration>
fn range_decorations(&self, _ranges: &[Range<usize>]) -> Vec<&RangeDecoration>
Geometric decorations intersecting visible, non-folded buffer spans.
Sourcefn gutter_decorations_width(&self) -> Option<Pixels>
fn gutter_decorations_width(&self) -> Option<Pixels>
Return the gutter decoration strip width, or None when no gutter
collection exists.
Sourcefn gutter_decorations(&self, _range: Range<usize>) -> Vec<&GutterDecoration>
fn gutter_decorations(&self, _range: Range<usize>) -> Vec<&GutterDecoration>
Return the gutter decorations that touch a UTF-8 byte range, in paint order. An empty decoration touches the range when it lies inside it.
Sourcefn overview_ruler_decorations(&self) -> Vec<&OverviewRulerDecoration>
fn overview_ruler_decorations(&self) -> Vec<&OverviewRulerDecoration>
Return all overview ruler decorations in paint order.
Sourcefn overview_ruler_revision(&self) -> u64
fn overview_ruler_revision(&self) -> u64
A number that changes whenever an overview ruler collection is created, replaced, extended, cleared or released.
Sourcefn line_decorations(
&self,
_rows: Range<usize>,
_cx: &App,
) -> Vec<LineDecoration>
fn line_decorations( &self, _rows: Range<usize>, _cx: &App, ) -> Vec<LineDecoration>
Line decorations for the visible buffer rows, in collection order.
Sourcefn has_line_decorations(&self) -> bool
fn has_line_decorations(&self) -> bool
Whether any line decoration collection has a provider.
Sourcefn has_gutter_icons(&self) -> bool
fn has_gutter_icons(&self) -> bool
Whether any line decoration collection’s provider has gutter icons.
Sourcefn spacer_provider(&self) -> Option<Rc<dyn SpacerProvider>>
fn spacer_provider(&self) -> Option<Rc<dyn SpacerProvider>>
The provider of the spacers, if one is set.
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.