mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
adding objc-snippets
This commit is contained in:
parent
c11379e768
commit
efa4d6e481
0
extras/imported/objc-mode/.yas-make-groups
Normal file
0
extras/imported/objc-mode/.yas-make-groups
Normal file
38
extras/imported/objc-mode/.yas-setup.el
Normal file
38
extras/imported/objc-mode/.yas-setup.el
Normal file
@ -0,0 +1,38 @@
|
||||
;;; conditions
|
||||
(yas/define-condition-cache
|
||||
yas/objc-interface-p
|
||||
"Non-nil if point inside an objc @interface declaration."
|
||||
(yas/objc-in-c-block-like "@interface"))
|
||||
|
||||
(yas/define-condition-cache
|
||||
yas/objc-implementation-p
|
||||
"Non-nil if point inside an objc @implementation declaration."
|
||||
(yas/objc-in-c-block-like "@implementation"))
|
||||
|
||||
(yas/define-condition-cache
|
||||
yas/objc-method-body-p
|
||||
"Non-nil if point inside an objc @implementation declaration."
|
||||
(yas/objc-in-c-block-like 'objc-method-intro))
|
||||
|
||||
|
||||
(defun yas/objc-in-c-block-like (symbol-or-regexp)
|
||||
(let ((original-point (point))
|
||||
(start-point nil))
|
||||
(save-excursion
|
||||
(cond ((symbolp symbol-or-regexp)
|
||||
(c-beginning-of-defun)
|
||||
(setq start-point (point))
|
||||
(let ((syntax-info (c-guess-basic-syntax)))
|
||||
(when (and syntax-info
|
||||
(eq (caar syntax-info) symbol-or-regexp))
|
||||
(c-end-of-defun)
|
||||
(and (< start-point original-point)
|
||||
(< original-point (point))))))
|
||||
((stringp symbol-or-regexp)
|
||||
(when (search-backward-regexp symbol-or-regexp
|
||||
nil
|
||||
t)
|
||||
(setq start-point (point))
|
||||
(when (search-forward-regexp "^@end" nil t)
|
||||
(and (< start-point original-point)
|
||||
(< original-point (point))))))))))
|
@ -0,0 +1,17 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: objacc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Object
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
- (${1:id})${2:thing}
|
||||
{
|
||||
return $2;
|
||||
}
|
||||
|
||||
- (void)set${2/./\u$0/}:($1)aValue
|
||||
{
|
||||
$0${1/( \*)?$/(?1:$1: )/}old${2/./\u$0/} = $2;
|
||||
$2 = [aValue retain];
|
||||
[old${2/./\u$0/} release];
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cdacc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: CoreData
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
- (${1:id})${2:attribute}
|
||||
{
|
||||
[self willAccessValueForKey:@"${2: attribute}"];
|
||||
${1:id} value = [self primitiveValueForKey:@"${2: attribute}"];
|
||||
[self didAccessValueForKey:@"${2: attribute}"];
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)set${2/./\u$0/}:($1)aValue
|
||||
{
|
||||
[self willChangeValueForKey:@"${2: attribute}"];
|
||||
[self setPrimitiveValue:aValue forKey:@"${2: attribute}"];
|
||||
[self didChangeValueForKey:@"${2: attribute}"];
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: arracc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: KVC Array
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
- (void)addObjectTo${1:Things}:(${2:id})anObject
|
||||
{
|
||||
[${3:${1/./\l$0/}} addObject:anObject];
|
||||
}
|
||||
|
||||
- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i
|
||||
{
|
||||
[$3 insertObject:anObject atIndex:i];
|
||||
}
|
||||
|
||||
- ($2)objectIn$1AtIndex:(unsigned int)i
|
||||
{
|
||||
return [$3 objectAtIndex:i];
|
||||
}
|
||||
|
||||
- (unsigned int)indexOfObjectIn$1:($2)anObject
|
||||
{
|
||||
return [$3 indexOfObject:anObject];
|
||||
}
|
||||
|
||||
- (void)removeObjectFrom$1AtIndex:(unsigned int)i
|
||||
{
|
||||
[$3 removeObjectAtIndex:i];
|
||||
}
|
||||
|
||||
- (unsigned int)countOf$1
|
||||
{
|
||||
return [$3 count];
|
||||
}
|
||||
|
||||
- (NSArray${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})${1/./\l$0/}
|
||||
{
|
||||
return $3;
|
||||
}
|
||||
|
||||
- (void)set$1:(NSArray${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})new$1
|
||||
{
|
||||
[$3 setArray:new$1];
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: prop
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Property (Objective-C 2.0)
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
@property (${1/^(e)$|.*/(?1:r)/}${1:r}${1/^(?:(r)|(e)|(c)|(a))$|.*/(?1:etain)(?2:adonly)(?3:opy)(?4:ssign)/}) ${2:NSSomeClass}${TM_C_POINTER: *}${3:${2/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}};
|
@ -0,0 +1,15 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: acc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Primitive Type
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
- (${1:unsigned int})${2:thing}
|
||||
{
|
||||
return ${3:$2};
|
||||
}
|
||||
|
||||
- (void)set${2/./\u$0/}:(${1:unsigned int})new${2/./\u$0/}
|
||||
{
|
||||
$3 = new${2/./\u$0/};
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: stracc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: String
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
- (NSString${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})${1:thing}
|
||||
{
|
||||
return ${2:$1};
|
||||
}
|
||||
|
||||
- (void)set${1/.*/\u$0/}:(NSString${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})${3:a${1/.*/\u$0/}}
|
||||
{
|
||||
$3 = [$3 copy];
|
||||
[$2 release];
|
||||
$2 = $3;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: syn
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Synthesize Property
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
@synthesize ${1:property};
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: M
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Interface: Class Method
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
+ (${1:id})${0:method};
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: thread
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Detach New NSThread
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[NSThread detachNewThreadSelector:@selector(${1:method}:) toTarget:${2:aTarget} withObject:${3:anArgument}]
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: bind
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Bind Property to Key Path of Object
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
bind:@"${2:binding}" toObject:${3:observableController} withKeyPath:@"${4:keyPath}" options:${5:nil}
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: log
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSLog(…)
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSLog(@"$1"${1/[^%]*(%)?.*/(?1:, :\);)/}$2${1/[^%]*(%)?.*/(?1:\);)/}
|
@ -0,0 +1,15 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: alert
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSRunAlertPanel
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
int choice = NSRunAlertPanel(@"${1:Something important!}", @"${2:Something important just happend, and now I need to ask you, do you want to continue?}", @"${3:Continue}", @"${4:Cancel}", nil);
|
||||
if(choice == NSAlertDefaultReturn) // "${3:Continue}"
|
||||
{
|
||||
$0;
|
||||
}
|
||||
else if(choice == NSAlertAlternateReturn) // "${4:Cancel}"
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: getprefs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Read Defaults Value
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[[NSUserDefaults standardUserDefaults] objectForKey:${1:key}];
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: obs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Register for Notification
|
||||
## condition: "source.objc meta.scope.implementation, source.objc++ meta.scope.implementation"
|
||||
# --
|
||||
[[NSNotificationCenter defaultCenter] addObserver:${1:self} selector:@selector(${3:${2/^([A-Z]{2})?(.+?)(Notification)?$/\l$2/}}:) name:${2:NSWindowDidBecomeMainNotification} object:${4:nil}];
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: setprefs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Write Defaults Value
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[[NSUserDefaults standardUserDefaults] setObject:${1:object} forKey:${2:key}];
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# type: command
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Reformat Method Signature
|
||||
## binding: "^q"
|
||||
## condition: "meta.function.objc"
|
||||
# --
|
@ -0,0 +1,13 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: forarray
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSArray Loop
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
unsigned int ${1:object}Count = [${2:array} count];
|
||||
|
||||
for(unsigned int index = 0; index < ${1}Count; index += 1)
|
||||
{
|
||||
${3:id} ${1} = [$2 objectAtIndex:index];
|
||||
$0
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: delegate
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Delegate Responds to Selector
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
if([${1:[self delegate]} respondsToSelector:@selector(${2:selfDidSomething:})])
|
||||
[$1 ${3:${2/((^\s*([A-Za-z0-9_]*:)\s*)|(:\s*$)|(:\s*))/(?2:$2self :\:<>)(?4::)(?5: :)/g}}];
|
9
extras/imported/objc-mode/Idioms/Lock Focus.yasnippet
Normal file
9
extras/imported/objc-mode/Idioms/Lock Focus.yasnippet
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: focus
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Lock Focus
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[self lockFocus];
|
||||
$0
|
||||
[self unlockFocus];
|
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: pool
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSAutoreleasePool
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSAutoreleasePool${TM_C_POINTER: *}pool = [NSAutoreleasePool new];
|
||||
$0
|
||||
[pool drain];
|
@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: responds
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Responds to Selector
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
${TM_COMMENT_START} ${4:Send $2 to $1, if $1 supports it}${TM_COMMENT_END}
|
||||
if ([${1:self} respondsToSelector:@selector(${2:someSelector:})])
|
||||
{
|
||||
[$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}];
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: gsave
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Save and Restore Graphics Context
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
$0
|
||||
[NSGraphicsContext restoreGraphicsState];
|
7
extras/imported/objc-mode/Insert Call to Super.yasnippet
Normal file
7
extras/imported/objc-mode/Insert Call to Super.yasnippet
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# type: command
|
||||
# key: super
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Insert Call to Super
|
||||
## condition: "source.objc meta.scope.implementation, source.objc++ meta.scope.implementation"
|
||||
# --
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: imp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: #import "…"
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
#import "${1:${TM_FILENAME/\...*$/.h/}}"
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: Imp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: #import <…>
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
#import <${1:Cocoa/Cocoa.h}>
|
@ -0,0 +1,20 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cl
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Class
|
||||
## condition: "source.objc, source.objc++ - meta.scope.implementation.objc"
|
||||
# --
|
||||
@interface ${1:${TM_FILENAME/\...*$|(^$)/(?1:object)/}} : ${2:NSObject}
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation $1
|
||||
- (id)init
|
||||
{
|
||||
if((self = [super init]))
|
||||
{$0
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: m
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Method
|
||||
## binding: "^M"
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
- (${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;)/}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# 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"
|
||||
# --
|
||||
- (${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;)/}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cat
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Category
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
@interface ${1:${TM_FILENAME/.*?(\w+).*|.*/(?1:$1:NSObject)/}} (${2:${TM_FILENAME/.*?\w+\W+(\w+).*\..+|.*/(?1:$1:Category)/}})
|
||||
@end
|
||||
|
||||
@implementation $1 ($2)
|
||||
$0
|
||||
@end
|
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: catm
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Category Implementation
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
@implementation ${1:${TM_FILENAME/.*?(\w+).*|.*/(?1:$1:NSObject)/}} (${2:${TM_FILENAME/.*?\w+\W+(\w+).*\..+|.*/(?1:$1:Category)/}})
|
||||
$0
|
||||
@end
|
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cath
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Category Interface
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
@interface ${1:${TM_FILENAME/.*?(\w+).*|.*/(?1:$1:NSObject)/}} (${2:${TM_FILENAME/.*?\w+\W+(\w+).*\..+|.*/(?1:$1:Category)/}})
|
||||
$0
|
||||
@end
|
@ -0,0 +1,15 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: clm
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Class Implementation
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
@implementation ${1:${TM_FILENAME/\...*$|(^$)/(?1:object)/}}
|
||||
- (id)init
|
||||
{
|
||||
if((self = [super init]))
|
||||
{$0
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: clh
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Class Interface
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
@interface ${1:${TM_FILENAME/\...*$|(^$)/(?1:object)/}} : ${2:NSObject}
|
||||
{$3
|
||||
}
|
||||
$0
|
||||
@end
|
@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: M
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Class Method
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
+ (${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;)/}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: ibo
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: IBOutlet
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
IBOutlet ${1:NSSomeClass}${TM_C_POINTER: *}${2:${1/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}};
|
@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: I
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Method: Initialize
|
||||
## condition: "(source.objc | source.objc++) & meta.scope.implementation.objc - meta.function-with-body"
|
||||
# --
|
||||
+ (void)initialize
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
$0@"value", @"key",
|
||||
nil]];
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: arracc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Interface: Accessors for KVC Array
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
- (void)addObjectTo${1:Things}:(${2:id})anObject;
|
||||
- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i;
|
||||
- ($2)objectIn$1AtIndex:(unsigned int)i;
|
||||
- (unsigned int)indexOfObjectIn$1:($2)anObject;
|
||||
- (void)removeObjectFrom$1AtIndex:(unsigned int)i;
|
||||
- (unsigned int)countOf$1;
|
||||
- (NSArray${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})${1/./\l$0/};
|
||||
- (void)set$1:(NSArray${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})new$1;
|
7
extras/imported/objc-mode/Lookup Cocoa Class.yasnippet
Normal file
7
extras/imported/objc-mode/Lookup Cocoa Class.yasnippet
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# type: command
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Documentation for Word / Selection
|
||||
## binding: "^h"
|
||||
## condition: "source.c, source.c++, source.objc, source.objc++, (source.objc support | source.objc++ support) - support.function.any-method"
|
||||
# --
|
8
extras/imported/objc-mode/Method Interface (m).yasnippet
Normal file
8
extras/imported/objc-mode/Method Interface (m).yasnippet
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: m
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Interface: Method
|
||||
## binding: "^M"
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
- (${1:id})${2:${TM_SELECTED_TEXT:method}}${3::(${4:id})${5:${4/(NS([AEIOQUY])?(\w+).*)|(.)?.*/(?1:a(?2:n$2)$3:(?4:anArgument))/}}};
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: log
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSLog(.., _cmd)
|
||||
## condition: "source.objc meta.scope.implementation, source.objc++ meta.scope.implementation"
|
||||
# --
|
||||
NSLog(@"%s$1", _cmd${1/[^%]*(%)?.*/(?1:, :\);)/}$2${1/[^%]*(%)?.*/(?1:\);)/}
|
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: objacc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Interface: Accessors for Object
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
- (${1:id})${2:thing};
|
||||
- (void)set${2/./\u$0/}:($1)aValue;
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: array
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSArray
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSMutableArray${TM_C_POINTER: *}${1:array} = [NSMutableArray array];
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: dict
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSDictionary
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSMutableDictionary${TM_C_POINTER: *}${1:dict} = [NSMutableDictionary dictionary];
|
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: bez
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSBezierPath
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSBezierPath${TM_C_POINTER: *}${1:path} = [NSBezierPath bezierPath];
|
||||
$0
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: format
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSString With Format
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[NSString stringWithFormat:@"$1", $2]$0
|
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: acc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Interface: Accessors for Primitive Type
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
- (${1:unsigned int})${2:thing};
|
||||
- (void)set${2/./\u$0/}:($1)new${2/./\u$0/};
|
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: stracc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Interface: Accessors for String
|
||||
## condition: "source.objc meta.scope.interface, source.objc++ meta.scope.interface"
|
||||
# --
|
||||
- (NSString${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})${1:thing};
|
||||
- (void)set${1/./\u$0/}:(NSString${TM_C_POINTER/(^(.+?)\s*$)?/(?1:$2: *)/})${2:a${1/.*/\u$0/}};
|
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# type: command
|
||||
# key: alloc
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Insert [[[… alloc] init] autorelease]
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
7
extras/imported/objc-mode/selector.yasnippet
Normal file
7
extras/imported/objc-mode/selector.yasnippet
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: sel
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: @selector(…)
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
@selector(${1:method}:)
|
Loading…
x
Reference in New Issue
Block a user