Skip to content

Function declarations #253

Closed
Closed

Description

@krlmlr
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

Activity

  1. lorenzwalthert commented on Oct 25, 2017

    @lorenzwalthert
    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.

  2. krlmlr commented on Oct 25, 2017

    @krlmlr
    MemberAuthor

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

  3. lorenzwalthert commented on Oct 25, 2017

    @lorenzwalthert
    Collaborator

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

  4. krlmlr commented on Oct 25, 2017

    @krlmlr
    MemberAuthor

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

  5. lorenzwalthert commented on Oct 25, 2017

    @lorenzwalthert
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions