Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

styler does not remove space after $ #1245

Closed
stibu81 opened this issue Dec 6, 2024 · 1 comment · Fixed by #1246
Closed

styler does not remove space after $ #1245

stibu81 opened this issue Dec 6, 2024 · 1 comment · Fixed by #1246

Comments

@stibu81
Copy link

stibu81 commented Dec 6, 2024

styler removes spaces before $ but not after:

library(styler)

# OK
style_text("mtcars $disp")
#> mtcars$disp

# Not OK
style_text("mtcars$ disp")
#> mtcars$ disp
style_text("mtcars $ disp")
#> mtcars$ disp

Created on 2024-12-06 with reprex v2.1.1

According to section 2.2.4 of the tidyverse style guide, $ "should never be surrounded by spaces":

There are a few exceptions, which should never be surrounded by spaces:

  • The operators with high precedence: ::, :::, $, @, [, [[, ^, unary -, unary +, and :.

I used styler 1.10.3.9000, 2f1cc9b.

@stibu81
Copy link
Author

stibu81 commented Dec 8, 2024

Works now as expected, thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant