Disabled parameter name&type completion for annotation type constructor

This commit is contained in:
Valentin Kipyatkov
2015-06-19 20:38:44 +03:00
parent 0ab155d61d
commit 776d198ea5
4 changed files with 26 additions and 2 deletions
@@ -334,8 +334,11 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
when (completionKind) {
CompletionKind.PARAMETER_NAME, CompletionKind.ANNOTATION_TYPES_OR_PARAMETER_NAME -> {
val parameter = position.getNonStrictParentOfType<JetParameter>()!!
val owner = parameter.getParent().getParent()
return parameter != (owner as? JetCatchClause)?.getCatchParameter() && parameter != (owner as? JetPropertyAccessor)?.getParameter()
val list = parameter.getParent() as? JetParameterList ?: return false
val owner = list.getParent()
return owner !is JetCatchClause &&
owner !is JetPropertyAccessor &&
!((owner as? JetPrimaryConstructor)?.getContainingClassOrObject()?.isAnnotation() ?: false)
}
else -> return false
@@ -0,0 +1,9 @@
// we disabled parameter name/type completion because not all types are acceptable and it's not very useful in such context anyway
class FooBar
class Boo
annotation class A(val b<caret>)
// NUMBER: 0
@@ -1440,6 +1440,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
doTest(fileName);
}
@TestMetadata("NotForAnnnotationTypeConstructor.kt")
public void testNotForAnnnotationTypeConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForAnnnotationTypeConstructor.kt");
doTest(fileName);
}
@TestMetadata("NotForCatchParameter.kt")
public void testNotForCatchParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForCatchParameter.kt");
@@ -1440,6 +1440,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
doTest(fileName);
}
@TestMetadata("NotForAnnnotationTypeConstructor.kt")
public void testNotForAnnnotationTypeConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForAnnnotationTypeConstructor.kt");
doTest(fileName);
}
@TestMetadata("NotForCatchParameter.kt")
public void testNotForCatchParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForCatchParameter.kt");