Repository navigation
fix: say how to set a CRAN mirror when jgd cannot be offered - #1993
Merged
renkun-ken merged 2 commits intoNov 29, 2026
Merged
Conversation
In `R/tool-library.R`, `tool_library_plan()` now tells users to set `options(repos = c(CRAN = "https://cloud.r-project.org"))` and restart the R terminal when `repos` is not a character vector. When no usable repositories remain after filtering, the error message now explains that `getOption("repos")` is empty or still contains only `"@cran@"`, notes that the installation prompt is not shown without a downloadable repository, and provides the same CRAN mirror configuration and restart guidance. In `R/tests/tool-library.R`, a test case is added to check that calling `tool_library_plan()` with `repos = c(CRAN = "@cran@")` raises an error mentioning both `"@cran@"` and `"https://cloud.r-project.org"`. Fixes REditorSupport#1929
renkun-ken
requested changes
Nov 29, 2026
renkun-ken
left a comment
Member
There was a problem hiding this comment.
I ran R/tests/tool-library.R and R/tests/tool-consent.R with R 4.6.1. Both passed.
Setting the option at the console does not survive the R terminal restart, so jgd setup sees @cran@ again. Both errors now say to add the line to the .Rprofile the project loads, and the test checks for it.
renkun-ken
approved these changes
Nov 29, 2026
renkun-ken
left a comment
Member
There was a problem hiding this comment.
Both error messages now tell users to save the mirror in the .Rprofile their project loads before restarting. I verified that a fresh R process using vscode-R’s startup profile picked up the mirror from the project .Rprofile. The regression test checks for that guidance, and the managed tool library and consent tests both passed locally on R 4.6.1. This resolves my earlier finding.
Contributor
Author
|
@renkun-ken thanks for merging this. The jgd setup error now tells people how to set a CRAN mirror in their .Rprofile. |
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.
Motivation
When
jgdis missing and the R session has no usable package repository configured (for example, when CRAN is still set to the"@CRAN@"placeholder), vscode-R skips the installation prompt and falls back to the standard plot viewer. The setup error only states that no usable package repository is configured, without explaining that this prevents the installation prompt from appearing or how to configure a CRAN mirror.tool_library_plan()inR/tool-library.Rrejects non-characterreposvalues and filters outNA, empty strings, and"@CRAN@", stopping before an installation plan can be built when no repositories remain. Bothstop()calls previously returned generic messages that did not mention the"@CRAN@"placeholder, the suppressed prompt, or theoptions(repos = ...)setting needed to resolve the issue.Summary
In
R/tool-library.R,tool_library_plan()now tells users to setoptions(repos = c(CRAN = "https://cloud.r-project.org"))and restart the R terminal whenreposis not a character vector. When no usable repositories remain after filtering, the error message now explains thatgetOption("repos")is empty or still contains only"@CRAN@", notes that the installation prompt is not shown without a downloadable repository, and provides the same CRAN mirror configuration and restart guidance.In
R/tests/tool-library.R, a test case is added to check that callingtool_library_plan()withrepos = c(CRAN = "@CRAN@")raises an error mentioning both"@CRAN@"and"https://cloud.r-project.org".Testing
Ran
pnpm run format:checklocally on macOS for the vscode-R change; it passed.pnpm run format:checkpassed across all 233 matched files.pnpm run format:r:checkran and reported no formatting issues.pnpm run lint:rran and reported no lint issues.lintr::lint_dir("./R")ran and reported no lint findings.lintr::lint_package("sess")ran and reported no lint findings.pnpm run lintran and reported no lint issues. Ranpnpm run format:checkin a Linux container (localhost/osc-linux-node:22) for the vscode-R change; it passed.The tests in
R/tests/tool-library.Rfail without the fix in the vscode-R change (checked by reverting the source changes). The changed test R/tests/tool-library.R did not run here: no test runner for it was available.Closes #1929