Skip to content

Resolve symbols from attached and imported packages#1258

Open
lionel- wants to merge 3 commits into
oak/salsa-19-find-refs-rename-migrationfrom
oak/salsa-20-package-layers
Open

Resolve symbols from attached and imported packages#1258
lionel- wants to merge 3 commits into
oak/salsa-19-find-refs-rename-migrationfrom
oak/salsa-20-package-layers

Conversation

@lionel-
Copy link
Copy Markdown
Contributor

@lionel- lionel- commented Jun 5, 2026

Branched from #1257
Progress towards #1212

  • File::resolve() and resolve_at() now handle the Package (NAMESPACE import()) and From (importFrom()) import layers (previously only File layers were walked; the rest were dropped).

  • Package::resolve() answers "is this name exported by this package?" by walking the package's files and collecting their exports. It provides a lazy / post-load view of package exports. For instance it returns two definitions when a top-level stub is overwritten in the .onLoad() hook via <<-.

  • Package::files are now stored in collation order, which simplifies downstream calls that need to respect R's load order.

File::imports() and Package::resolve() are both used in File::resolve() / File::resolve_at(), which themselves support goto-def, find-refs, and rename.

With these changes, when a workspace contains both scripts and a package, you can now use goto-def, find-refs, and rename with symbols imported via library().

goto-def will also work with installed packages when oak_sources is wired up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant