Skip to main content

InputExtras

Trait InputExtras 

Source
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§

Source

fn decoration_layers(&self) -> Vec<&[TextDecoration]>

Decoration ranges to paint, innermost collection first.

Source

fn decorations_revision(&self) -> u64

Changes whenever Self::decoration_layers are set again. Edits that only move their ranges leave it as it is.

Source

fn range_decorations(&self, _ranges: &[Range<usize>]) -> Vec<&RangeDecoration>

Geometric decorations intersecting visible, non-folded buffer spans.

Source

fn gutter_decorations_width(&self) -> Option<Pixels>

Return the gutter decoration strip width, or None when no gutter collection exists.

Source

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.

Source

fn overview_ruler_decorations(&self) -> Vec<&OverviewRulerDecoration>

Return all overview ruler decorations in paint order.

Source

fn overview_ruler_revision(&self) -> u64

A number that changes whenever an overview ruler collection is created, replaced, extended, cleared or released.

Source

fn line_decorations( &self, _rows: Range<usize>, _cx: &App, ) -> Vec<LineDecoration>

Line decorations for the visible buffer rows, in collection order.

Source

fn has_line_decorations(&self) -> bool

Whether any line decoration collection has a provider.

Source

fn has_gutter_icons(&self) -> bool

Whether any line decoration collection’s provider has gutter icons.

Source

fn spacer_provider(&self) -> Option<Rc<dyn SpacerProvider>>

The provider of the spacers, if one is set.

Source

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.

Source

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.

Source

fn hover_symbol_range(&self) -> Option<Range<usize>>

The symbol range the hover popover is anchored to.

Source

fn inline_completion_item(&self) -> Option<&InlineCompletionItem>

The inline completion to paint as ghost text.

Source

fn context_menu_capabilities(&self) -> (bool, bool)

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§

Source§

impl InputExtras for ()

A mode with nothing extra to render.

Implementors§

Source§

impl InputExtras for EditorExtras

What a code editor exposes to the renderer. See crate::input::InputExtras.

Source§

impl InputExtras for TextareaExtras