pub struct TreeSitterProcessorConfig {
pub language: Language,
pub highlights_query: String,
pub folds_query: Option<String>,
pub capture_styles: BTreeMap<String, StyleId>,
pub style_layer: StyleLayerId,
pub preserve_collapsed_folds: bool,
}Expand description
Configuration for TreeSitterProcessor.
Fields§
§language: LanguageTree-sitter language.
highlights_query: StringSyntax highlighting query (.scm).
folds_query: Option<String>Optional folding query (.scm). Each capture becomes a fold candidate.
capture_styles: BTreeMap<String, StyleId>Mapping from capture name (e.g. "comment") to an editor-core StyleId.
style_layer: StyleLayerIdTarget style layer id to replace.
preserve_collapsed_folds: boolWhether to preserve the collapsed state for existing fold regions on replacement.
Implementations§
Source§impl TreeSitterProcessorConfig
impl TreeSitterProcessorConfig
Sourcepub fn new(language: Language, highlights_query: impl Into<String>) -> Self
pub fn new(language: Language, highlights_query: impl Into<String>) -> Self
Create a config with a language + highlights query.
By default:
style_layerisStyleLayerId::TREE_SITTERpreserve_collapsed_foldsistrue
Sourcepub fn with_folds_query(self, folds_query: impl Into<String>) -> Self
pub fn with_folds_query(self, folds_query: impl Into<String>) -> Self
Set a folding query.
Sourcepub fn with_default_rust_folds(self) -> Self
pub fn with_default_rust_folds(self) -> Self
A small fold query that works well for Rust-like curly-brace languages.
Sourcepub fn with_simple_capture_styles<const N: usize>(
self,
styles: [(&'static str, StyleId); N],
) -> Self
pub fn with_simple_capture_styles<const N: usize>( self, styles: [(&'static str, StyleId); N], ) -> Self
Add a set of capture name → style id mappings.
Sourcepub fn set_preserve_collapsed_folds(&mut self, preserve: bool)
pub fn set_preserve_collapsed_folds(&mut self, preserve: bool)
Control whether fold replacement preserves collapsed state.
Trait Implementations§
Source§impl Clone for TreeSitterProcessorConfig
impl Clone for TreeSitterProcessorConfig
Source§fn clone(&self) -> TreeSitterProcessorConfig
fn clone(&self) -> TreeSitterProcessorConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TreeSitterProcessorConfig
impl RefUnwindSafe for TreeSitterProcessorConfig
impl Send for TreeSitterProcessorConfig
impl Sync for TreeSitterProcessorConfig
impl Unpin for TreeSitterProcessorConfig
impl UnsafeUnpin for TreeSitterProcessorConfig
impl UnwindSafe for TreeSitterProcessorConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more