From af7fe4d76083c597ec2198a73383b9e3899d75ea Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 17 Mar 2023 16:27:40 +0100 Subject: Hover and autocomplete in show rules --- src/lib.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 7cfed897..9dbaf721 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,14 +63,15 @@ use crate::syntax::{Source, SourceId}; use crate::util::Buffer; /// Compile a source file into a fully layouted document. -pub fn compile(world: &(dyn World + 'static), source: &Source) -> SourceResult { +pub fn compile(world: &(dyn World + 'static)) -> SourceResult { // Evaluate the source file into a module. let route = Route::default(); let mut tracer = Tracer::default(); - let module = eval::eval(world.track(), route.track(), tracer.track_mut(), source)?; + let module = + eval::eval(world.track(), route.track(), tracer.track_mut(), world.main())?; // Typeset the module's contents. - model::typeset(world.track(), &module.content()) + model::typeset(world.track(), tracer.track_mut(), &module.content()) } /// The environment in which typesetting occurs. @@ -86,6 +87,15 @@ pub trait World { /// The standard library. fn library(&self) -> &Prehashed; + /// The main source file. + fn main(&self) -> &Source; + + /// Try to resolve the unique id of a source file. + fn resolve(&self, path: &Path) -> FileResult; + + /// Access a source file by id. + fn source(&self, id: SourceId) -> &Source; + /// Metadata about all known fonts. fn book(&self) -> &Prehashed; @@ -94,10 +104,4 @@ pub trait World { /// Try to access a file at a path. fn file(&self, path: &Path) -> FileResult; - - /// Try to resolve the unique id of a source file. - fn resolve(&self, path: &Path) -> FileResult; - - /// Access a source file by id. - fn source(&self, id: SourceId) -> &Source; } -- cgit v1.2.3