Disabled parameter name&type completion for annotation type constructor
This commit is contained in:
@@ -334,8 +334,11 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
|||||||
when (completionKind) {
|
when (completionKind) {
|
||||||
CompletionKind.PARAMETER_NAME, CompletionKind.ANNOTATION_TYPES_OR_PARAMETER_NAME -> {
|
CompletionKind.PARAMETER_NAME, CompletionKind.ANNOTATION_TYPES_OR_PARAMETER_NAME -> {
|
||||||
val parameter = position.getNonStrictParentOfType<JetParameter>()!!
|
val parameter = position.getNonStrictParentOfType<JetParameter>()!!
|
||||||
val owner = parameter.getParent().getParent()
|
val list = parameter.getParent() as? JetParameterList ?: return false
|
||||||
return parameter != (owner as? JetCatchClause)?.getCatchParameter() && parameter != (owner as? JetPropertyAccessor)?.getParameter()
|
val owner = list.getParent()
|
||||||
|
return owner !is JetCatchClause &&
|
||||||
|
owner !is JetPropertyAccessor &&
|
||||||
|
!((owner as? JetPrimaryConstructor)?.getContainingClassOrObject()?.isAnnotation() ?: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> return false
|
else -> return false
|
||||||
|
|||||||
Vendored
+9
@@ -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
|
||||||
+6
@@ -1440,6 +1440,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("NotForCatchParameter.kt")
|
||||||
public void testNotForCatchParameter() throws Exception {
|
public void testNotForCatchParameter() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForCatchParameter.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForCatchParameter.kt");
|
||||||
|
|||||||
+6
@@ -1440,6 +1440,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("NotForCatchParameter.kt")
|
||||||
public void testNotForCatchParameter() throws Exception {
|
public void testNotForCatchParameter() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForCatchParameter.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/parameterNameAndType/NotForCatchParameter.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user