-
Notifications
You must be signed in to change notification settings - Fork 71
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
Question: How to customise styler so that line break before ) {
in function definitions?
#1130
Comments
I can’t tell you on top of my head but you should find the answer if you look at the docs. In particular https://styler.r-lib.org/articles/customizing_styler.html |
I recently tried this on this particular use case. I ended up with the following script: https://rpubs.com/krlmlr/styler-resp . I do prefer x <- function(
a,
b
) {
} over x <- function(
a,
b) {
} . This is also what the codegrip package emits -- a huge time saver. However, https://style.tidyverse.org/functions.html#long-lines-1 mandates the last form. This is unfortunate. Because styler is about non-invasive pretty-printing, we should support keeping the first form. @lorenzwalthert: How do you feel about this, at least for Upstream: tidyverse/style#202. |
Can you elaborate why? Maybe time is also an argument in the tidyverse style guide? I think we should implement the style guide but for |
I chose to tweak codegrip instead: https://github.com/lionel-/codegrip/pull/16. |
Ok, also fine. |
But this does not help me as a lonely VSCode user... |
Sorry I can't support this in {styler}. It's not compliant with the tidyverse style guide... |
I understand - but Is there any styler option which makes this possible, as it states "styler formats your code according to the tidyverse style guide (or your custom style guide)" on https://styler.r-lib.org? |
Not with |
@rkrug: See #1130 (comment). |
Assume I have the following function definition, formatted in VS Code using the tidy verse styler:
I would prefer to have the following:
How can I modify the
tidyverse_style()
so that it is formatted as I would like to have it, i.e. have a line break in front of the) {
, unless it is in the same line as the(
in the function definition?Thanks,
Rainer
The text was updated successfully, but these errors were encountered: