Skip to content

Commit eb86810

Browse files
committed
Refactor category method name
1 parent a34edbe commit eb86810

6 files changed

Lines changed: 39 additions & 39 deletions

File tree

VVDocumenter-Xcode/Commenter/VVSwiftFunctionCommenter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@implementation VVSwiftFunctionCommenter
1515
-(void) captureReturnType
1616
{
17-
VVTextResult *funcParenthesesResult = [self.code textResultMatchPartWithPairOpenString:@"(" closeString:@")" currentLocation:0];
17+
VVTextResult *funcParenthesesResult = [self.code vv_textResultMatchPartWithPairOpenString:@"(" closeString:@")" currentLocation:0];
1818
NSString * funcSignatureWithoutParams = [self.code stringByReplacingCharactersInRange:funcParenthesesResult.range withString:@""];
1919

2020
if ([funcSignatureWithoutParams vv_matchesPatternRegexPattern:@"\\s*->\\s*\\(?(\\Void?|\\(\\s*\\))\\)?\\s*[{]"]) {

VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212

1313
@interface NSString (VVTextGetter)
1414

15-
-(VVTextResult *) textResultOfCurrentLineCurrentLocation:(NSInteger)location;
15+
-(VVTextResult *) vv_textResultOfCurrentLineCurrentLocation:(NSInteger)location;
1616

17-
-(VVTextResult *) textResultOfPreviousLineCurrentLocation:(NSInteger)location;
17+
-(VVTextResult *) vv_textResultOfPreviousLineCurrentLocation:(NSInteger)location;
1818

19-
-(VVTextResult *) textResultOfNextLineCurrentLocation:(NSInteger)location;
19+
-(VVTextResult *) vv_textResultOfNextLineCurrentLocation:(NSInteger)location;
2020

21-
-(VVTextResult *) textResultUntilNextString:(NSString *)findString currentLocation:(NSInteger)location;
21+
-(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString currentLocation:(NSInteger)location;
2222

23-
-(VVTextResult *) textResultWithPairOpenString:(NSString *)open
24-
closeString:(NSString *)close
25-
currentLocation:(NSInteger)location;
23+
-(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open
24+
closeString:(NSString *)close
25+
currentLocation:(NSInteger)location;
2626

27-
-(VVTextResult *) textResultMatchPartWithPairOpenString:(NSString *)open
27+
-(VVTextResult *) vv_textResultMatchPartWithPairOpenString:(NSString *)open
2828
closeString:(NSString *)close
2929
currentLocation:(NSInteger)location;
3030
@end

VVDocumenter-Xcode/OCCategory/NSString+VVTextGetter/NSString+VVTextGetter.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@implementation NSString (VVTextGetter)
1313

14-
-(VVTextResult *) textResultOfCurrentLineCurrentLocation:(NSInteger)location
14+
-(VVTextResult *) vv_textResultOfCurrentLineCurrentLocation:(NSInteger)location
1515
{
1616
NSInteger curseLocation = location;
1717
NSRange range = NSMakeRange(0, curseLocation);
@@ -32,7 +32,7 @@ -(VVTextResult *) textResultOfCurrentLineCurrentLocation:(NSInteger)location
3232
}
3333

3434

35-
-(VVTextResult *) textResultOfPreviousLineCurrentLocation:(NSInteger)location
35+
-(VVTextResult *) vv_textResultOfPreviousLineCurrentLocation:(NSInteger)location
3636
{
3737
NSInteger curseLocation = location;
3838
NSRange range = NSMakeRange(0, curseLocation);
@@ -59,7 +59,7 @@ -(VVTextResult *) textResultOfPreviousLineCurrentLocation:(NSInteger)location
5959
}
6060
}
6161

62-
-(VVTextResult *) textResultOfNextLineCurrentLocation:(NSInteger)location
62+
-(VVTextResult *) vv_textResultOfNextLineCurrentLocation:(NSInteger)location
6363
{
6464
NSInteger curseLocation = location;
6565
NSRange range = NSMakeRange(curseLocation, self.length - curseLocation);
@@ -86,7 +86,7 @@ -(VVTextResult *) textResultOfNextLineCurrentLocation:(NSInteger)location
8686
}
8787
}
8888

89-
-(VVTextResult *) textResultUntilNextString:(NSString *)findString currentLocation:(NSInteger)location
89+
-(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString currentLocation:(NSInteger)location
9090
{
9191
NSInteger curseLocation = location;
9292

@@ -108,14 +108,14 @@ -(VVTextResult *) textResultUntilNextString:(NSString *)findString currentLocati
108108
}
109109
}
110110

111-
-(VVTextResult *) textResultMatchPartWithPairOpenString:(NSString *)open
111+
-(VVTextResult *) vv_textResultMatchPartWithPairOpenString:(NSString *)open
112112
closeString:(NSString *)close
113113
currentLocation:(NSInteger)location
114114
{
115115
return [self textResultWithPairOpenString:open closeString:close currentLocation:location extractMatch:YES];
116116
}
117117

118-
-(VVTextResult *) textResultWithPairOpenString:(NSString *)open
118+
-(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open
119119
closeString:(NSString *)close
120120
currentLocation:(NSInteger)location
121121
{

VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
@class VVTextResult;
1212

1313
@interface NSTextView (VVTextGetter)
14-
-(NSInteger) currentCurseLocation;
14+
-(NSInteger) vv_currentCurseLocation;
1515

16-
-(VVTextResult *) textResultOfCurrentLine;
16+
-(VVTextResult *) vv_textResultOfCurrentLine;
1717

18-
-(VVTextResult *) textResultOfPreviousLine;
18+
-(VVTextResult *) vv_textResultOfPreviousLine;
1919

20-
-(VVTextResult *) textResultOfNextLine;
20+
-(VVTextResult *) vv_textResultOfNextLine;
2121

22-
-(VVTextResult *) textResultUntilNextString:(NSString *)findString;
22+
-(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString;
2323

24-
-(VVTextResult *) textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close;
24+
-(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close;
2525

2626
@end

VVDocumenter-Xcode/OCCategory/NSTextView+VVTextGetter/NSTextView+VVTextGetter.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,35 @@
1111
#import "NSString+VVTextGetter.h"
1212

1313
@implementation NSTextView (VVTextGetter)
14-
-(NSInteger) currentCurseLocation
14+
-(NSInteger) vv_currentCurseLocation
1515
{
1616
return [[[self selectedRanges] objectAtIndex:0] rangeValue].location;
1717
}
1818

19-
-(VVTextResult *) textResultOfCurrentLine
19+
-(VVTextResult *) vv_textResultOfCurrentLine
2020
{
21-
return [self.textStorage.string textResultOfCurrentLineCurrentLocation:[self currentCurseLocation]];
21+
return [self.textStorage.string vv_textResultOfCurrentLineCurrentLocation:[self vv_currentCurseLocation]];
2222
}
2323

24-
-(VVTextResult *) textResultOfPreviousLine
24+
-(VVTextResult *) vv_textResultOfPreviousLine
2525
{
26-
return [self.textStorage.string textResultOfPreviousLineCurrentLocation:[self currentCurseLocation]];
26+
return [self.textStorage.string vv_textResultOfPreviousLineCurrentLocation:[self vv_currentCurseLocation]];
2727
}
2828

29-
-(VVTextResult *) textResultOfNextLine
29+
-(VVTextResult *) vv_textResultOfNextLine
3030
{
31-
return [self.textStorage.string textResultOfNextLineCurrentLocation:[self currentCurseLocation]];
31+
return [self.textStorage.string vv_textResultOfNextLineCurrentLocation:[self vv_currentCurseLocation]];
3232
}
3333

34-
-(VVTextResult *) textResultUntilNextString:(NSString *)findString
34+
-(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString
3535
{
36-
return [self.textStorage.string textResultUntilNextString:findString currentLocation:[self currentCurseLocation]];
36+
return [self.textStorage.string vv_textResultUntilNextString:findString currentLocation:[self vv_currentCurseLocation]];
3737
}
3838

3939

40-
-(VVTextResult *) textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close
40+
-(VVTextResult *) vv_textResultWithPairOpenString:(NSString *)open closeString:(NSString *)close
4141
{
42-
return [self.textStorage.string textResultWithPairOpenString:open closeString:close currentLocation:[self currentCurseLocation]];
42+
return [self.textStorage.string vv_textResultWithPairOpenString:open closeString:close currentLocation:[self vv_currentCurseLocation]];
4343
}
4444

4545
@end

VVDocumenter-Xcode/VVDocumenterManager.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ - (void) textStorageDidChange:(NSNotification *)noti {
7676

7777
if ([[noti object] isKindOfClass:[NSTextView class]]) {
7878
NSTextView *textView = (NSTextView *)[noti object];
79-
VVTextResult *currentLineResult = [textView textResultOfCurrentLine];
79+
VVTextResult *currentLineResult = [textView vv_textResultOfCurrentLine];
8080
if (currentLineResult) {
8181

8282
//Check if there is a "//" already typed in. We do this to solve the undo issue
@@ -91,14 +91,14 @@ - (void) textStorageDidChange:(NSNotification *)noti {
9191
}
9292

9393
if ([currentLineResult.string vv_matchesPatternRegexPattern:[NSString stringWithFormat:@"^\\s*%@$",[NSRegularExpression escapedPatternForString:triggerString]]] && self.prefixTyped) {
94-
VVTextResult *previousLineResult = [textView textResultOfPreviousLine];
94+
VVTextResult *previousLineResult = [textView vv_textResultOfPreviousLine];
9595

9696
// Previous line is a documentation comment, so ignore this
9797
if ([previousLineResult.string vv_matchesPatternRegexPattern:@"^\\s*///"]) {
9898
return;
9999
}
100100

101-
VVTextResult *nextLineResult = [textView textResultOfNextLine];
101+
VVTextResult *nextLineResult = [textView vv_textResultOfNextLine];
102102

103103
// Next line is a documentation comment, so ignore this
104104
if ([nextLineResult.string vv_matchesPatternRegexPattern:@"^\\s*///"]) {
@@ -112,8 +112,8 @@ - (void) textStorageDidChange:(NSNotification *)noti {
112112

113113
//Decide which is closer to the cursor. A semicolon or a half brace.
114114
//We just want to document the next valid line.
115-
VVTextResult *resultUntilSemiColon = [textView textResultUntilNextString:@";"];
116-
VVTextResult *resultUntilBrace = [textView textResultUntilNextString:@"{"];
115+
VVTextResult *resultUntilSemiColon = [textView vv_textResultUntilNextString:@";"];
116+
VVTextResult *resultUntilBrace = [textView vv_textResultUntilNextString:@"{"];
117117

118118
VVTextResult *resultToDocument = nil;
119119

@@ -132,7 +132,7 @@ - (void) textStorageDidChange:(NSNotification *)noti {
132132
}
133133

134134
if ([resultToDocument.string vv_isSwiftEnum]) {
135-
resultToDocument = [textView textResultWithPairOpenString:@"{" closeString:@"}"];
135+
resultToDocument = [textView vv_textResultWithPairOpenString:@"{" closeString:@"}"];
136136
}
137137

138138
VVDocumenter *doc = [[VVDocumenter alloc] initWithCode:resultToDocument.string];
@@ -191,7 +191,7 @@ - (void) textStorageDidChange:(NSNotification *)noti {
191191
return nil;
192192
} else if ([incomingEvent type] == NSKeyDown && [incomingEvent keyCode] == kKeyVCode && shouldReplace == YES) {
193193
//Select input line and the define code block.
194-
NSRange r = [textView textResultUntilNextString:@";"].range;
194+
NSRange r = [textView vv_textResultUntilNextString:@";"].range;
195195

196196
//NSRange r begins from the starting of enum(struct) line. Select 1 character before to include the trigger input line.
197197
[textView setSelectedRange:NSMakeRange(r.location - 1, r.length + 1)];

0 commit comments

Comments
 (0)