Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation follows Xcode ctrl-i #52

Open
justinvallely opened this issue Jul 12, 2021 · 0 comments
Open

Indentation follows Xcode ctrl-i #52

justinvallely opened this issue Jul 12, 2021 · 0 comments

Comments

@justinvallely
Copy link

justinvallely commented Jul 12, 2021

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)
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant