-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{styler} removed? #168
Comments
Hello, In a future realease, I want to integrate a feature to display history of code generated (so potentially more code), maybe I'll use {styler} then, it will be more robust than my current solution. Victor |
Thanks for the explanation. You are not the first to explore this problem unfortunately. A simple workaround to disable the prompt is to use a temporary cache location (instead of one persisting over multiple sessions) by setting an environment variable. It's described here: https://styler.r-lib.org/reference/caching.html#non-interactive-setup Bottom line for you: # temporary set env variable for call to styler.
withr::with_envvar(
R_CACHE_ROOTPATH = file.path(tempdir(), 'R.cache.esquisse'),
styler::style_text(...)
) Note that this does not add a new dependency to your probject because {withr} is already an indirect dependency (via {shiny} and other packages you import). Also, maybe once HenrikBengtsson/R.cache#43 is merged and CRAN-released, you could do this: # temporary set env variable for call to styler.
withr::with_envvar(
R_CACHE_ROOTPATH_ASK = FALSE
styler::style_text(...)
) If you want to use Garrick over tidyverse style, note that the {R.cache} behavior is the same, because Garrick provides only a style guide (=rules for styling), {styler} provides not just the tidyverse style guide but also the mechanism to format code according to arbitrary style guides. Happy to assist if you have further questions. |
See my HenrikBengtsson/R.cache#43 (comment) comment; per CRAN policies R.cache (>= 0.15.0) no longer have to ask for permission to create it's cache folders as long as they're in a standard location, so there should be no prompt. |
Thanks @HenrikBengtsson. I'll add a minimum version requirement for R.cache in r-lib/styler#819. @pvictor this means once this new styler version is released (assuming you want to add {styler} again), just require this minimal version and blocking prompt problem should be resolved. |
@pvictor {styler} 1.5.1 is released, where the minimal version requirement for {R.cache} is included, so you could just require |
@pvictor, as stated above, the problems related to {styler} are now resolved. Would you consider re-adding it? |
Thanks for the heads up @lorenzwalthert , I'll look into that |
Hi, thanks for this cool package. I saw you removed {styler} in 2f86db9.
environment variableR option? Then, people could either opt in or opt out of styling.The text was updated successfully, but these errors were encountered: