Closed MahdiBM closed 1 year ago
Thanks for opening this issue! I totally get the use case and I definitely will have a look on this.
I just noticed this issue in swift-format repo: https://github.com/apple/swift-format/issues/297. I thought it doesn't hurt to mention that they basically want to natively support what this issue requests.
I just notice this is the repository for Nick Lokwood's swift-format, but actually that makes the issue even better because i've now moved to the Nick Lockwood's swiftformat because Apple's swift-format doesn't seem actually useable in practically formatting stuff properly.
Thanks for the upcoming comments! If I get this right, there is no issue in this repo and for the apple formatter extension, this is an upstream issue.
When you do "Format Selection" in VSCode, it'll format the selection out of context of the file, which can make it look weird because it won't properly take care of indentation etc...
It should instead take the whole file context into account, but only modify the selected lines.
Steps to reproduce
1:
2:
3:
4:
As you can see, in 4 indentation of the function is broken compared to the parent struct. There is also a weird extra space below the function after the indentation, not sure why.
Usage?
When working on team projects you might want to keep your own code-style clean, but don't force it on others. Without a feature like this you always need to format the whole file instead of just the few lines you wrote.