Skip to content

Always have a single space surrounding argument specification? #881

@IndrajeetPatil

Description

@IndrajeetPatil

observed

Here I am deliberately adding a single, double, or triple spaces surrounding the argument assignment (=), but, when styled, {styler} preserves these spaces.

styler::style_text(
  'df <- dplyr::rename(df,
  "xValues" =   "Time",
  "xUnit" = "TimeUnit",
  "yValues"   = "simulationValues",
  "yUnit" = "unit",
  "yDimension"  = "dimension"
)'
)
#> df <- dplyr::rename(df,
#>   "xValues" =   "Time",
#>   "xUnit" = "TimeUnit",
#>   "yValues"   = "simulationValues",
#>   "yUnit" = "unit",
#>   "yDimension"  = "dimension"
#> )

Created on 2021-12-23 by the reprex package (v2.0.1)

expected

I would have expected that it would instead always have a single space surrounding assignment. Can this be supported?

df <- dplyr::rename(df,
  "xValues" = "Time",
  "xUnit" = "TimeUnit",
  "yValues" = "simulationValues",
  "yUnit" = "unit",
  "yDimension" = "dimension"
)

No changes in case alignment is detected

Of course, the feature request is relevant only in case no alignment is detected, since then the spaces are deliberate and shouldn't be changed.

styler::style_text(
  'df <- dplyr::rename(df,
  "xValues"    = "Time",
  "xUnit"      = "TimeUnit",
  "yValues"    = "simulationValues",
  "yUnit"      = "unit",
  "yDimension" = "dimension"
)'
)
#> df <- dplyr::rename(df,
#>   "xValues"    = "Time",
#>   "xUnit"      = "TimeUnit",
#>   "yValues"    = "simulationValues",
#>   "yUnit"      = "unit",
#>   "yDimension" = "dimension"
#> )

Created on 2021-12-23 by the reprex package (v2.0.1)

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