Skip to main content

LanguageRegistry

Struct LanguageRegistry 

Source
pub struct LanguageRegistry { /* private fields */ }

Implementations§

Source§

impl LanguageRegistry

Source

pub fn line_emphasis( &self, path: &str, old_src: &str, new_src: &str, ) -> Option<(Vec<Vec<Range<usize>>>, Vec<Vec<Range<usize>>>)>

Per-line emphasis byte ranges for both sides, from an AST diff of the full old/new content. None (caller falls back to the textual engine) when the language is unsupported, content is too large, parsing fails, or the diff exceeds its graph budget.

Source

pub fn syntactic_emphasis(&self, file: &mut FileDiff) -> bool

Set char-precise emphasis on file’s diff lines from the AST diff. Returns false when the syntactic engine is unavailable, so the caller can fall back to the textual engine.

Source§

impl LanguageRegistry

Source

pub fn build() -> Self

Build the registry with every bundled grammar, reused for the session.

Source

pub fn for_path(&self, path: &str) -> Option<&LangEntry>

The entry whose grammar handles path, keyed by file extension.

Source§

impl LanguageRegistry

Source

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 — callers then show no breadcrumb.

Trait Implementations§

Source§

impl Default for LanguageRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.