pub struct LanguageRegistry { /* private fields */ }Implementations§
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn syntactic_emphasis(
entry: Option<&LangEntry>,
file: &mut FileDiff,
mark_reformat_only: bool,
) -> bool
pub fn syntactic_emphasis( entry: Option<&LangEntry>, file: &mut FileDiff, mark_reformat_only: bool, ) -> bool
Set emphasis on file’s diff lines from an AST diff of both sides.
mark_reformat_only also flags paired lines that differ in layout
alone. Returns false when the file cannot be diffed this way, so the
caller falls back to the textual engine.
Source§impl LanguageRegistry
impl LanguageRegistry
pub fn build() -> Self
Sourcepub fn for_file(&self, path: &str, content: &str) -> Option<&LangEntry>
pub fn for_file(&self, path: &str, content: &str) -> Option<&LangEntry>
Self::for_path, then a naming convention, then the #! line.
pub fn by_name(&self, name: &str) -> Option<&LangEntry>
pub fn names(&self) -> Vec<&'static str>
Sourcepub fn for_token(&self, token: &str) -> Option<&LangEntry>
pub fn for_token(&self, token: &str) -> Option<&LangEntry>
A markdown fence token, by grammar name then extension.
pub fn config_for_injection( &self, lang: &str, ) -> Option<&HighlightConfiguration>
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn scope_index(&self, path: &str, content: &str) -> ScopeIndex
pub fn scope_index(&self, path: &str, content: &str) -> ScopeIndex
Empty when the file has no grammar or tags query, is too large, or fails to parse.
Sourcepub fn scope_index_as(entry: Option<&LangEntry>, content: &str) -> ScopeIndex
pub fn scope_index_as(entry: Option<&LangEntry>, content: &str) -> ScopeIndex
Self::scope_index with content parsed as entry’s language.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LanguageRegistry
impl RefUnwindSafe for LanguageRegistry
impl Send for LanguageRegistry
impl Sync for LanguageRegistry
impl Unpin for LanguageRegistry
impl UnsafeUnpin for LanguageRegistry
impl UnwindSafe for LanguageRegistry
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