Commit 6052d46
authored
fix(lsp): update cached_versions on lockfile change (#38)
* feat(lsp): add lock file watcher infrastructure
Phase 1 of lock file watching implementation:
- Add `lockfile_filenames()` to Ecosystem trait for separation of concerns
- Add `get_for_lockfile()` and `all_lockfile_patterns()` to EcosystemRegistry
- Create `locate_lockfile_for_manifest()` helper in deps-core for DRY
- Add file_watcher module with LSP capability registration
- Register lock file watchers on server initialization
- Optimize PathBuf allocation in lockfile locator
Each ecosystem now declares its lock files:
- Cargo: Cargo.lock
- npm: package-lock.json
- PyPI: poetry.lock, uv.lock
* feat(lsp): add lock file change notification handler
Phase 2 of lock file watching:
- Implement did_change_watched_files() handler
- Detect ecosystem from lock file name
- Invalidate cache on lock file changes
- Log lock file change events for debugging
Phase 3 will add document update and UI refresh logic.
* feat(lsp): add document update on lock file changes
Phase 3 of lock file watching:
- Add handle_lockfile_change() to find affected manifests
- Reload lock file and update resolved_versions
- Publish diagnostics for all affected documents
- Request inlay hint refresh from client
Complete flow: lock file change → cache invalidate → reload →
update documents → refresh UI.
* fix(lsp): update cached_versions on lockfile change
Previously, only resolved_versions was updated when a lockfile changed,
causing inlay hints to only appear for dependencies that were visible
during the initial document load. Dependencies outside the viewport
would not show version hints after scrolling.
This fix ensures cached_versions is also updated, matching the pattern
already used in document_lifecycle.rs for document open/change events.
Adds unit test for update_cached_versions method.1 parent 22ce258 commit 6052d46
2 files changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
800 | 813 | | |
801 | 814 | | |
802 | 815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
0 commit comments