swiftlang / swift-org-website

Swift.org website
https://swift.org
Other
460 stars 173 forks source link

[Getting started with vscode swift] Formatting Section #705

Open MahdiBM opened 3 weeks ago

MahdiBM commented 3 weeks ago

Is your feature request related to a problem? Please describe

I've been using a combination of VSCode and Xcode on my machine for a year or so now, and IMO the most problematic aspect of using VSCode is the formatting.

Xcode comes with some sane default formatting helpers (e.g. indentation), but VSCode does not come with any by default.

Describe the solution you'd like

A section about formatting which mentions SwiftFormat (repo, extension) and swift-format (repo, extension).

Describe alternatives you've considered

Alternatively, one could leave using VSCode and use Xcode on a macOS device they might not have 😅 Formatting is that important, in my opinion at least. Having no formatters ruins the whole experience.

Additional context

The fact that the formatting experience is suboptimal in VSCode has been one of the biggest reasons I still use Xcode. I've made some attempts on improving the formatting experience, but it's still not close enough to Xcode. Including adding format-on-type capability to the VSCode extensions, and even having a local less-stable formatting-related feature to have the Format Selection functionality on VSCode, that i never saw fit to actually propose a PR for (it would work meh/fine, but it was buggy enough to be unfit as a public feature)

Luckily swift-format is going to have "Format Selection" functionality soon, and I or someone else will be able to add support for that to the VSCode extension.

Other than this, I find the article pretty nice and helpful, so thanks to the ones who helped publishing this article.