Does not work with playgrounds.
When run from a playground, I get the error Generate_Swift_Initializer.SIGError error 0. I assume this is SIGError.notSwiftLanguage. Maybe there is something special about the main source file in a playground...
Seems to work great in regular projects.
In the SIGError enum the first case is notSwiftLanguage, which would probably be the 0 that you get. However in SourceEditorCommand.swift playgrounds are also valid: "com.apple.dt.playground". So your source type must be even something different. Can you step through the code and see what the value of invocation.buffer.contentUTI is?
@Bouke The contentUTI is "com.apple.dt.playgroundpage". This is not checked in SourceEditorCommand.swift.
Ah, you're working with multiple pages, it seems? Can you create a PR to resolve this?