pub struct LanguageRegistry { /* private fields */ }Implementations§
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn syntactic_emphasis(
&self,
file: &mut FileDiff,
mark_reformat_only: bool,
) -> bool
pub fn syntactic_emphasis( &self, file: &mut FileDiff, mark_reformat_only: bool, ) -> bool
Set char-precise emphasis on file’s diff lines from the AST diff.
mark_reformat_only additionally flags a paired deleted/added line the
AST diff found no structural difference on at all (a pure reformat)
for the structural algorithm’s dimmed rendering. Returns false when
the syntactic engine is unavailable, so the caller can fall back to
the textual engine (and structural mode silently reads as a plain
histogram diff for that file).
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn for_path(&self, path: &str) -> Option<&LangEntry>
pub fn for_path(&self, path: &str) -> Option<&LangEntry>
The entry whose grammar handles path, by extension or, for the files
a build tool names outright (Makefile, Dockerfile), by basename.
Sourcepub fn for_token(&self, token: &str) -> Option<&LangEntry>
pub fn for_token(&self, token: &str) -> Option<&LangEntry>
The entry for a markdown fence token (rust, py, c++, …), matched
by grammar name then extension.
Sourcepub fn config_for_injection(
&self,
lang: &str,
) -> Option<&HighlightConfiguration>
pub fn config_for_injection( &self, lang: &str, ) -> Option<&HighlightConfiguration>
Highlight config for a tree-sitter injection language name (the inline
markdown grammar, or a fenced code block’s language). None leaves the
injected region plain.
Sourcepub fn markdown_inline_spans(
&self,
content: &str,
) -> Vec<(Range<usize>, &'static str)>
pub fn markdown_inline_spans( &self, content: &str, ) -> Vec<(Range<usize>, &'static str)>
Inline markdown captures (emphasis, code spans, links) as byte range plus
the recognized highlight name, narrowest span first so a first-match
renderer picks the most specific. The inline grammar parses only the
block grammar’s (inline) node ranges, so block markers stay untouched.
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
Parse content and index its definition spans for scope lookup. Returns
an empty index when the language is unsupported, has no tags query, the
file is too large, or parsing fails, so callers show no breadcrumb.
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn symbols(&self, path: &str, content: &str) -> (Vec<Ident>, ScopeIndex)
pub fn symbols(&self, path: &str, content: &str) -> (Vec<Ident>, ScopeIndex)
Every identifier in content, top to bottom, and its definition
spans, from one parse. A file with no grammar, or too large to parse,
falls back to plain words and no definitions; those words include the
ones inside strings and comments.