Permalink
Browse files

Added bracket insertion for Objective-J

  • Loading branch information...
1 parent 68c5207 commit eb284155adc45cc23b9aecc16e52f1473e00d743 @dbloete dbloete committed with Jul 11, 2009
Showing with 6 additions and 3 deletions.
  1. +1 −1 README.mdown
  2. +5 −2 src/BracketMatcher.mm
View
@@ -11,7 +11,7 @@ Watch [the screencast](http://ciaranwal.sh/files/xcode-bracket-matcher.mov) to s
# Usage
-When editing an Objective-C(++) file, you can type a `]` to add a message to the current line. The plug-in will automatically look backwards to insert the opening bracket at the appropriate location.
+When editing an Objective-C(++) or Objective-J file, you can type a `]` to add a message to the current line. The plug-in will automatically look backwards to insert the opening bracket at the appropriate location.
# Credit
View
@@ -23,15 +23,16 @@ - (id)codeAssistant;
- (void)liveInlineRemoveCompletion;
@end
+static NSArray* BracketedLanguages;
+
@implementation NSTextView (BracketMatching)
- (void)BracketMatching_keyDown:(NSEvent*)event
{
BOOL didInsert = NO;
-
if([[event characters] isEqualToString:@"]"])
{
NSString* language = [[self textStorage] language];
- if([language isEqualToString:@"xcode.lang.objcpp"] || [language isEqualToString:@"xcode.lang.objc"])
+ if([BracketedLanguages containsObject:language])
didInsert = [[BracketMatcher sharedInstance] insertBracketForTextView:self];
}
@@ -48,6 +49,8 @@ + (void)load
if([NSClassFromString(@"XCSourceCodeTextView") jr_swizzleMethod:@selector(keyDown:) withMethod:@selector(BracketMatching_keyDown:) error:NULL])
NSLog(@"BracketMatcher loaded");
+
+ BracketedLanguages = [[NSArray alloc] initWithObjects:@"xcode.lang.objcpp", @"xcode.lang.objc", @"xcode.lang.objj", nil];
}
+ (BracketMatcher*)sharedInstance

0 comments on commit eb28415

Please sign in to comment.