mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-126032 Java basic completion: prefer annotations instead of 'interface' keyword
This commit is contained in:
@@ -120,6 +120,7 @@ public class PreferByKindWeigher extends LookupElementWeigher {
|
||||
collectionFactory,
|
||||
expectedTypeMethod,
|
||||
suitableClass,
|
||||
improbableKeyword,
|
||||
nonInitialized,
|
||||
classLiteral,
|
||||
classNameOrGlobalStatic,
|
||||
@@ -142,6 +143,9 @@ public class PreferByKindWeigher extends LookupElementWeigher {
|
||||
boolean inReturn = PsiTreeUtil.getParentOfType(myPosition, PsiReturnStatement.class, false, PsiMember.class) != null;
|
||||
return inReturn ? MyResult.probableKeyword : MyResult.normal;
|
||||
}
|
||||
if (PsiKeyword.INTERFACE.equals(keyword) && psiElement().afterLeaf("@").accepts(myPosition)) {
|
||||
return MyResult.improbableKeyword;
|
||||
}
|
||||
}
|
||||
|
||||
if (object instanceof PsiLocalVariable || object instanceof PsiParameter || object instanceof PsiThisExpression) {
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
@<caret>
|
||||
void foo(){}
|
||||
}
|
||||
+4
@@ -633,6 +633,10 @@ interface TxANotAnno {}
|
||||
checkPreferredItems 0, 'fact'
|
||||
}
|
||||
|
||||
public void testPreferAnnotationsToInterfaceKeyword() {
|
||||
checkPreferredItems 0, 'Deprecated', 'Override'
|
||||
}
|
||||
|
||||
public void testGlobalStaticMemberStats() {
|
||||
configureNoCompletion(getTestName(false) + ".java")
|
||||
myFixture.complete(CompletionType.BASIC, 2)
|
||||
|
||||
Reference in New Issue
Block a user