Skip to content

Commit d684e5d

Browse files
committed
Fixes #19 - Switch cases expand in wrong position
1 parent dc488d4 commit d684e5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ - (BOOL)tryExpandingSwitchStatement
103103
if(switchRange.location == NSNotFound) {
104104
return NO;
105105
}
106+
107+
// Insert the selected autocomplete item
108+
[self.session insertCurrentCompletion];
106109

107110
// Fetch the opening bracket for that switch statement
108111
NSUInteger openingBracketLocation = [textView.string rangeOfString:@"{" options:0 range:NSMakeRange(self.session.wordStartLocation, textView.string.length - self.session.wordStartLocation)].location;
@@ -116,9 +119,6 @@ - (BOOL)tryExpandingSwitchStatement
116119
return NO;
117120
}
118121

119-
// Insert the selected autocomplete item
120-
[self.session insertCurrentCompletion];
121-
122122
NSRange selectedRange = textView.selectedRange;
123123

124124
// Fetch the closing bracket for that switch statement

0 commit comments

Comments
 (0)