From 2e616d76eb9fc8b1778c2d79790c3ef4f981e2b3 Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Wed, 9 Nov 2016 20:52:08 +0000 Subject: [PATCH] Fixed Playground support for Xcode Extension --- EditorExtension/Extension/FormatEntireFileCommand.swift | 2 +- EditorExtension/Extension/FormatSelectedSourceCommand.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EditorExtension/Extension/FormatEntireFileCommand.swift b/EditorExtension/Extension/FormatEntireFileCommand.swift index aa6615f5..dbed532a 100644 --- a/EditorExtension/Extension/FormatEntireFileCommand.swift +++ b/EditorExtension/Extension/FormatEntireFileCommand.swift @@ -37,7 +37,7 @@ import XcodeKit class FormatEntireFileCommand: NSObject, XCSourceEditorCommand { func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) -> Void { - guard invocation.buffer.contentUTI == "public.swift-source" else { + guard ["public.swift-source", "com.apple.dt.playground"].contains(invocation.buffer.contentUTI) else { return completionHandler(FormatCommandError.notSwiftLanguage) } diff --git a/EditorExtension/Extension/FormatSelectedSourceCommand.swift b/EditorExtension/Extension/FormatSelectedSourceCommand.swift index 1cae0e6d..4c5f8344 100644 --- a/EditorExtension/Extension/FormatSelectedSourceCommand.swift +++ b/EditorExtension/Extension/FormatSelectedSourceCommand.swift @@ -39,7 +39,7 @@ class FormatSelectedSourceCommand: NSObject, XCSourceEditorCommand { func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) -> Void { - guard invocation.buffer.contentUTI == "public.swift-source" else { + guard ["public.swift-source", "com.apple.dt.playground"].contains(invocation.buffer.contentUTI) else { return completionHandler(FormatCommandError.notSwiftLanguage) }