Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit c44a9cc

Browse files
committed
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.
1 parent 44f1940 commit c44a9cc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/xcodesnippet/commands/install.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def extract_front_matter!
5858
@snippet.title = front_matter["title"] || ""
5959
@snippet.summary = front_matter["summary"] || ""
6060
@snippet.completion_scopes = [front_matter["completion-scope"]] || front_matter["completion-scopes"] || "All"
61+
@snippet.completion_scopes.collect! { |var|
62+
var == "Function or Method" ? "CodeBlock" : variable
63+
}
6164
@snippet.identifier = SecureRandom.uuid().upcase
6265
@snippet.is_user_snippet = true
6366
@snippet.version = 0

0 commit comments

Comments
 (0)