pub struct SyntaxGrepHighlighter { /* private fields */ }Expand description
Per-language grammar cache backing the grep preview highlighter.
None in the map means “this language has no registered grammar” —
cached so repeated hits in an unsupported file don’t re-probe the
registry. Wrapped in a Mutex because the trait is Sync and grep
runs are serial within a task but may overlap across runs.
Implementations§
Source§impl SyntaxGrepHighlighter
impl SyntaxGrepHighlighter
Sourcepub fn new() -> Arc<Self> ⓘ
pub fn new() -> Arc<Self> ⓘ
AH.1: takes no registry. It used to take the editor’s shared
Arc<LangRegistry> “so grep previews highlight with exactly the
grammars the buffers use” — which is what it stopped doing the moment
plugin languages existed.
LangRegistry::standard() is registry::live(): it returns a
SNAPSHOT of the process-global ArcSwap. A plugin’s grammar arrives
later via install_plugin_config, which RCUs a new registry in and
leaves every held Arc on the pre-plugin value. This highlighter was
built at boot, so its registry was bundled-only forever — every
preview of a .org hit (the org-roam node picker’s whole surface)
painted plain.
Trait Implementations§
Source§impl Default for SyntaxGrepHighlighter
impl Default for SyntaxGrepHighlighter
Source§impl GrepPreviewHighlighter for SyntaxGrepHighlighter
impl GrepPreviewHighlighter for SyntaxGrepHighlighter
Source§fn highlight_line(&self, path: &Path, line: &str) -> Vec<DisplaySpan>
fn highlight_line(&self, path: &Path, line: &str) -> Vec<DisplaySpan>
line as source for the file at path. line
is the exact text shown as the candidate display (already
trimmed), so returned spans are display-relative and need
no offset. Empty result ⇒ plain preview.Auto Trait Implementations§
impl !Freeze for SyntaxGrepHighlighter
impl RefUnwindSafe for SyntaxGrepHighlighter
impl Send for SyntaxGrepHighlighter
impl Sync for SyntaxGrepHighlighter
impl Unpin for SyntaxGrepHighlighter
impl UnsafeUnpin for SyntaxGrepHighlighter
impl UnwindSafe for SyntaxGrepHighlighter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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