mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-63641 Eliminate variable itself from autocomplete list
This commit is contained in:
@@ -39,7 +39,12 @@ public class ExcludeSillyAssignment implements ElementFilter {
|
||||
final PsiExpression left = ((PsiAssignmentExpression)each).getLExpression();
|
||||
if (left instanceof PsiReferenceExpression) {
|
||||
final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)left;
|
||||
if (referenceExpression.isQualified()) return true;
|
||||
final PsiElement qualifier = referenceExpression.getQualifier();
|
||||
if (qualifier != null) {
|
||||
if (!(qualifier instanceof PsiThisExpression) || ((PsiThisExpression)qualifier).getQualifier() != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return !referenceExpression.isReferenceTo((PsiElement)element);
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
Object field;
|
||||
|
||||
A() {
|
||||
field = 2;
|
||||
this.field = fi<caret>
|
||||
}
|
||||
}
|
||||
+1
@@ -961,6 +961,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
public void testWildcardedInstanceof3() throws Throwable { doTest(); }
|
||||
|
||||
public void testCheckStaticImportsType() throws Throwable { doAntiTest(); }
|
||||
public void testThisFieldAssignedToItself() throws Throwable { doAntiTest(); }
|
||||
|
||||
public void testTypeVariableInstanceOf() throws Throwable {
|
||||
configureByTestName();
|
||||
|
||||
Reference in New Issue
Block a user