Closed nickhir closed 4 weeks ago
library(styler)
style_text(
"{ x <- 1}",
transformers = tidyverse_style(indent_by = 2L)
)
#> {
#> x <- 1
#> }
style_text(
"{ x <- 1}",
transformers = tidyverse_style(indent_by = 4L)
)
#> {
#> x <- 1
#> }
Created on 2024-06-25 with reprex v2.1.0
Thank you for your quick answer! Could you also elaborate, how I can make sure that the add in (Style active file
) uses the "new" style (i.e. the one with 4 whitespaces)?
You need to use the following option to change addin behaviour:
options(addins_style_transformer = "styler::tidyverse_style(indent_by = 4L)")
If this is in the context of a project, you could also put this in .Rprofile
.
Unfortunatly, that did not seem to work... I have a small gif showing it.
Ah, I forgot to include styler.
:
options(styler.addins_style_transformer = "styler::tidyverse_style(indent_by = 4L)")
All of this is documented here: https://styler.r-lib.org/dev/reference/styler_addins.html
Hello,
I am trying to change the default indentation from 2 spaces to 4 spaces, however I am unable to find an option for this. The solution outlined here does not seem to work anymore.
Any help is much appreciated!