pub trait SyntaxHighlighter {
// Required method
fn highlight_line<'a>(&self, line: &'a str, spans: &mut Vec<Span<'a>>);
// Provided method
fn highlight_segment<'a>(&self, text: &'a str, spans: &mut Vec<Span<'a>>) { ... }
}Expand description
Trait for language-specific syntax highlighting.
Implement this for your language (SQL, JSON, YAML, etc.) and pass it to the
render module. See PlainHighlighter for a no-op reference implementation.
Required Methods§
Provided Methods§
Sourcefn highlight_segment<'a>(&self, text: &'a str, spans: &mut Vec<Span<'a>>)
fn highlight_segment<'a>(&self, text: &'a str, spans: &mut Vec<Span<'a>>)
Highlight a segment of a line (used when part of the line has visual selection).
Defaults to highlight_line.