Skip to content

Treat all documented names as known symbols#883

Merged
lionel- merged 7 commits intomainfrom
feature/static-imports-datasets
Jul 29, 2025
Merged

Treat all documented names as known symbols#883
lionel- merged 7 commits intomainfrom
feature/static-imports-datasets

Conversation

@lionel-
Copy link
Contributor

@lionel- lionel- commented Jul 29, 2025

Branched from #872.

Progress towards posit-dev/positron#8521
Addresses posit-dev/positron#8708

This adds all symbol-looking documentation topics to our set of known exported symbols to cover exported datasets. This information is installed in an INDEX file that we can inspect statically: https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#The-INDEX-file-1. This INDEX file might be manually written by the package author (see link above), and so might throw off our attempts at parsing this unstructured file. That said I expect it's automatically generated in the vast majority of cases

This stopgap approach will potentially produce false negatives:

  • Documented topics are not necessarily about exported symbols.
  • This approach will indistinctly export datasets whether LazyData is true or false. In the false case, the dataset is only exported after a corresponding data() call.

For now though, we prefer to avoid false positives and spurious diagnostics.

QA Notes

In a fresh session with:

# `LazyData: true` case
penguins # Not in scope
library(palmerpenguins)
penguins

# `LazyData: false` case
liner # Not in scope
library(BCA1SG)
liner # FIXME: Should not be in scope
data(liner)
liner

You should only see diagnostics before the library() calls:

Screenshot 2025-07-29 at 16 40 02

@lionel- lionel- requested a review from DavisVaughan July 29, 2025 14:41
@DavisVaughan
Copy link
Contributor

Reviewed together over zed

@lionel- lionel- force-pushed the feature/static-imports-package branch from 1d47d9f to a974de9 Compare July 29, 2025 17:12
Base automatically changed from feature/static-imports-package to main July 29, 2025 17:13
@lionel- lionel- force-pushed the feature/static-imports-datasets branch from 37f7c6e to e31cd00 Compare July 29, 2025 17:14
@lionel- lionel- merged commit 4c3db88 into main Jul 29, 2025
6 checks passed
@lionel- lionel- deleted the feature/static-imports-datasets branch July 29, 2025 17:14
@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants