Skip to main content

LexBuiltinsHandler

Struct LexBuiltinsHandler 

Source
pub struct LexBuiltinsHandler { /* private fields */ }
Expand description

Composite handler for the lex.* built-in namespace.

Registry::register_namespace accepts one handler per namespace; the composite shape lets every lex.* built-in live under a single namespace registration while keeping per-label logic isolated. The doc.* family is registered separately with DocBuiltinsHandler — see register_into.

Implementations across hooks (one per lifecycle phase):

  • on_resolve: only LexIncludeHandler (#532). lex.tabular.* and lex.media.* migrated off on_resolve in #615 — verbatim hydration belongs on the IR-construction lifecycle, not the AST-substitution lifecycle.
  • on_ir_build: lex.tabular.table (verbatim body → typed WireNode::Table) and lex.media.{image,video,audio} (params → typed WireNode::Image|Video|Audio). #615 unified surface.
  • on_format: lex.tabular.table and lex.media.{image,video,audio} round-trip back to :: lex.<family>.<kind> :: Lex source. (#570 Phase 4b.)

Implementations§

Source§

impl LexBuiltinsHandler

Source

pub fn new(loader: Arc<dyn Loader + Send + Sync>, config: ResolveConfig) -> Self

Trait Implementations§

Source§

impl LexHandler for LexBuiltinsHandler

Source§

fn on_format( &self, ctx: &FormatCtx, ) -> Result<Option<LexAnnotationOut>, HandlerError>

Phase 4b of #570: emit the canonical Lex-source shape for the built-in lex.tabular.* and lex.media.* labels.

The verbatim labels round-trip as :: lex.<family>.<kind> :: closers with the body text and parameters carried verbatim from the supplied WireNode::Verbatim. Anything else (e.g. lex.include, metadata labels, unrecognised labels) returns Ok(None) so the host falls back to its built-in formatter.

Source§

fn on_resolve(&self, ctx: &LabelCtx) -> Result<Option<WireNode>, HandlerError>

Returns an AST replacement subtree, which the host splices into the parent in place of the labelled node. Fires during the resolve phase, before analyse. Ok(None) leaves the original node in place. Read more
Source§

fn on_ir_build(&self, ctx: &LabelCtx) -> Result<Option<WireNode>, HandlerError>

Returns a typed wire node consumed by the host while building its in-memory IR from the parsed source. Fires during IR construction (from_lex), strictly after parsing and strictly before render. Ok(None) falls back to the host’s generic verbatim/annotation IR. Read more
Source§

fn on_label(&self, _ctx: &LabelCtx)

Informational notification fired during the analyse phase. No response is expected. Use this for handlers that maintain external state (caches, indices, link graphs).
Source§

fn on_validate(&self, _ctx: &LabelCtx) -> Result<Vec<Diagnostic>, HandlerError>

Returns diagnostics for a labelled node. Fires during analyse, after resolve.
Source§

fn on_render( &self, _ctx: &LabelCtx, _fmt: Format, ) -> Result<Option<RenderOut>, HandlerError>

Returns the labelled node’s representation in a target format. Fires during lexd convert or library-driven rendering. Ok(None) falls back to default rendering of the underlying node.
Source§

fn on_hover(&self, _ctx: &LabelCtx) -> Result<Option<Hover>, HandlerError>

Returns hover content for a labelled node. Fires in response to textDocument/hover LSP requests.
Source§

fn on_completion( &self, _ctx: &LabelCtx, ) -> Result<Vec<Completion>, HandlerError>

Returns completion items for a position inside a labelled node’s params or body. Fires in response to textDocument/completion.
Source§

fn on_code_action( &self, _ctx: &LabelCtx, ) -> Result<Vec<CodeAction>, HandlerError>

Returns code actions for a labelled node. Fires in response to textDocument/codeAction.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more