IDEA-46653 Completion in parameter list should not insert a trailing comma if the following parameter is varargs

This commit is contained in:
peter
2011-02-21 21:05:54 +01:00
parent d91749f4c3
commit ab4660c7ac
4 changed files with 19 additions and 1 deletions
@@ -953,7 +953,7 @@ public class ExpectedTypesProvider {
if (index >= params.length) {
return TailType.NONE;
}
if (index == params.length - 1) {
if (index == params.length - 1 || index == params.length - 2 && params[index + 1].isVarArgs()) {
//myTailType = CompletionUtil.NONE_TAIL;
final PsiElement call = argument.getParent().getParent();
if (call instanceof JspMethodCall) return TailType.NONE;
@@ -0,0 +1,8 @@
class Foooo {
int bar(int a, Object... varargs) {}
int foo() {
bar(hashCode())<caret>;
}
}
@@ -0,0 +1,8 @@
class Foooo {
int bar(int a, Object... varargs) {}
int foo() {
bar(ha<caret>);
}
}
@@ -875,6 +875,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
doTest();
}
public void testNoCommaBeforeVarargs() throws Throwable { doTest(); }
public void testEnumField() throws Throwable {
doItemTest();
}