Skip to content

Set options lazily and conditionally#1123

Open
lionel- wants to merge 5 commits intomainfrom
feature/shiny-browser-option
Open

Set options lazily and conditionally#1123
lionel- wants to merge 5 commits intomainfrom
feature/shiny-browser-option

Conversation

@lionel-
Copy link
Contributor

@lionel- lionel- commented Mar 21, 2026

Addresses posit-dev/positron#8450

Set our options after the user R profiles have been sourced, and only if the options haven't been set by the user already. We detect user overrides in one of two ways:

  • If R sets the option to a non-null value by default, we require the user to wrap the option in AsIs, which we take as a sign it was overridden in the Rprofile.

  • For all other options, if we see a non-null value it means it was overridden.

I've taken the opportunity to consolidate all options settings in one place (the lazily invoked init function), and document our overrides in doc/configuration.md.

To launch Shiny applications in the system browser you need the following configuration:

options(
  browser = I(Sys.getenv("R_BROWSER")),
  shiny.launch.browser = TRUE
)

An alternative to this approach is to recommend using the new hook that @jennybc is implementing in #1088. The approach implemented in this PR has the advantage that the user configuration also works in the R cli without any duplication.

@lionel- lionel- requested review from jennybc and juliasilge March 21, 2026 10:35
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