vknabel / vscode-swiftformat

SwiftFormat for VS Code
https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-swiftformat
MIT License
39 stars 7 forks source link

Add configuration option to only run swift format when a .swiftformat file exists #20

Closed adam-fowler closed 2 years ago

adam-fowler commented 2 years ago

I'd like to enable this extension universally, but it means if I work on a project which isn't using swift format it applies the default formatting to it when I'd rather it did nothing. The existence of a .swiftformat file is a pretty good indicator that swift format is being used.

Can we add a configuration option to only run swift format is a .swiftformat file exists in the base of the project

vknabel commented 2 years ago

Thanks for the great suggestion! I'll try to implement this within the next two weeks.

vknabel commented 2 years ago

Has been released as 1.4.0.

Within the next few minutes, I will also publish updates for vknabel/vscode-apple-swift-format and vknabel/vscode-swiftlint which implement the same feature.

{
  "swiftformat.onlyEnableWithConfig": true,
  "apple-swift-format.onlyEnableWithConfig": true,
  "swiftlint.onlyEnableWithConfig": true
}