mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] fix strange completion when trying to create vararg parameter (IDEA-346732)
GitOrigin-RevId: 7ba3612b1df542111163d635ae1fdd0ad8877fce
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a5fe427fb0
commit
8c84138f29
+5
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
@@ -88,7 +88,10 @@ public final class JavaCompletionContributor extends CompletionContributor imple
|
||||
psiElement().afterLeaf(".").insideStarting(psiExpressionStatement()),
|
||||
// like `call(Cls::methodRef.<caret>`
|
||||
psiElement().afterLeaf(psiElement(JavaTokenType.DOT).afterSibling(psiElement(PsiMethodCallExpression.class).withLastChild(
|
||||
psiElement(PsiExpressionList.class).withLastChild(psiElement(PsiErrorElement.class))))));
|
||||
psiElement(PsiExpressionList.class).withLastChild(psiElement(PsiErrorElement.class))))),
|
||||
// dot after primitive type `int.<caret>` or dot after dot `Object..<caret>`
|
||||
psiElement().afterLeaf(psiElement(JavaTokenType.DOT).withParent(
|
||||
psiElement(PsiErrorElement.class).afterSibling(psiElement(PsiErrorElement.class)))));
|
||||
private static final PsiNameValuePairPattern NAME_VALUE_PAIR =
|
||||
psiNameValuePair().withSuperParent(2, psiElement(PsiAnnotation.class));
|
||||
private static final ElementPattern<PsiElement> ANNOTATION_ATTRIBUTE_NAME =
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Foo {
|
||||
void foo(int.<caret>){ }
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Foo {
|
||||
void foo(int..<caret>){ }
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Foo {
|
||||
void foo(int...<caret>){ }
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Foo {
|
||||
void foo(int..<caret>){ }
|
||||
}
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.codeInsight.completion;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
@@ -1127,6 +1127,10 @@ public class NormalCompletionTest extends NormalCompletionTestCase {
|
||||
public void testEnumConstantFromEnumMember() { doTest(); }
|
||||
|
||||
public void testPrimitiveMethodParameter() { doTest(); }
|
||||
|
||||
public void testPrimitiveVarargMethodParameter() { doTest("."); }
|
||||
|
||||
public void testPrimitiveVarargMethodParameter2() { doTest("."); }
|
||||
|
||||
public void testNewExpectedClassParens() { doTest("\n"); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user