diff --git a/crates/tinymist/src/actor/typ_client.rs b/crates/tinymist/src/actor/typ_client.rs index 8649d74bc..2e0cc608f 100644 --- a/crates/tinymist/src/actor/typ_client.rs +++ b/crates/tinymist/src/actor/typ_client.rs @@ -41,7 +41,7 @@ use tinymist_query::{ use tinymist_world::{ typ_server::{ update_lock, CompilationHandle, CompileSnapshot, CompiledArtifact, Interrupt, - ProjectCompiler, ProjectHandle, ProjectInterrupt, SucceededArtifact, + ProjectCompiler, ProjectHandle, ProjectInterrupt, }, LspInterrupt, }; @@ -122,17 +122,6 @@ impl LocalCompileHandler { }) } - /// Get latest artifact the compiler thread for tasks - pub fn artifact(&self) -> ZResult { - // let (tx, rx) = oneshot::channel(); - // self.intr_tx - // .send(Interrupt::CurrentRead(tx)) - // .map_err(map_string_err("failed to send snapshot request"))?; - - // Ok(ArtifactSnap { rx }) - todo!() - } - pub fn flush_compile(&mut self) { // todo: better way to flush compile self.wrapper.process(ProjectInterrupt::Compile); @@ -310,11 +299,8 @@ impl ProjectHandle for LspProjectHandler { #[cfg(feature = "preview")] if let Some(inner) = self.inner.read().as_ref() { - let res = snap - .doc - .clone() - .map_err(|_| typst_preview::CompileStatus::CompileError); - inner.notify_compile(res, snap.signal.by_fs_events, snap.signal.by_entry_update); + let snap = snap.clone(); + inner.notify_compile(Arc::new(crate::tool::preview::PreviewCompileView { snap })); } } } @@ -334,26 +320,6 @@ pub struct CompileHandler { } impl CompileHandler { - /// Snapshot the compiler thread for tasks - pub fn snapshot(&self) -> ZResult { - let (tx, rx) = oneshot::channel(); - self.intr_tx - .send(Interrupt::SnapshotRead(tx)) - .map_err(map_string_err("failed to send snapshot request"))?; - - Ok(WorldSnapFut { rx }) - } - - /// Get latest artifact the compiler thread for tasks - pub fn artifact(&self) -> ZResult { - let (tx, rx) = oneshot::channel(); - self.intr_tx - .send(Interrupt::CurrentRead(tx)) - .map_err(map_string_err("failed to send snapshot request"))?; - - Ok(ArtifactSnap { rx }) - } - pub fn add_memory_changes(&self, event: MemoryEvent) { let _ = self.intr_tx.send(Interrupt::Memory(event)); } @@ -787,16 +753,3 @@ impl QuerySnap { Ok(f(&mut analysis)) } } - -pub struct ArtifactSnap { - rx: oneshot::Receiver>, -} - -impl ArtifactSnap { - /// Get latest artifact the compiler thread for tasks - pub async fn receive(self) -> ZResult> { - self.rx - .await - .map_err(map_string_err("failed to get snapshot")) - } -}