I'm a huge fan of clang-format, (http://clang.llvm.org/docs/ClangFormat.html\ )
a tool that can set rules for formatting source code in Objective-C
projects. With tools like spacecommander (
https://github.com/square/spacecommander\ ) and clang-format for XCode (
https://github.com/travisjeffery/ClangFormat-Xcode\ ), it can enforce the
rules and auto run the formatter constantly so nicely formatted code stays
that way. It saves alot of time, and keeps acleaner commit log without
constant formatting adjustment.
Moving to Swift, it was a dearly missed feature. I actually asked about if
Swift would be supported by clang-format on the clang-developers forum
after it was announced in 2014, but got no replies. (
http://clang-developers.42468.n3.nabble.com/Will-clang-format-support-the-format-of-Swift-td4039910.html
)
Would auto formatting tools for Swift be a good idea to include in the
bundle of Swift Components, like clang-format is a part of clang/llvm?
···
--
Regards Håkon Bogen
http://haaakon.org
+47 95 09 68 11
This would be a fantastic thing to have, but of course someone has to build it ;)
- Doug
···
On Dec 10, 2015, at 11:13 AM, Håkon Bogen via swift-evolution <swift-evolution@swift.org> wrote:
I'm a huge fan of clang-format, (http://clang.llvm.org/docs/ClangFormat.html\ ) a tool that can set rules for formatting source code in Objective-C projects. With tools like spacecommander (https://github.com/square/spacecommander\ ) and clang-format for XCode (https://github.com/travisjeffery/ClangFormat-Xcode\ ), it can enforce the rules and auto run the formatter constantly so nicely formatted code stays that way. It saves alot of time, and keeps acleaner commit log without constant formatting adjustment.
Moving to Swift, it was a dearly missed feature. I actually asked about if Swift would be supported by clang-format on the clang-developers forum after it was announced in 2014, but got no replies. ( http://clang-developers.42468.n3.nabble.com/Will-clang-format-support-the-format-of-Swift-td4039910.html )
Would auto formatting tools for Swift be a good idea to include in the bundle of Swift Components, like clang-format is a part of clang/llvm?
Thanks for the feedback! I've actually started experimenting on building a
Swift Formatter that uses the output from SourceKit gotten from
SourceKitten to autoformat Swift code (GitHub - jpsim/SourceKitten: An adorable little framework and command line tool for interacting with SourceKit.
).
My understanding is that SourceKit still will deliver the syntax data even
if it's internally moved to libIDE. Not familiar with libIDE yet so if
anyone knows if it will differ from what SourceKit outputs, just give me a
heads up.
···
2015-12-10 20:25 GMT+01:00 Johan Jensen <jj@johanjensen.dk>:
I think it is planned, but someone has to build it:
[swift-dev] Starter project: 'swift-format' tool: Move the swift indentation mechanism from SourceKit to libIDE and utilize it for a command-line tool
—Johan
On Thu, Dec 10, 2015 at 8:13 PM, Håkon Bogen <swift-evolution@swift.org> > wrote:
I'm a huge fan of clang-format, (
http://clang.llvm.org/docs/ClangFormat.html\ ) a tool that can set rules
for formatting source code in Objective-C projects. With tools like
spacecommander (https://github.com/square/spacecommander\ ) and
clang-format for XCode (
https://github.com/travisjeffery/ClangFormat-Xcode\ ), it can enforce the
rules and auto run the formatter constantly so nicely formatted code stays
that way. It saves alot of time, and keeps acleaner commit log without
constant formatting adjustment.
Moving to Swift, it was a dearly missed feature. I actually asked about
if Swift would be supported by clang-format on the clang-developers forum
after it was announced in 2014, but got no replies. (
http://clang-developers.42468.n3.nabble.com/Will-clang-format-support-the-format-of-Swift-td4039910.html
)
Would auto formatting tools for Swift be a good idea to include in the
bundle of Swift Components, like clang-format is a part of clang/llvm?
--
Regards Håkon Bogen
http://haaakon.org
+47 95 09 68 11
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
--
Hilsen Håkon Bogen
http://haaakon.org
+47 95 09 68 11
You guys should check out HoundCI it has swift support!
···
On Fri, Dec 11, 2015 at 9:58 AM, Håkon Bogen <swift-evolution@swift.org> wrote:
Thanks for the feedback! I've actually started experimenting on building a
Swift Formatter that uses the output from SourceKit gotten from
SourceKitten to autoformat Swift code (
https://github.com/jpsim/SourceKitten\ ).
My understanding is that SourceKit still will deliver the syntax data even
if it's internally moved to libIDE. Not familiar with libIDE yet so if
anyone knows if it will differ from what SourceKit outputs, just give me a
heads up.
2015-12-10 20:25 GMT+01:00 Johan Jensen <jj@johanjensen.dk>:
I think it is planned, but someone has to build it:
[swift-dev] Starter project: 'swift-format' tool: Move the swift indentation mechanism from SourceKit to libIDE and utilize it for a command-line tool
—Johan
On Thu, Dec 10, 2015 at 8:13 PM, Håkon Bogen <swift-evolution@swift.org> >> wrote:
I'm a huge fan of clang-format, (
http://clang.llvm.org/docs/ClangFormat.html\ ) a tool that can set rules
for formatting source code in Objective-C projects. With tools like
spacecommander (https://github.com/square/spacecommander\ ) and
clang-format for XCode (
https://github.com/travisjeffery/ClangFormat-Xcode\ ), it can enforce the
rules and auto run the formatter constantly so nicely formatted code stays
that way. It saves alot of time, and keeps acleaner commit log without
constant formatting adjustment.
Moving to Swift, it was a dearly missed feature. I actually asked about
if Swift would be supported by clang-format on the clang-developers forum
after it was announced in 2014, but got no replies. (
http://clang-developers.42468.n3.nabble.com/Will-clang-format-support-the-format-of-Swift-td4039910.html
)
Would auto formatting tools for Swift be a good idea to include in the
bundle of Swift Components, like clang-format is a part of clang/llvm?
--
Regards Håkon Bogen
http://haaakon.org
+47 95 09 68 11
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
--
Hilsen Håkon Bogen
http://haaakon.org
+47 95 09 68 11
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
--
Wizard
james@supmenow.com
+44 7523 279 698
Hi @Hakon_Bogen . I know it's been a while, but i'm just looking to apply some formatting rules to my files. Perhaps you can recommend any such tools from your experience which is suitable for swift ?
Thanks !
bogen
(Håkon Bogen)
February 15, 2022, 12:12pm
6
1 Like
Keith
(Keith Smiley)
February 15, 2022, 6:23pm
7