mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Deduplicate watcher update call (#5955)
This commit is contained in:
parent
acd3a5b7a5
commit
f31c971624
@ -55,11 +55,11 @@ pub fn watch(timer: &mut Timer, command: &WatchCommand) -> StrResult<()> {
|
|||||||
// Perform initial compilation.
|
// Perform initial compilation.
|
||||||
timer.record(&mut world, |world| compile_once(world, &mut config))??;
|
timer.record(&mut world, |world| compile_once(world, &mut config))??;
|
||||||
|
|
||||||
// Watch all dependencies of the initial compilation.
|
|
||||||
watcher.update(world.dependencies())?;
|
|
||||||
|
|
||||||
// Recompile whenever something relevant happens.
|
// Recompile whenever something relevant happens.
|
||||||
loop {
|
loop {
|
||||||
|
// Watch all dependencies of the most recent compilation.
|
||||||
|
watcher.update(world.dependencies())?;
|
||||||
|
|
||||||
// Wait until anything relevant happens.
|
// Wait until anything relevant happens.
|
||||||
watcher.wait()?;
|
watcher.wait()?;
|
||||||
|
|
||||||
@ -71,9 +71,6 @@ pub fn watch(timer: &mut Timer, command: &WatchCommand) -> StrResult<()> {
|
|||||||
|
|
||||||
// Evict the cache.
|
// Evict the cache.
|
||||||
comemo::evict(10);
|
comemo::evict(10);
|
||||||
|
|
||||||
// Adjust the file watching.
|
|
||||||
watcher.update(world.dependencies())?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user