pub struct TreeSitterRegistry {
pub extension_map: TreeSitterExtensionMap,
pub languages: TreeSitterConfigMap,
}Expand description
Combined Tree-sitter registry used by the UI layer and FFI boundary.
Fields§
§extension_map: TreeSitterExtensionMapMapping from extension → language id.
languages: TreeSitterConfigMapMapping from language id → file-based config.
Implementations§
Source§impl TreeSitterRegistry
impl TreeSitterRegistry
Sourcepub fn from_json_str(json: &str) -> Result<Self, TreeSitterRegistryError>
pub fn from_json_str(json: &str) -> Result<Self, TreeSitterRegistryError>
Parse a schema-versioned Tree-sitter registry JSON string.
The registry supports:
- absolute paths
- or relative paths resolved against
root_dir
Sourcepub fn language_id_for_path<'a>(&'a self, path: &Path) -> Option<&'a str>
pub fn language_id_for_path<'a>(&'a self, path: &Path) -> Option<&'a str>
Return the configured language id for a file path, based on its extension.
Sourcepub fn scan_language_configs(
root_dir: &Path,
) -> Result<TreeSitterConfigMap, TreeSitterRegistryError>
pub fn scan_language_configs( root_dir: &Path, ) -> Result<TreeSitterConfigMap, TreeSitterRegistryError>
Scan a treesitter/ root directory and return a language_id -> config map.
This is useful for hosts that follow the conventional on-disk layout:
treesitter/
rust/
language.wasm
highlights.scmTrait Implementations§
Source§impl Clone for TreeSitterRegistry
impl Clone for TreeSitterRegistry
Source§fn clone(&self) -> TreeSitterRegistry
fn clone(&self) -> TreeSitterRegistry
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 TreeSitterRegistry
impl Debug for TreeSitterRegistry
Source§impl Default for TreeSitterRegistry
impl Default for TreeSitterRegistry
Source§fn default() -> TreeSitterRegistry
fn default() -> TreeSitterRegistry
Returns the “default value” for a type. Read more
impl Eq for TreeSitterRegistry
Source§impl PartialEq for TreeSitterRegistry
impl PartialEq for TreeSitterRegistry
Source§fn eq(&self, other: &TreeSitterRegistry) -> bool
fn eq(&self, other: &TreeSitterRegistry) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TreeSitterRegistry
Auto Trait Implementations§
impl Freeze for TreeSitterRegistry
impl RefUnwindSafe for TreeSitterRegistry
impl Send for TreeSitterRegistry
impl Sync for TreeSitterRegistry
impl Unpin for TreeSitterRegistry
impl UnsafeUnpin for TreeSitterRegistry
impl UnwindSafe for TreeSitterRegistry
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