pub struct SyntaxState { /* private fields */ }Expand description
Buffer level state for parsing and highlighting visible lines.
Implementations§
Source§impl SyntaxState
impl SyntaxState
pub fn try_new(lang: &str, gb: &GapBuffer, cfg: &Config) -> Result<Self, String>
pub fn prepare_insert_char(&mut self, idx: usize, ch: char, gb: &GapBuffer)
pub fn prepare_insert_string(&mut self, idx: usize, s: &str, gb: &GapBuffer)
pub fn prepare_delete_char(&mut self, idx: usize, gb: &GapBuffer)
pub fn prepare_delete_range(&mut self, from: usize, to: usize, gb: &GapBuffer)
Sourcepub fn apply_prepared_edit(&mut self, gb: &GapBuffer)
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.
Sourcepub fn update(&mut self, gb: &GapBuffer, from: usize, n_rows: usize)
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.
Sourcepub fn iter_tokenized_lines_from<'a>(
&'a self,
line: usize,
gb: &'a GapBuffer,
dot_range: Range,
load_exec_range: Option<(bool, Range)>,
) -> LineIter<'a> ⓘ
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.
Sourcepub fn pretty_print_tree(&self) -> Option<String>
pub fn pretty_print_tree(&self) -> Option<String>
Return a string representation of the current syntax tree if possible
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SyntaxState
impl RefUnwindSafe for SyntaxState
impl Send for SyntaxState
impl Sync for SyntaxState
impl Unpin for SyntaxState
impl UnwindSafe for SyntaxState
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more