sweetpad-dev / sweetpad

Develop Swift/iOS projects using VSCode
https://marketplace.visualstudio.com/items?itemName=sweetpad.sweetpad
MIT License
117 stars 3 forks source link

Allow user to select formatter #8

Closed rafaelpedretti-toast closed 1 month ago

rafaelpedretti-toast commented 1 month ago

On my company we use swiftformat as our formatter and I felt the need to add this feature into the plugin

This PR introduces the ability for the user to use any formatter he wishes and pass any arguments to it.

The change still uses the default swift-format with default --in-place argument

hyzyla commented 1 month ago

Hello! Thank you for that PR, I'll check it later that week

hyzyla commented 1 month ago

I've updated PR sligtly. Thank you for the conribution 🫡

Here is example how to configure swiftformat in settings.json:

{
  "[swift]": {
    "editor.defaultFormatter": "sweetpad.sweetpad",
    "editor.formatOnSave": true
  },
  "sweetpad.format.path": "swiftformat",
  "sweetpad.format.args": ["--quiet", "${file}"],
}
rafaelpedretti-toast commented 1 month ago

I've updated PR sligtly. Thank you for the conribution 🫡

Here is example how to configure swiftformat in settings.json:

{
  "[swift]": {
    "editor.defaultFormatter": "sweetpad.sweetpad",
    "editor.formatOnSave": true
  },
  "sweetpad.format.path": "swiftformat",
  "sweetpad.format.args": ["--quiet", "${file}"],
}

Thanks! this is very interesting!