Commit 5bcdce8
authored
feat(lsp): incremental version fetching - avoid unnecessary refetches (#47)
* feat(lsp): preserve version cache on document updates
Phase 1 of incremental version fetching. Instead of discarding cached
version data on every document change, preserve cached_versions and
resolved_versions from the previous document state.
This prevents unnecessary re-fetching of all package versions when
a user makes small edits (e.g., updating a single dependency version
via code action).
Adds preserve_cache helper and 3 tests:
- test_preserve_cached_versions_on_change
- test_first_open_has_empty_cache
- test_preserve_cache_on_parse_failure
* feat(lsp): add dependency diff detection for incremental fetching
Phase 2 of incremental version fetching. Computes diff between old and
new dependency sets, only fetching versions for newly added deps.
Changes:
- Add DependencyDiff struct with HashSet-based diff computation
- Extract old dep names before parsing, new after parsing
- Skip registry fetch entirely if no new dependencies added
- Merge new versions into cache instead of replacing
- Fix resolved versions to merge instead of overwrite cached versions
Adds 4 diff detection tests covering:
- Addition detection
- Removal detection
- No changes
- Empty to new transition
* feat(lsp): prune stale cache entries for removed dependencies
Phase 3 of incremental version fetching. When a dependency is removed
from the manifest, its cached version data is now cleaned up instead
of accumulating indefinitely.
This prevents memory growth in long-running LSP sessions with frequent
manifest edits.
Adds test: test_cache_pruned_on_dependency_removal1 parent 06bc52d commit 5bcdce8
1 file changed
+419
-35
lines changed
0 commit comments