SwiftInitializerGenerator icon indicating copy to clipboard operation
SwiftInitializerGenerator copied to clipboard

Does not work with playgrounds.

Open AtomicCat opened this issue 8 years ago • 3 comments

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.

AtomicCat avatar Nov 27 '17 20:11 AtomicCat

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 avatar Dec 13 '17 20:12 Bouke

@Bouke The contentUTI is "com.apple.dt.playgroundpage". This is not checked in SourceEditorCommand.swift.

karlpuusepp avatar Dec 20 '17 11:12 karlpuusepp

Ah, you're working with multiple pages, it seems? Can you create a PR to resolve this?

Bouke avatar Dec 20 '17 12:12 Bouke