- Pass extension storage path to the server (client/ changes) so the
server can persist a workspace index.
- Introduce IndexCache (server/tools/index_cache.py) and load/save it on
initialization and after background indexing. Index entries are stored
only when the file's stat hasn't changed while being read.
- Add incremental reparse logic (server/tools/incremental_parse.py) and
use a per-file _last_parse cache in the language server to reparse only
the top-level Tcl commands touched by an edit, falling back to a full
parse when necessary.
- Use a new _FileIndex dataclass and _build_file_index helper to unify
what is stored/loaded for a file; update update_poco_completion_for_file
to use the persistent cache for disk-read files (from_disk/source_stat).
- Keep background indexing non-blocking and persist the index at the
end of the run. Add basic unit tests for incremental parse and index cache.
Before: edits and background work always required full parsing of files
and no persistent cross-restart index. After: some edits reuse previous
ASTs and files read from disk can use a persisted index to skip
re-indexing across restarts.
Introduce several changes to reduce full-document reparses, lock contention and
redundant work when handling TclOO analysis and navigation:
- Add a cheap may_contain_classes pre-check and several cursor/receiver
heuristics so completions, signature help and tcloo definitions skip the
expensive marker reparse when the document cannot contain useful OO info.
- Allow passing an existing parsed tree into tcloo completion/signature/definition
helpers; update callers to use the server's cached tree when available.
- Use a thread-local parser for request-time parse_source to avoid blocking the
shared parser during background indexing, and add navigation_state() which
returns cached definition identities (invalidated on index generation changes).
- Add a cheap name pre-filter (_may_resolve_to) for symbol matching and only
run class highlighting when classes may exist.
These changes reduce contention and repeated parsing, improve responsiveness for
requests during background indexing, and cache navigation definition identities.
Tests were added/updated to assert caching and non-blocking behavior.