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

Function declarations #253

Closed
2 tasks
krlmlr opened this issue Oct 24, 2017 · 5 comments
Closed
2 tasks

Function declarations #253

krlmlr opened this issue Oct 24, 2017 · 5 comments

Comments

@krlmlr
Copy link
Member

krlmlr commented Oct 24, 2017

styler::style_text("function (a = 1,\nb = 2\n){\nNULL\n}", strict = FALSE, scope = "indention")
#> function (a = 1,
#>          b = 2
#>        ) {
#>   NULL
#> }
  • The b argument needs to be aligned with the opening paren
  • The closing paren and the opening brace should follow b = 2, or at least align with the opening paren
@lorenzwalthert
Copy link
Collaborator

Ok, I can do (1), so the reference for the indention level is ( and not function. However, I then suggest to add a rule in tidyverse_style that removes spaces after function too.

@krlmlr
Copy link
Member Author

krlmlr commented Oct 25, 2017

With strict = TRUE the space after function is removed already.

@lorenzwalthert
Copy link
Collaborator

So do you think we should still remove it with strict = FALSE then?

@krlmlr
Copy link
Member Author

krlmlr commented Oct 25, 2017

It's fine either way as long as the next line aligns with the opening paren.

@lorenzwalthert
Copy link
Collaborator

Ok, I think the problem is that strict that it affects so many aspects of the styling that we might want to add other arguments for granular user control at some point.

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

No branches or pull requests

2 participants