Skip to content

Indentation follows Xcode ctrl-i #52

Open
@justinvallely

Description

@justinvallely

Hello!

When generating mocks for functions with input parameters on different lines, would it be possible to have them auto-indent based on Xcode's default ctrl-i shortcut? The end result would be input parameters aligned at their first character. Examples below.

Current:

    var invokedFetchRetailer = false
    var invokedFetchRetailerCount = 0
    var invokedFetchRetailerParameters: (identifier: Int, Void)?
    var invokedFetchRetailerParametersList = [(identifier: Int, Void)]()
    var stubbedFetchRetailerCompletionResult: (Result<Retailer, Error>, Void)?

    func fetchRetailer(for identifier: Int,
        completion: @escaping ((Result<Retailer, Error>) -> Void)) {
        invokedFetchRetailer = true
        invokedFetchRetailerCount += 1
        invokedFetchRetailerParameters = (identifier, ())
        invokedFetchRetailerParametersList.append((identifier, ()))
        if let result = stubbedFetchRetailerCompletionResult {
            completion(result.0)
        }
    }

Desired:

    var invokedFetchRetailer = false
    var invokedFetchRetailerCount = 0
    var invokedFetchRetailerParameters: (identifier: Int, Void)?
    var invokedFetchRetailerParametersList = [(identifier: Int, Void)]()
    var stubbedFetchRetailerCompletionResult: (Result<Retailer, Error>, Void)?

    func fetchRetailer(for identifier: Int,
                       completion: @escaping ((Result<Retailer, Error>) -> Void)) { // <------- NOTE "completion" aligns with "for".
        invokedFetchRetailer = true
        invokedFetchRetailerCount += 1
        invokedFetchRetailerParameters = (identifier, ())
        invokedFetchRetailerParametersList.append((identifier, ()))
        if let result = stubbedFetchRetailerCompletionResult {
            completion(result.0)
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions