IDEA-154891 IDEA adds unnecessary space/colon on switch case autocompletion

This commit is contained in:
peter
2016-04-29 20:52:29 +02:00
parent 6663489749
commit 48b941daa8
4 changed files with 24 additions and 1 deletions

View File

@@ -203,7 +203,7 @@ public class VariableLookupItem extends LookupItem<PsiVariable> implements Typed
TailType.COMMA.processTail(context.getEditor(), context.getTailOffset());
AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), null);
}
else if (completionChar == ':') {
else if (completionChar == ':' && getAttribute(LookupItem.TAIL_TYPE_ATTR) != TailType.UNKNOWN) {
context.setAddCompletionChar(false);
TailType.COND_EXPR_COLON.processTail(context.getEditor(), context.getTailOffset());
}

View File

@@ -0,0 +1,11 @@
class Foo {
void foo(Constants c) {
switch (c) {
case B<caret>
}
}
}
enum Constants {
BAR0, BAR1;
}

View File

@@ -0,0 +1,11 @@
class Foo {
void foo(Constants c) {
switch (c) {
case BAR0:<caret>
}
}
}
enum Constants {
BAR0, BAR1;
}

View File

@@ -1045,6 +1045,7 @@ public class ListUtils {
public void testNoFieldsInImplements() throws Throwable { doTest() }
public void testSwitchConstantsFromReferencedClass() throws Throwable { doTest('\n') }
public void testSwitchValueFinishWithColon() throws Throwable { doTest(':') }
public void testUnfinishedMethodTypeParameter() throws Throwable {
configure()