From 97a4bc16305ae907f374b2911b0f6bd294bcafbf Mon Sep 17 00:00:00 2001 From: X Date: Wed, 20 Apr 2016 20:11:13 +0800 Subject: [PATCH] fix: When create a snippet of which completion scope of a snippet is "Function or Mehtod", it will not result in a code completion in XCode. According to Apple's snippet file, when you create a snippet with "Function or Mehtod" style, the output file's "IDECodeSnippetCompletionScopes" is "CodeBlock". When I replace the value for this key, there would be a code completion in Xcode. --- lib/xcodesnippet/commands/install.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/xcodesnippet/commands/install.rb b/lib/xcodesnippet/commands/install.rb index 826457d..3372596 100644 --- a/lib/xcodesnippet/commands/install.rb +++ b/lib/xcodesnippet/commands/install.rb @@ -58,6 +58,9 @@ def extract_front_matter! @snippet.title = front_matter["title"] || "" @snippet.summary = front_matter["summary"] || "" @snippet.completion_scopes = [front_matter["completion-scope"]] || front_matter["completion-scopes"] || "All" + @snippet.completion_scopes.collect! { |var| + var == "Function or Method" ? "CodeBlock" : var + } @snippet.identifier = SecureRandom.uuid().upcase @snippet.is_user_snippet = true @snippet.version = 0