I've been working on putting together an Xcode Source Editor Extension that will allow me to format code from within Xcode using the SwiftFormat library, however when I use essentially the same code to reformat the source as the command line `swift-format` utility, I get a crash in SwiftSyntax, as shown in the backtrace below:
The problem is that the `SyntaxRewriter` visitation exhausts the stack space that dispatch threads get. This can be reproduced from a command-line tool by doing the formatting call on a dispatch queue other than the main one.
To workaround this run the formatting transformation under a pthread thread (which you can customize its stack allocation).
Environment
macOS 10.14.5, Xcode 11 beta 4
Additional Detail from JIRA
md5: 1b490d131fc3f34c23c544d465e9bd6f
Issue Description:
I've been working on putting together an Xcode Source Editor Extension that will allow me to format code from within Xcode using the SwiftFormat library, however when I use essentially the same code to reformat the source as the command line `swift-format` utility, I get a crash in SwiftSyntax, as shown in the backtrace below:
I've uploaded the current state of the project to https://github.com/tonyarnold/XcodeSwiftFormatter as a reproduction of this crash.
Please let me know if you'd like more detail on anything - I'm happy to help!
The text was updated successfully, but these errors were encountered: