Skip to content

[SR-11823] swift-format: add option to leave intra-expression spacing as is #339

@swift-ci

Description

@swift-ci
Previous ID SR-11823
Radar None
Original Reporter gwk (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Improvement
Assignee None
Priority Medium

md5: dd4f120aec6465bd8fc4e18cfdcd6098

Issue Description:

I just tried swift-format for the first time. I am quite pleased with the results, but there are two cases that I wish I could disable to preserve existing spacing:

  • Multiple spaces following commas between items in a list. For example I have a vertical list of (X,Y,Z) vectors and I have added spacing to make the columns line up. More generally, this can be helpful for visually verifying grid-like patterns in code.
  • Lack of spaces in between operators, e.g. `a*x + b`.

I realize that the project must strike a balance between convention and configuration. Regardless of how the developers feel about these style choices, I hope that you will consider this request on the basis of reducing barriers to entry. If it weren't for these points, then adding swift-format to my workflow would be an obvious improvement. As it is, I feel like I am making a compromise. In any case, thank you for your great work!

Activity

transferred this issue fromswiftlang/swifton May 9, 2022
ahoppen

ahoppen commented on Apr 23, 2024

@ahoppen
Member

Tracked in Apple’s issue tracker as rdar://126948241

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ahoppen@swift-ci

        Issue actions

          [SR-11823] swift-format: add option to leave intra-expression spacing as is · Issue #339 · swiftlang/swift-format