vknabel / vscode-swiftformat

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

How is swiftformat.options configured? #17

Closed xxxIxxxx closed 1 year ago

xxxIxxxx commented 2 years ago
image

It doesn't seem to work that way. So can you add a configuration list like this one? Thanks big guy!

好像不是这样用的。 那么可以加一个像这样的配置列表吗? 谢谢大佬!

vknabel commented 2 years ago

Hi @xxxIxxxx, sorry for the late response!

The correct config would be: "swiftformat.options": ["--stripunusedargs", "closure-only"]. Does it work for you that way? It seems like you configured "swiftformat.options": ["--stripunusedargs closure-only"] instead.

xxxIxxxx commented 2 years ago

Thanks for the reply, I tried it and it still doesn't work

 "--stripunusedargs", "closure-only"    or    "--stripunusedargs","closure-only"
❌ SwiftFormat failed. error: File not found at /"--stripunusedargs".

 --stripunusedargs, closure-only    or    --stripunusedargs,closure-only
❌ SwiftFormat failed. error: Unknown option --stripunusedargs, closure-only. Did you mean --stripunusedargs?

 --stripunusedargs
❌ SwiftFormat failed. error: --stripunusedargs option expects a value.
1
vknabel commented 2 years ago

That's weird.

You are on Linux, right?

What happens if you uncheck Swiftformat: Only enable on Swift PM Projects, remove the dependency from your Package.swift, run swift package clean and reopen the VS Code window?

Maybe there is a bug when using the Package directly from your Swift PM project.

xxxIxxxx commented 2 years ago

macOS

Unchecking it doesn't work, I only have an A.swift file

1