New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent indention for EQ_SUB #351

Closed
martin-mfg opened this Issue Feb 20, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@martin-mfg

martin-mfg commented Feb 20, 2018

The following code was styled using the latest development version of styler:

a_very_long_function_name <- function(parameter_name =
                                      "a very long default value") {
  NULL
}

a_very_long_function_name(
  parameter_name =
    "a very long default value"
)

What confuses me here is that in the function call, "a very long default value" is indented by 1 more level than parameter_name =, but in the function definition this is not the case.
I think there is no rule in the tidyverse style guide that governs this behaviour, so in my opinion it would be reasonable to apply the same indention strategy in both cases.

@lorenzwalthert

This comment has been minimized.

Show comment
Hide comment
@lorenzwalthert

lorenzwalthert Feb 20, 2018

Collaborator

Thanks @martin-mfg, this is indeed unexpected. I think I know where it stems from and I will look into it as soon as possible.

Collaborator

lorenzwalthert commented Feb 20, 2018

Thanks @martin-mfg, this is indeed unexpected. I think I know where it stems from and I will look into it as soon as possible.

@lorenzwalthert

This comment has been minimized.

Show comment
Hide comment
@lorenzwalthert

lorenzwalthert Feb 20, 2018

Collaborator

Blocked by #352.

Collaborator

lorenzwalthert commented Feb 20, 2018

Blocked by #352.

@lorenzwalthert lorenzwalthert changed the title from inconsistent indention for EQ_SUB to Inconsistent indention for EQ_SUB Feb 20, 2018

lorenzwalthert added a commit to lorenzwalthert/styler that referenced this issue Feb 22, 2018

EQ_FORMALS can cause indention in eq_sub()
needs_indention.*() takes an additional argument other_trigger_tokens which is used to determine whether a trigger causes indention. The new criteria is that (1) there is no multi-line token between the trigger and the first line break and (2) there is no other token between the potential trigger and the first line break that is going to cause indention. Aims to solve r-lib#352 and r-lib#351.
@lorenzwalthert

This comment has been minimized.

Show comment
Hide comment
@lorenzwalthert

lorenzwalthert Feb 28, 2018

Collaborator

Blocked by #357.

Collaborator

lorenzwalthert commented Feb 28, 2018

Blocked by #357.

@lorenzwalthert

This comment has been minimized.

Show comment
Hide comment
@lorenzwalthert

lorenzwalthert Mar 1, 2018

Collaborator

Closed with #353.

Collaborator

lorenzwalthert commented Mar 1, 2018

Closed with #353.

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