pub struct TreeSitterConfig {
pub wasm_path: PathBuf,
pub highlights_path: PathBuf,
pub folds_path: Option<PathBuf>,
pub indents_path: Option<PathBuf>,
pub tags_path: Option<PathBuf>,
pub injections_path: Option<PathBuf>,
}Expand description
File-based Tree-sitter configuration for one language.
This is intentionally UI-agnostic: it describes where the editor can load a Tree-sitter WASM grammar and related query files.
Fields§
§wasm_path: PathBufWASM grammar module (language.wasm).
highlights_path: PathBufSyntax highlighting query (highlights.scm).
folds_path: Option<PathBuf>Optional folding query (folds.scm).
indents_path: Option<PathBuf>Optional indentation query (indents.scm).
Optional tags query (tags.scm).
injections_path: Option<PathBuf>Optional injections query (injections.scm).
Implementations§
Source§impl TreeSitterConfig
impl TreeSitterConfig
Sourcepub fn new(wasm_path: PathBuf, highlights_path: PathBuf) -> Self
pub fn new(wasm_path: PathBuf, highlights_path: PathBuf) -> Self
Create a config from explicit paths.
Sourcepub fn from_language_dir(dir: &Path) -> Option<Self>
pub fn from_language_dir(dir: &Path) -> Option<Self>
Load a config by scanning a <language_id>/ directory for conventional filenames.
Required:
language.wasmhighlights.scm
Optional:
folds.scmindents.scmtags.scminjections.scm
Trait Implementations§
Source§impl Clone for TreeSitterConfig
impl Clone for TreeSitterConfig
Source§fn clone(&self) -> TreeSitterConfig
fn clone(&self) -> TreeSitterConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TreeSitterConfig
impl Debug for TreeSitterConfig
impl Eq for TreeSitterConfig
Source§impl PartialEq for TreeSitterConfig
impl PartialEq for TreeSitterConfig
Source§fn eq(&self, other: &TreeSitterConfig) -> bool
fn eq(&self, other: &TreeSitterConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TreeSitterConfig
Auto Trait Implementations§
impl Freeze for TreeSitterConfig
impl RefUnwindSafe for TreeSitterConfig
impl Send for TreeSitterConfig
impl Sync for TreeSitterConfig
impl Unpin for TreeSitterConfig
impl UnsafeUnpin for TreeSitterConfig
impl UnwindSafe for TreeSitterConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more