vknabel / vscode-swiftformat

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

On-type formatting doesn't appear to work #42

Closed tristanlabelle closed 2 weeks ago

tristanlabelle commented 3 weeks ago

I'm not getting formatting when hitting enter (we're currently registering it for "\n" characters), nor after modifying it to "}", when I type that character.

MahdiBM commented 3 weeks ago

@tristanlabelle Are you on the latest version? Works fine for me on 1.7.0. If you hit \n and the new line is not an empty line, SwiftFormat should be triggered.

vinocher-bc commented 3 weeks ago

@MahdiBM did you mean 1.6.9, which seems to be the latest version? Currently, formatting on Enter isn't working for me either on Windows in version 1.6.9.

MahdiBM commented 3 weeks ago

Hmm I thought I saw a higher version. Maybe you need to enable the "format on type" somehow?

MahdiBM commented 3 weeks ago

Ah i had manually installed a version 1.7.0 locally with my own changes. Regardless, when I enable format-on-type:

"editor.formatOnType": true

it just works for me.

vinocher-bc commented 3 weeks ago

"editor.formatOnType": true was missing. Thanks.

MahdiBM commented 3 weeks ago

Perhaps there should be some documentation for that, that we add 🙂.