nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.9k stars 639 forks source link

SwiftFormat 0.49.10 inserts unexpected indentation when using forward slash operator #1199

Closed konomae closed 2 years ago

konomae commented 2 years ago

An unexpected indent was inserted in a project using CasePath.

SwiftFormat 0.49.10 Config: default

This does not occur in 0.49.9 or earlier.

Input

reducer.pullback(
    casePath: /Action.action,
    environment: {}
)

Actual

reducer.pullback(
    casePath: /Action.action,
        environment: {}
    )

Expected

same as input

reducer.pullback(
    casePath: /Action.action,
    environment: {}
)
nicklockwood commented 2 years ago

Thanks for reporting. Looks like the / is being mistaken for the start of a regex literal. Workaround for now would be to disable the indent rule for that file.

nicklockwood commented 2 years ago

@konomae fixed in 0.49.11

konomae commented 2 years ago

Thank you!