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

Preserve spacing before comments when alignment #518

Closed
IndrajeetPatil opened this issue Jun 10, 2019 · 2 comments
Closed

Preserve spacing before comments when alignment #518

IndrajeetPatil opened this issue Jun 10, 2019 · 2 comments

Comments

@IndrajeetPatil
Copy link
Collaborator

I used styler addins style active file option on an .Rmd file which formatted the following code chunk comments:

image

to the following style:

image

Just wanted to check with you if this is intended behavior according to the tidyverse style guide or an unintended side-effect?

I find the former formatting to be much legible than the latter, but not sure what the style guide has to say here.

@lorenzwalthert
Copy link
Collaborator

I am not sure I understand. If you refer to the styling regarding the spacing before #, I can say that we are working on this, see #258. You can always use strict = FALSE, which does not touch spaces if they are at least one around certain operators and comments:

styler::style_text("x   <- 1+ 1\nxyz <- 2", strict = FALSE)
#> x   <- 1 + 1
#> xyz <- 2

Created on 2019-06-10 by the reprex package (v0.2.1)

@IndrajeetPatil
Copy link
Collaborator Author

Yes, the spacing before # is what I was referring to!
Good to see this is something that you are already working on. I will close this issue in favor of #258 then.

@lorenzwalthert lorenzwalthert changed the title style guide for code chunk comments in R Markdown Preserve spacing before comments when alignment Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants