You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let editor hosts validate one file without re-reading the whole space #183
validateFile reads and validates the whole space on every call. That fits the CLI, but editor hosts call it on every pause in typing, for the same space each time.
measured: validateResolvedFile (src/validate.ts:569) calls readSpace(context) and then validateNodes over every node, then filters the issues down to the one file.
measured: validateFile (src/validate.ts:605) builds a fresh SpaceContext per call, so nothing is reused across calls.
measured: the space is read from disk, so a host can't validate unsaved editor contents.
hypothesis: on a large space (thousands of notes) each validation takes long enough for the Obsidian plugin to lag visibly. Check by timing validateFile on a 5,000-note folder.
Options
A stateful session. The host creates it once per space, tells it which files changed (with optional in-memory contents), and asks for one file's issues. It re-reads only the changed files and reuses the parsed nodes and schema.
Reuse a read space. An option to pass an already-read readSpace result (or a cache object) into validateFile, so the host decides when to invalidate.
A cache inside core, keyed by file path and mtime. Hosts change nothing, but core takes on process-global state.
Leaning towards 1 or 2: the host already knows what changed (Obsidian's vault events), and core stays free of global state.
Graph-level checks (broken links, hierarchy, duplicates) still need the whole graph, so this is about not re-reading and re-parsing unchanged files, not about skipping cross-file validation.
Context
Raised by a review of the Obsidian plugin (mindsocket/obsidian-structured-context), which validates the active note after each debounced edit.
Activity