Swiftformat: `indent` rule also indents `where` clause

Created on 12 Aug 2020  路  1Comment  路  Source: nicklockwood/SwiftFormat

The Google style guide shows the where clause in a multi-line class declaration to be indented at the same level as the class itself. However, in the following example I've noticed that it's not the case.

Test example:

class MyContainer<BaseCollection>:
    MyContainerSuperclass,
    MyContainerProtocol
where BaseCollection: Collection {
    doSomething()
}

Command run:

$ Pods/SwiftFormat/CommandLineTool/swiftformat test.swift --rules indent --indent 4

I'd expect the output to remain the same as the input. Instead, it gives me the following:

class MyContainer<BaseCollection>:
    MyContainerSuperclass,
    MyContainerProtocol
    where BaseCollection: Collection {
    doSomething()
}

Is this a bug or should I be incorporating a separate rule in conjunction with indent to prevent this?

enhancement

Most helpful comment

@meherkasam following the Google style guide is not a specific goal of this project. I do try to accommodate all reasonable styles, and this seems like a reasonable rule, so I'll consider it as a feature request.

>All comments

@meherkasam following the Google style guide is not a specific goal of this project. I do try to accommodate all reasonable styles, and this seems like a reasonable rule, so I'll consider it as a feature request.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fellipecaetano picture fellipecaetano  路  4Comments

AniHovhannisyanAni picture AniHovhannisyanAni  路  3Comments

dcramps picture dcramps  路  3Comments

shripada picture shripada  路  3Comments

meherkasam picture meherkasam  路  3Comments