Finish off WorldState::root and WorldState::library removal! #1306
Open
DavisVaughan wants to merge 3 commits into
Open
Finish off WorldState::root and WorldState::library removal! #1306DavisVaughan wants to merge 3 commits into
WorldState::root and WorldState::library removal! #1306DavisVaughan wants to merge 3 commits into
Conversation
- `oak_db::Package` now has a `depends()` query and an `index()` (for `INDEX`) query - Diagnostics now look at `file.package()` for namespace imports - Diagnostics now use the new `package.index()` in `insert_package_exports()` to layer in the documented dataset symbols (that was our stopgap to avoid false positives) - roxygen2 completions were tweaked again to directly use the `OakDatabase` rather than the old `oak_semantic::Library` - `WorldState` drops `root` and `library` fields, yay! - `oak_semantic` drops `library.rs` and `package.rs`, both of which were "old style" features that we now access through `OakDatabase` directly - `temp_palmerpenguin()` moved to `oak_package_metadata` since `oak_semantic::package.rs` is gone now
In theory the following can happen: - We scan the user's library - We run diagnostics and trigger an `index()` load - The user does `install.packages()` and overwrites the package we loaded the index for We don't currently watch the installed package library, but we plan to! So no need to do this wrong to begin with.
DavisVaughan
commented
Jun 30, 2026
Comment on lines
+89
to
+93
| // When you're actively working on roxygen2 itself, pull the tags from `inst/` | ||
| let tags = match root.kind(db) { | ||
| RootKind::Workspace => dir.join("inst").join("roxygen2-tags.yml"), | ||
| RootKind::Library => dir.join("roxygen2-tags.yml"), | ||
| }; |
Contributor
Author
There was a problem hiding this comment.
A neat little change
Comment on lines
-60
to
-65
| /// The root of the source tree (e.g., a package). | ||
| pub(crate) root: Option<SourceRoot>, | ||
|
|
||
| /// Map of package name to package metadata and package sources for installed | ||
| /// libraries. Lazily populated. | ||
| pub(crate) library: Library, |
Comment on lines
+151
to
+159
| /// The package's `Depends:`, parsed lazily from `DESCRIPTION`. `None` when the file | ||
| /// is missing. Narrow query over [`Package::description`], same backdating story as | ||
| /// [`Package::version`]. | ||
| #[salsa::tracked(returns(ref))] | ||
| pub fn depends(self, db: &dyn Db) -> Option<Vec<String>> { | ||
| self.description(db) | ||
| .as_ref() | ||
| .map(|description| description.depends.clone()) | ||
| } |
Comment on lines
+203
to
+210
| /// The package's parsed `INDEX` | ||
| /// | ||
| /// Returns `None` for workspace packages, which never have an `INDEX`. | ||
| /// | ||
| /// Returns an empty `Index` for installed packages with missing or unreadable | ||
| /// indexes. | ||
| #[salsa::tracked(returns(ref))] | ||
| pub fn index(self, db: &dyn Db) -> Option<Index> { |
Contributor
Author
There was a problem hiding this comment.
New query + index_revision field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleans up a loooooooot of outdated things now that Salsa is pretty well integrated and fully featured
Support:
oak_db::Packagenow has adepends()query (DESCRIPTIONDepends:) and anindex()query (forINDEX). This also requires anindex_revisionfield onPackage, which I thought we could avoid, but the 2nd commit shows that we cannot.Tweaks:
file.package()for namespace imports instead of the oldSourceRootpackage.index()ininsert_package_exports()to layer in the documented dataset symbols (that was our stopgap to avoid false positives)OakDatabaserather than the oldoak_semantic::Librarytemp_palmerpenguin()moved tooak_package_metadatasinceoak_semantic::package.rsis gone now. It is still useful for a test.Removed:
WorldStatedropsrootandlibraryfields, yay!oak_semanticdropslibrary.rsandpackage.rs, both of which were "old style" features that we now access throughOakDatabasedirectly