Skip to content

spacing around tilde #315

Closed
Closed

Description

@lorenzwalthert

I think styler should make sure there is at least one space around the tilde operator.

library(styler)
style_text("lm(a~b, data = x)")
#> lm(a~b, data = x)
style_text("lm(a~b, data = x)")
#> lm(a~b, data = x)
style_text("map2(
  x, y,~lines[seq2(.x + 1, .y - 1)]
)")
#> map2(
#>   x, y, ~lines[seq2(.x + 1, .y - 1)]
#> )

Created on 2018-01-06 by the reprex
package
(v0.1.1.9000).

Activity

  1. lorenzwalthert commented on Jan 8, 2018

    @lorenzwalthert
    CollaboratorAuthor

    @krlmlr do you agree on adding a space around ~? I think it's not covered in the tidyverse style guide because it's not particularly relevant since lazy evaluation is mostly substituted with tidyeval in many places these days. Or should we request to extend the examples in the style guide?

  2. krlmlr commented on Jan 14, 2018

    @krlmlr
    Member

    Thanks, missed that. How do we treat formulas without LHS?

  3. lorenzwalthert commented on Jan 15, 2018

    @lorenzwalthert
    CollaboratorAuthor

    I'd suggest we don't add a space on the left hand side as it's currently implemented.

    styler::style_text("(~k)")
    #> (~ k)

    Created on 2018-01-15 by the reprex package (v0.1.1.9000).

  4. added a commit that references this issue on Mar 13, 2018
  5. krlmlr commented on Mar 21, 2018

    @krlmlr
    Member

    Reopening, because we're not covering rhs-only formulas yet (also in the tests).

  6. reopened this on Mar 21, 2018
  7. lorenzwalthert commented on Mar 23, 2018

    @lorenzwalthert
    CollaboratorAuthor

    Reference: tidyverse/dplyr@0818cab#r28070282 in file data-raw/band_members.R

  8. krlmlr commented on Apr 15, 2018

    @krlmlr
    Member

    Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions