mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
true/false should only be preferred after 'return' in smart completion
This commit is contained in:
@@ -139,8 +139,8 @@ public class PreferByKindWeigher extends LookupElementWeigher {
|
||||
if (PsiKeyword.ELSE.equals(keyword) || PsiKeyword.FINALLY.equals(keyword)) {
|
||||
return MyResult.probableKeyword;
|
||||
}
|
||||
if (PsiKeyword.TRUE.equals(keyword) || PsiKeyword.FALSE.equals(keyword)) {
|
||||
boolean inReturn = PsiTreeUtil.getParentOfType(myPosition, PsiReturnStatement.class, false, PsiMember.class) != null;
|
||||
if ((PsiKeyword.TRUE.equals(keyword) || PsiKeyword.FALSE.equals(keyword)) && myCompletionType == CompletionType.SMART) {
|
||||
boolean inReturn = psiElement().withParents(PsiReferenceExpression.class, PsiReturnStatement.class).accepts(myPosition);
|
||||
return inReturn ? MyResult.probableKeyword : MyResult.normal;
|
||||
}
|
||||
if (PsiKeyword.INTERFACE.equals(keyword) && psiElement().afterLeaf("@").accepts(myPosition)) {
|
||||
|
||||
+1
-1
@@ -792,7 +792,7 @@ public class ListUtils {
|
||||
|
||||
public void testDoubleFalse() throws Throwable {
|
||||
configureByFile(getTestName(false) + ".java");
|
||||
assertFirstStringItems("false", "fefefef", "float", "finalize");
|
||||
assertFirstStringItems("fefefef", "false", "float", "finalize");
|
||||
}
|
||||
|
||||
public void testSameNamedVariableInNestedClasses() throws Throwable {
|
||||
|
||||
Reference in New Issue
Block a user