Skip to main content

spawn_scan_view_scan

Function spawn_scan_view_scan 

Source
pub fn spawn_scan_view_scan(
    view: BufferId,
    options: ScanViewOptions,
    sources: Vec<Arc<dyn ScannedExcerptSource>>,
    mb_registry: MultibufferRegistryHandle,
    events: Option<Arc<EventBus>>,
    services: Option<Arc<ServiceRegistry>>,
)
Expand description

Run the scan off-thread and populate view.

Shape, and why:

  • The ignore::Walk and every read_to_string run under spawn_blocking. The editor actor is a current_thread runtime, so a bare tokio::spawn would land the whole walk on the actor thread — paramount goal #1’s forbidden pattern.
  • The guest scan calls are awaited on the async runtime between those hops, because a wasmtime async call must not be made from a blocking task.
  • A file no source claims is never read. The extension test happens before the read, so an agenda over a Rust checkout costs a directory walk and nothing else.
  • The append publishes MultibufferExcerptsReady — the registered off-keystroke wake. Without it the rows would sit invisible until the user pressed a key, which reads as a rendering fault and is not one.

pub for the same reason search::spawn_scan_task is: OM.A3’s gr handler respawns without going back through the trigger, and the throughput bench drives it without an activator.