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

Issue with indentation when formatting functions in list #6

Open
ColinFay opened this issue Mar 7, 2022 · 1 comment
Open

Issue with indentation when formatting functions in list #6

ColinFay opened this issue Mar 7, 2022 · 1 comment

Comments

@ColinFay
Copy link
Contributor

ColinFay commented Mar 7, 2022

Given the following code:

xyz <- R6::R6Class(
  "xyz",
  public = list(
    initialize = function(
        aaa = "xyz", 
        bbb = "abcd"
    ) {
      print("hey")
    }
  )
)

It gets formatted as :

xyz <- R6::R6Class(
  "xyz",
  public = list(
    initialize = function(
  aaa = "xyz", # <- there should be 6 spaces here
  bbb = "abcd" # <- there should be 6 spaces here
    ) {
      print("hey")
    }
  )
)

Smaller reprex is

xyz <- list(
    a = function(
        a = 12, 
        b = 12
    ){
        print(a)
    }
)

which gets formatted :

xyz <- list(
  a = function(
  a = 12,
  b = 12
  ) {
    print(a)
  }
)
@gadenbuie
Copy link
Owner

@ColinFay thanks for the report! Are you also struggling with RStudio adding 4 spaces instead of 2 for function arguments on a new line? I just opened an issue for that here: rstudio/rstudio#10752

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

No branches or pull requests

2 participants