Jintin / Swimat

An Xcode formatter plug-in to format your swift code.
https://jintin.github.io/Swimat/
MIT License
1.65k stars 89 forks source link

Curley braces indented incorrectly when formatting spaces. #237

Open Mark-FX opened 3 years ago

Mark-FX commented 3 years ago

I am using the SwiftParser and all of it's associated classes from a Mac app Xcode project, and am initialising it and passing in the unformatted Swift String, and setting the "autoRemoveChar" and "Indent.paraAlign" from within the init function, for testing purposes. I send an NSTextView.string to the init function, and assign the returned formatted string to the NSTextView.string, all appears to be working well until you send a string with too many and unnecessary spaces, from within a curley brace block or loop or conditional block. I found this out by mistake when accidentally entering to many gaps between code words like this.

Code 1

The returned formatted code had closed the gaps as expected, but had indented the Curley braces further than they were already set, and continued to affect any further formatting on new typed or added code .

Code 2

At this stage I'm trying to work out if it has something to do with the NSTextView's string, or the formatting by the SwiftParser.

Any ideas or help as to what might be happening here would be appreciated ? And how it could possibly be resolved ?

Kind Regards

Mark