SwiftFormat icon indicating copy to clipboard operation
SwiftFormat copied to clipboard

How I can setup indentation for empty lines?

Open DanDolog opened this issue 10 months ago • 3 comments

Hello! I've encountered a problem. I can’t find information anywhere on how to configure the formatting of empty lines. Do I understand correctly that now in SwiftFormat you can either clear all spaces in empty lines or not format them at all?

I have these settings--indent tab, --tabwidth 4,--trimwhitespace nonblank-lines and SwiftFormat simply ignores this nightmare: Screenshot 2024-04-01 at 16 23 41

Expected result (Ctrl+I in Xcode): Screenshot 2024-04-01 at 16 32 30

What do you think and what can you advise in this case? Thanx!

DanDolog avatar Apr 01 '24 12:04 DanDolog

I think this isn't supported at the moment - as you say the options are either to truncate blank lines or leave them alone. I'll consider this a feature request.

nicklockwood avatar Apr 01 '24 14:04 nicklockwood

Thank you very much, I'll be waiting! I think this is a relatively popular problem since many people have spaces and tabs highlighted. And also adding spaces on empty lines is the default behavior of Xcode.

DanDolog avatar Apr 01 '24 18:04 DanDolog

I've encountered same problem. Please consider this feature. Thank you so much!

James-chok avatar Jun 27 '24 06:06 James-chok