pub struct GrammarLoader { /* private fields */ }Expand description
Dynamic grammar loader with caching.
Implementations§
Source§impl GrammarLoader
impl GrammarLoader
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new grammar loader with default search paths.
Search order:
MOSS_GRAMMAR_PATHenvironment variable (colon-separated)~/.config/moss/grammars/
Sourcepub fn with_paths(paths: Vec<PathBuf>) -> Self
pub fn with_paths(paths: Vec<PathBuf>) -> Self
Create a loader with custom search paths.
Sourcepub fn get(&self, name: &str) -> Option<Language>
pub fn get(&self, name: &str) -> Option<Language>
Get a grammar by name.
Returns None if grammar not found in search paths.
Sourcepub fn get_highlights(&self, name: &str) -> Option<Arc<String>>
pub fn get_highlights(&self, name: &str) -> Option<Arc<String>>
Get the highlight query for a grammar.
Returns None if no highlight query found for the grammar. Query files are {name}.highlights.scm in the grammar search paths.
Sourcepub fn get_injections(&self, name: &str) -> Option<Arc<String>>
pub fn get_injections(&self, name: &str) -> Option<Arc<String>>
Get the injection query for a grammar.
Returns None if no injection query found for the grammar. Query files are {name}.injections.scm in the grammar search paths.
Sourcepub fn available_external(&self) -> Vec<String>
pub fn available_external(&self) -> Vec<String>
List available grammars in search paths.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GrammarLoader
impl RefUnwindSafe for GrammarLoader
impl Send for GrammarLoader
impl Sync for GrammarLoader
impl Unpin for GrammarLoader
impl UnwindSafe for GrammarLoader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request