Skip to content

Do not put spaces inside the {{ operator. - #140

Closed
gvwilson wants to merge 1 commit into
tidyverse:masterfrom
gvwilson:139-spacing-double-curly-braces
Closed

gvwilson wants to merge 1 commit into
tidyverse:masterfrom
gvwilson:139-spacing-double-curly-braces

Conversation

@gvwilson

@gvwilson gvwilson commented Aug 7, 2019

Copy link
Copy Markdown

Closes #139.

@hadley

hadley commented Aug 7, 2019

Copy link
Copy Markdown
Member

I think our convention is to put spaces.

@gvwilson

gvwilson commented Aug 7, 2019

Copy link
Copy Markdown
Author

cc @batpigandme - the example in https://www.tidyverse.org/articles/2019/06/rlang-0-4-0/ has the spaces, but following up the Slack discussion thread, this is inconsistent with how we treat (...) and [...]. If the call is to include spaces, I'll amend the PR and point out the difference.

@lionel-

lionel- commented Sep 26, 2019

Copy link
Copy Markdown
Member

FWIW, I still think using spaces is the preferred style. From Slack:

Oh did you mean the groupings outside {{ Jim? Then I agree, but it's part of the point, I think. When you look at the function from far away (look at its type color, in typographical terms), the other syntactical units are less prominent and you sort of see holes in the function where {{ was used. I think that makes it easy to see at a first glance (a) which arguments of the function are quoted, and (b) what are the varying parts in the code.

That said, the style I initially chosen for !! and !!! had too much spacing, and was eventually changed. So please don't take the introductory blog post as the definite truth about how to style {{.

@lorenzwalthert

Copy link
Copy Markdown
Contributor

I plan to release styler v1.2 soon, mainly because of styling around curly-curly, because the current CRAN release formats it like this:

styler::style_text("call({{ x }})")
#> call({
#>   {
#>     x
#>   }
#> })

Created on 2019-10-13 by the reprex package (v0.3.0)

And this is really unpleasing and may make people turn away from styler. I implemented spacing in r-lib/styler#528 to the best of my knowledge as {{ x }}. If consensus on that should change, I'd (unhapply) adopt to another way of formatting it.

@lorenzwalthert lorenzwalthert mentioned this pull request Oct 13, 2019
9 of 17 tasks
@hadley hadley closed this in e4dc94a Apr 20, 2020
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

Successfully merging this pull request may close these issues.

Add spacing for {{ var }} (embracing) style

4 participants