mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-155984 Completion suggests nothing if you try to complete a variable before a call
This commit is contained in:
@@ -69,8 +69,11 @@ class CheckInitialized implements ElementFilter {
|
||||
if (next instanceof PsiAssignmentExpression && parent == ((PsiAssignmentExpression)next).getLExpression()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
if (parent instanceof PsiReferenceExpression && next instanceof PsiExpressionStatement) {
|
||||
return Collections.emptySet();
|
||||
if (parent instanceof PsiJavaCodeReferenceElement) {
|
||||
PsiStatement psiStatement = PsiTreeUtil.getParentOfType(parent, PsiStatement.class);
|
||||
if (psiStatement != null && psiStatement.getTextRange().getStartOffset() == parent.getTextRange().getStartOffset()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
}
|
||||
parent = next;
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
int myField;
|
||||
int myField2;
|
||||
A() {
|
||||
myF<caret> initField();
|
||||
}
|
||||
|
||||
int initField(){return 2;}
|
||||
}
|
||||
+5
@@ -177,6 +177,11 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase {
|
||||
assertStringItems("preferencePolicy", "policy", "aPreferencePolicy");
|
||||
}
|
||||
|
||||
public void testSuggestVariablesInTypePosition() {
|
||||
configure();
|
||||
assertStringItems("myField", "myField2");
|
||||
}
|
||||
|
||||
public void configure() {
|
||||
configureByFile(FILE_PREFIX + getTestName(false) + ".java")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user