Skip to content

Don't force line break removal after opening paren in function call if next token is a comment #171

Closed

Description

@lorenzwalthert

That should not happen.

cat(styler::style_text(c(
  "list( ", 
  "#", 
  "comment", 
  ")"
)), sep = "\n")
#> list( #
#>   comment
#> )

Activity

  1. krlmlr commented on Aug 30, 2017

    @krlmlr
    Member

    But this looks fine to me, comment seems to be an argument to list() also in the original code. What have I missed?

  2. changed the title [-]Don't force line break after opening paren in function call if next token in a comment[/-] [+]Don't force line break removal after opening paren in function call if next token in a comment[/+] on Aug 30, 2017
  3. changed the title [-]Don't force line break removal after opening paren in function call if next token in a comment[/-] [+]Don't force line break removal after opening paren in function call if next token is a comment[/+] on Aug 30, 2017
  4. lorenzwalthert commented on Aug 30, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Just updated the example and title...

  5. tjmahr commented on Sep 5, 2017

    @tjmahr

    I tried the package today. Is this issue the same as the following example? (The issue being that moving a comment from its own line to trailing is not a good change.)

    lines <-
      "model <- lm(
      # this is the formula
      y ~ x,
      data = data.frame(x = rnorm(10), y = rnorm(10))
    )
    "
    cat(lines)
    #> model <- lm(
    #>   # this is the formula
    #>   y ~ x,
    #>   data = data.frame(x = rnorm(10), y = rnorm(10))
    #> )
    
    cat(paste0(styler::style_text(lines), collapse = "\n"))
    #> model <- lm( # this is the formula
    #>   y ~ x,
    #>   data = data.frame(x = rnorm(10), y = rnorm(10))
    #> )
  6. lorenzwalthert commented on Sep 5, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Right. I think that's exactly this case. Thanks @tjmahr. #172 just needs a few tweaks before merging. Afterwards, it should work. Try to finish asap.

  7. added this to the milestone on Sep 6, 2017
  8. lorenzwalthert commented on Sep 8, 2017

    @lorenzwalthert
    CollaboratorAuthor

    @tjmahr Hope you've noticed that this issue is closed as #172 was merged into master.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions