[swift-dev] Plans for swift-format?

Harlan Haskins harlan at harlanhaskins.com
Mon Aug 21 16:42:27 CDT 2017

Hi Jimmy,

I’d personally really like to see swift-format written entirely in Swift using libSyntax. It’s really easy to perform common formatting tasks just by modifying the trivia for each token you’re trying to check (like replacing new lines before a brace with a space, per se).

Unfortunately, we’re a little ways away from a full structural syntax tree from libSyntax, but I’d love to see what y’all could come up with using the token stream that you’ll get from libSyntax now.

I’ll reach out to you offline to help you get started. There are some build issues that I want to fix before SwiftSyntax will start showing up in toolchains.

Harlan Haskins

> On Aug 21, 2017, at 4:08 PM, Jimmy Yue via swift-dev <swift-dev at swift.org> wrote:
> Hey Swift team,
> We’ve been trying to build a linter in-house that can cover most of our rules (https://github.com/linkedin/swift-style-guide).
> Our current approach for retrieving the AST has been very similar to how your swift-format tool works, but at the moment swift-format is a bit too barebones to pick up. Is there a roadmap available for this tool? Ideally we would also be able to define our own rulesets, or at least extend upon the tool’s access to the AST. Though it looks like swift-format is intended for indentation checks, and perhaps you aren’t looking to build out a complete linter, perhaps we can contribute to opening up the tool such that adding rules doesn’t require maintaining a Swift toolchain and recompiling the tool itself?
> Cheers
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170821/e197f89a/attachment.html>

More information about the swift-dev mailing list