Skip to content

Doesn't handle curly-curly syntax well #534

Closed

Description

@Moohan

I have some code which uses the new Rlang curly curly syntax

if (drop) {
    data <- data %>%
      dplyr::select(-{{drop_var}})
  }

styler will split out all the curly braces

if (drop) {
  data <- data %>%
    dplyr::select(-{
      {
        chi_var
      }
    })
}

Activity

  1. lorenzwalthert commented on Jul 23, 2019

    @lorenzwalthert
    Collaborator

    Can you provide session information? Curly-curly syntax was only added in #528 and is not yet on CRAN. Running your example with the devel version from GitHub, I get the desired result:

    styler::style_text("if (drop) {
      data <- data %>%
        dplyr::select(-{{drop_var}})
    }")
    #> if (drop) {
    #>   data <- data %>%
    #>     dplyr::select(-{{ drop_var }})
    #> }

    Created on 2019-07-23 by the reprex package (v0.2.1)

  2. Moohan commented on Jul 23, 2019

    @Moohan
    Author

    That's the issue then! I'm running styler 1.1.1 from CRAN but if I get the dev version it seems to style as expected.

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