Skip to content

Commit

Permalink
dev: delete the unneeded artifact methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Jan 13, 2025
1 parent 17aeb93 commit 5f1a10d
Showing 1 changed file with 3 additions and 50 deletions.
53 changes: 3 additions & 50 deletions crates/tinymist/src/actor/typ_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -122,17 +122,6 @@ impl LocalCompileHandler {
})
}

/// Get latest artifact the compiler thread for tasks
pub fn artifact(&self) -> ZResult<ArtifactSnap> {
// 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);
Expand Down Expand Up @@ -310,11 +299,8 @@ impl ProjectHandle<LspCompilerFeat, ProjectExt> 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 }));
}
}
}
Expand All @@ -334,26 +320,6 @@ pub struct CompileHandler {
}

impl CompileHandler {
/// Snapshot the compiler thread for tasks
pub fn snapshot(&self) -> ZResult<WorldSnapFut> {
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<ArtifactSnap> {
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));
}
Expand Down Expand Up @@ -787,16 +753,3 @@ impl QuerySnap {
Ok(f(&mut analysis))
}
}

pub struct ArtifactSnap {
rx: oneshot::Receiver<SucceededArtifact<LspCompilerFeat>>,
}

impl ArtifactSnap {
/// Get latest artifact the compiler thread for tasks
pub async fn receive(self) -> ZResult<SucceededArtifact<LspCompilerFeat>> {
self.rx
.await
.map_err(map_string_err("failed to get snapshot"))
}
}

0 comments on commit 5f1a10d

Please sign in to comment.