From 6dfdab979b2baa2a738280242f6f941cfba6dac7 Mon Sep 17 00:00:00 2001 From: Allen Wu Date: Sun, 3 May 2015 19:54:14 -0700 Subject: [PATCH 1/2] Fixed crash with "completion-scope" --- lib/xcodesnippet/commands/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcodesnippet/commands/install.rb b/lib/xcodesnippet/commands/install.rb index 826457d..e8a81f7 100644 --- a/lib/xcodesnippet/commands/install.rb +++ b/lib/xcodesnippet/commands/install.rb @@ -57,7 +57,7 @@ def extract_front_matter! end @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 = front_matter["completion-scopes"] || 'All' @snippet.identifier = SecureRandom.uuid().upcase @snippet.is_user_snippet = true @snippet.version = 0 From baed4f0ac52ae8418e3e68e010ecbec183fcbda3 Mon Sep 17 00:00:00 2001 From: Allen Wu Date: Sun, 3 May 2015 19:54:24 -0700 Subject: [PATCH 2/2] Updated README with list of valid completion-scopes --- README.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c0a6fd0..69fa099 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,46 @@ $ gem install xcodesnippet ## Usage +### Example + #### Sourcefile.swift ```swift --- title: "Hello, World!" summary: "Prints 'Hello World'" -completion-scope: Function or Method +completion-scopes: + - CodeBlock --- println("Hello, World!") ``` -#### Terminal Command +### Completion Scopes + +#### Objective-C + +* `ClassImplementation` +* `CodeExpression` +* `Preprocessor` +* `ClassInterfaceVariables` +* `All` +* `TopLevel` +* `ClassInterfaceMethods` +* `CodeBlock` +* `StringOrComment` + +#### Swift + +* `TopLevel` +* `ClassImplementation` +* `CodeBlock` +* `All` +* `CodeExpression` +* `StringOrComment` + + +### Terminal Command ``` $ xcodesnippet install path/to/source.m