tweaking some basic objc snippets

This commit is contained in:
capitaomorte
2010-03-14 19:58:27 +00:00
parent a090443417
commit f1ce4866b6
9 changed files with 46 additions and 34 deletions

View File

@@ -2,10 +2,9 @@
# key: m
# contributor: Translated from TextMate Snippet
# name: Method
## binding: "^M"
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# binding: C-c m
# condition: (and (yas/objc-implementation-p) (not (yas/objc-method-body-p)))
# --
- (${1:id})${2:${TM_SELECTED_TEXT:method}}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}}
{$0${1/^(void|IBAction)$|(.*)/(?2:
return nil;)/}
}
- (${1:id})${2:`(or yas/selected-text "method")`}${3::(${4:id})${5:${4:$(
yas/objc-guess-instance-name yas/text)}}} {$0${1:$(if (
string-match yas/objc-void-regexp text) "}" "\n return nil;\n}")}

View File

@@ -2,10 +2,10 @@
# key: sm
# contributor: Translated from TextMate Snippet
# name: Sub-method (Call Super)
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# condition: (and (yas/objc-implementation-p) (not (yas/objc-method-body-p)))
# --
- (${1:id})${2:method}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}}
{
${1/^(void|IBAction)$|(.*)/(?2:$2 res = )/}[super ${2:method}${5/.+/:$0/}];$0${1/^(void|IBAction)$|(.*)/(?2:
return res;)/}
}
- (${1:id})${2:`(or yas/selected-text "method")`}${3::(${4:id})${5:${4:$(
yas/objc-guess-instance-name yas/text)}}} {
${1:$(if (string-match yas/objc-void-regexp text) "" "res = ")}[super $2${5:$(
if (string= yas/text "") "" (concat ":" yas/text))}];${1:$(if (string-match yas/objc-void-regexp text) "" "\n return res;")}
}

View File

@@ -2,9 +2,8 @@
# key: M
# contributor: Translated from TextMate Snippet
# name: Class Method
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# condition: (and (yas/objc-implementation-p) (not (yas/objc-method-body-p)))
# --
+ (${1:id})${2:method}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}}
{$0${1/^(void|IBAction)$|(.*)/(?2:
return nil;)/}
}
+ (${1:id})${2:`(or yas/selected-text "method")`}${3::(${4:id})${5:${4:$(
yas/objc-guess-instance-name yas/text)}}} {$0${1:$(if (
string-match yas/objc-void-regexp text) "}" "\n return nil;\n}")}

View File

@@ -2,6 +2,6 @@
# key: ibo
# contributor: Translated from TextMate Snippet
# name: IBOutlet
## condition: "source.objc, source.objc++"
# condition: (yas/objc-interface-p)
# --
IBOutlet ${1:NSSomeClass}${TM_C_POINTER: *}${2:${1/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}};
IBOutlet ${1:NSSomeClass}*${2:${1:$(yas/objc-guess-member-name yas/text)}};

View File

@@ -2,7 +2,7 @@
# key: I
# contributor: Translated from TextMate Snippet
# name: Method: Initialize
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
# condition: (and (yas/objc-implementation-p) (not (yas/objc-method-body-p)))
# --
+ (void)initialize
{