Skip to content
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

R6 methods don't allow double-indented formals? #1136

Open
MichaelChirico opened this issue Jul 13, 2023 · 3 comments · May be fixed by #1137
Open

R6 methods don't allow double-indented formals? #1136

MichaelChirico opened this issue Jul 13, 2023 · 3 comments · May be fixed by #1137

Comments

@MichaelChirico
Copy link
Contributor

MichaelChirico commented Jul 13, 2023

The following should be allowed (ref: https://style.tidyverse.org/functions.html#long-lines-1 doesn't mention R6):

R6Class("MyClass",
  public = list(
    param = NULL,
    initialize = function(
        my_long_parameter = getOption("default_long_parameter", 1)) {
      self$param <- my_long_parameter
    }
  )
)

But it's currently re-styled (style_text() output):

R6Class("MyClass",
  public = list(
    param = NULL,
    initialize = function(my_long_parameter = getOption("default_long_parameter", 1)) {
      self$param <- my_long_parameter
    }
  )
)

Which of course creates an over-full line.

@lorenzwalthert

This comment was marked as outdated.

@MichaelChirico

This comment was marked as resolved.

@lorenzwalthert
Copy link
Collaborator

Seems like detection of double indention is based on the absolute indention of the formals, instead of the relative...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants