mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
IDEA-140294 If you declare a variable and initialize it on the same line, autocomplete will suggest the new variable in that line
This commit is contained in:
+3
-4
@@ -161,10 +161,9 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
return createAnnotationFilter(position);
|
||||
}
|
||||
|
||||
if (psiElement().afterLeaf("=").inside(PsiVariable.class).accepts(position)) {
|
||||
return new OrFilter(
|
||||
new ClassFilter(PsiVariable.class, false),
|
||||
new ExcludeDeclaredFilter(new ClassFilter(PsiVariable.class)));
|
||||
PsiVariable var = PsiTreeUtil.getParentOfType(position, PsiVariable.class, false, PsiClass.class);
|
||||
if (var != null && PsiTreeUtil.isAncestor(var.getInitializer(), position, false)) {
|
||||
return new ExcludeDeclaredFilter(new ClassFilter(PsiVariable.class));
|
||||
}
|
||||
|
||||
if (SWITCH_LABEL.accepts(position)) {
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class MyFirstTestClassFoo {
|
||||
|
||||
{
|
||||
String newVar = String.valueOf(newV<caret>)
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class MyFirstTestClassFoo {
|
||||
|
||||
{
|
||||
String newVar = "" + newV<caret>)
|
||||
}
|
||||
}
|
||||
+2
@@ -676,6 +676,8 @@ public class ListUtils {
|
||||
|
||||
public void testNothingAfterNumericLiteral() throws Throwable { doAntiTest(); }
|
||||
public void testNothingAfterTypeParameterQualifier() { doAntiTest(); }
|
||||
public void testExcludeVariableBeingDeclared() { doAntiTest(); }
|
||||
public void testExcludeVariableBeingDeclared2() { doAntiTest(); }
|
||||
|
||||
public void testSpacesAroundEq() throws Throwable { doTest('='); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user