Expand description
Walking a directory tree for .bynk files and reading them — the driver’s
side of CompileOptions.sources (#1077, R2.3/T0.7 residue).
The real CLI entry points (project_options/try_project_options below)
now walk and read every file up front, via this module, and hand the
result to CompileOptions::sources.
#1077 review: this module’s own original doc claimed the CLI path was
already fully independent of bynk-emit’s disk reads — false as written.
project_options/try_project_options still read bynk.toml itself via
read_project_paths/try_read_project_paths, which reach
discovery::read_source’s overlay-miss fallback (fs::read_to_string)
with an always-empty overlay — one real disk read inside bynk-emit on
every real CLI invocation, unnoticed because fs_below_driver scans
bynk-emit’s own text, not who calls into it. Both entry points now read
bynk.toml themselves (manifest_overlay) and hand it to
try_read_project_paths_with’s overlay instead, so that read genuinely
moves above bynk-emit when bynk.toml exists. A conventional
project with no manifest at all still reaches try_read_project_paths_with
with an empty overlay, which still tries (and fails to find) bynk.toml
via read_source’s own fs::read_to_string before falling back to
ProjectPaths::conventional — a real, if harmless (the read fails and is
discarded), disk touch still inside bynk-emit for that case.
bynk-emit’s own on-disk discovery (project::discover_bynk_files) and
read_source’s overlay-miss fallback are not removed, and can’t be
yet: analyse_project_with (the LSP’s own analysis path,
bynk-emit/src/project.rs) hardcodes discovered: None and passes an
overlay that deliberately covers only open editor buffers — it depends on
that exact fallback to see every other project file, including its own
bynk.toml read (AnalysisRoots::lower, bynk-ide/src/lib.rs, has the
same gap this module just closed for the CLI, unclosed). #1079’s issue
text scopes only bynk-ide’s completion.rs/symbols.rs — it does not
mention analyse_project_with or the diagnose_project(&root, &HashMap::new()) pattern that is bynk-ide’s (and bynkc’s test suite’s)
dominant way of exercising this whole analysis path (100+ call sites
spanning bynk-ide’s own inline test modules, bynk-lsp/tests, and
bynkc/tests) — every one depends on read_source’s fallback today.
Closing discovery.rs for good needs all of that migrated first, which is
bigger than either #1077 or #1079’s issue text currently describes; #1077
stays open pending that combined, design-reviewed effort. fs_below_driver
does not move for bynk-emit from this module alone.
Structs§
- Discovery
Error - An I/O failure while walking a project tree for
.bynkfiles, or reading one found there.
Functions§
- read_
bynk_ tree - Walk
rootfor every.bynkfile (skippingexcludesand hidden directories, mirroringbynk-emit’s formerdiscover_bynk_filesexactly) and read each one’s content. Keys are the same literal (non-canonicalised) path shape a plain recursive walk produces —CompileOptions.sources’s own contract, and whatread_source’s overlay lookup tries first. - read_
bynk_ tree_ single read_bynk_treewith no excludes — the common case for a single-root project (CompileOptions::single, whose ownRoots::excludes()is always empty) and for test fixtures, which rarely declare anexcludelist.- read_
bynk_ tree_ split read_bynk_treemerged across every one of a split project’sincluderoots, matchingRoots::trees’ shape — the primary root’spaths.exclude(plus the tool’s ownout/node_modulescaches) applies to all of them.- sources_
for_ roots - The complete
CompileOptions.sourcesmap for a project rooted atroots.