SyntaxState

Struct SyntaxState 

Source
pub struct SyntaxState { /* private fields */ }
Expand description

Buffer level state for parsing and highlighting visible lines.

Implementations§

Source§

impl SyntaxState

Source

pub fn try_new(lang: &str, gb: &GapBuffer, cfg: &Config) -> Result<Self, String>

Source

pub fn prepare_insert_char(&mut self, idx: usize, ch: char, gb: &GapBuffer)

Source

pub fn prepare_insert_string(&mut self, idx: usize, s: &str, gb: &GapBuffer)

Source

pub fn prepare_delete_char(&mut self, idx: usize, gb: &GapBuffer)

Source

pub fn prepare_delete_range(&mut self, from: usize, to: usize, gb: &GapBuffer)

Source

pub fn apply_prepared_edit(&mut self, gb: &GapBuffer)

Mirror an edit that has been made to the underlying GapBuffer to the syntax state in order to keep syntax ranges in sync.

§Panics

This method will panic if the edit was not previously prepared using one of the prepare_* methods.

Source

pub fn update(&mut self, gb: &GapBuffer, from: usize, n_rows: usize)

Update internal state for the requested region to prepare for a call to Self::iter_tokenized_lines_from.

Source

pub fn iter_tokenized_lines_from<'a>( &'a self, line: usize, gb: &'a GapBuffer, dot_range: Range, load_exec_range: Option<(bool, Range)>, ) -> LineIter<'a>

Yield per-line RangeTokens for use in a UI impl to render the contents of the associated buffer.

Source

pub fn pretty_print_tree(&self) -> Option<String>

Return a string representation of the current syntax tree if possible

Trait Implementations§

Source§

impl Debug for SyntaxState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more