Swimat icon indicating copy to clipboard operation
Swimat copied to clipboard

Weird indentation with type inference on methods

Open simonbromberg opened this issue 5 years ago • 1 comments

What is the issue Swimat's indentation seems to behave incorrectly with lines beginning with . which are inferring a type.

For example:

func myFunction() -> MyClass {
        .init(
        myParam: someValue
    )
}

If it were MyClass above instead of .init the indentation works as expected, but it's nicer to use type inference.

Even a single line indents too much:

func myFunction() -> UIView {
		.init(frame: .zero)
}

Expected behavior

func myFunction() -> MyClass {
    .init(
        myParam: someValue
    )
}

Desktop (please complete the following information):

  • OS: macOS 11.0.1 (20B50)
  • App Version 1.70

Additional context Does this in the Preview tool of the Swimat macOS app too.

simonbromberg avatar Nov 25 '20 21:11 simonbromberg

I'm getting the same thing with single lines being indented too much:


init() {
    UINavigationBar.appearance().largeTitleTextAttributes = [
            .foregroundColor: UIColor.white // This line is indented twice
    ]
}

Thanks for the awesome tool @Swimat team, can't wait for more improvements

frederickjjoubert avatar Apr 13 '21 21:04 frederickjjoubert