nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.67k stars 623 forks source link

Xcode source editor extension, prioritize read project folder's .swiftformat #1559

Closed winddpan closed 8 months ago

winddpan commented 8 months ago

Is there any way to accomplish this? I'm unsure whether the Xcode Plugin is aware of the Project's environment or path. If it is, perhaps the Xcode source editor extension should prioritize the Swiftformat rule of the project folder and then fallback to the rule of the host application.

nicklockwood commented 8 months ago

@winddpan unfortunately this is not possible due to extension sandboxing - it can only see the contents of the currently-open file, and not the location on disk.

sdykae commented 8 months ago

@nicklockwood maybe could we could add configuration options by copying .swiftformat file contents to a configuration textarea option in the extension, could be more easier than check boxes

--indent 2
nicklockwood commented 8 months ago

@sdykae you can import your .swiftformat file into the SwiftFormat for Xcode app using the File>Open menu.

sdykae commented 8 months ago

@sdykae you can import your .swiftformat file into the SwiftFormat for Xcode app using the File>Open menu.

was looking for that option, thank you so much

Maybe could highlight that option in the Readme