Skip to content
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

Use styler instead of formatR? #1516

Closed
krlmlr opened this issue Feb 23, 2018 · 2 comments
Closed

Use styler instead of formatR? #1516

krlmlr opened this issue Feb 23, 2018 · 2 comments
Milestone

Comments

@krlmlr
Copy link
Contributor

krlmlr commented Feb 23, 2018

We're about to submit an update for styler to CRAN, this would be a good point to use styler in addition to/instead of formatR for styling code chunks. What's the best way to proceed, would you like to review a PR?

CC @lorenzwalthert.

@yihui
Copy link
Owner

yihui commented Feb 23, 2018

Yes, PR please:

knitr/R/block.R

Lines 148 to 154 in 1e9a4d5

res = try_silent(do.call(
formatR::tidy_source, c(list(text = code, output = FALSE), options$tidy.opts)
))
if (!inherits(res, 'try-error')) {
code = res$text.tidy
} else warning('failed to tidy R code in chunk <', options$label, '>\n',
'reason: ', res)

A chunk option like tidy.method = 'styler' should be good (defaults to formatR).

@yihui yihui added this to the v1.21 milestone Aug 10, 2018
@yihui yihui closed this as completed in 01407a7 Aug 10, 2018
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants