mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-195936 "true"/"false" keywords should have priority in completion for boolean parameters inside "if" condition
This commit is contained in:
@@ -327,7 +327,7 @@ public class PreferByKindWeigher extends LookupElementWeigher {
|
||||
boolean inReturn = psiElement().withParents(PsiReferenceExpression.class, PsiReturnStatement.class).accepts(myPosition);
|
||||
return inReturn ? ThreeState.YES : ThreeState.UNSURE;
|
||||
} else if (Arrays.stream(myExpectedTypes).anyMatch(info -> PsiType.BOOLEAN.isAssignableFrom(info.getDefaultType())) &&
|
||||
PsiTreeUtil.getParentOfType(myPosition, PsiIfStatement.class, true, PsiStatement.class, PsiMember.class) == null) {
|
||||
!(myPosition.getParent() instanceof PsiIfStatement)) {
|
||||
return ThreeState.YES;
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
{
|
||||
String factory = null;
|
||||
if (bar(fa<caret>))
|
||||
}
|
||||
boolean bar(boolean b) {}
|
||||
}
|
||||
+4
@@ -677,6 +677,10 @@ interface TxANotAnno {}
|
||||
checkPreferredItems 0, 'false', 'factory'
|
||||
}
|
||||
|
||||
void testPreferBooleanKeywordsWhenExpectedBoolean2() {
|
||||
checkPreferredItems 0, 'false', 'factory'
|
||||
}
|
||||
|
||||
void testPreferExplicitlyImportedStaticMembers() {
|
||||
myFixture.addClass("""
|
||||
class ContainerUtilRt {
|
||||
|
||||
Reference in New Issue
Block a user