KT-10619 Wrong completion after package name in annotation

#KT-10619 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-02-11 18:49:15 +03:00
parent 17ac168b33
commit 0809be59df
4 changed files with 30 additions and 11 deletions
@@ -272,6 +272,7 @@ class BasicCompletionSession(
} }
} }
if (callTypeAndReceiver.receiver == null) {
val classKindFilter: ((ClassKind) -> Boolean)? val classKindFilter: ((ClassKind) -> Boolean)?
when (callTypeAndReceiver) { when (callTypeAndReceiver) {
is CallTypeAndReceiver.ANNOTATION -> classKindFilter = { it == ClassKind.ANNOTATION_CLASS } is CallTypeAndReceiver.ANNOTATION -> classKindFilter = { it == ClassKind.ANNOTATION_CLASS }
@@ -287,6 +288,7 @@ class BasicCompletionSession(
} }
} }
} }
}
private fun isStartOfExtensionReceiverFor(): KtCallableDeclaration? { private fun isStartOfExtensionReceiverFor(): KtCallableDeclaration? {
val userType = nameExpression!!.parent as? KtUserType ?: return null val userType = nameExpression!!.parent as? KtUserType ?: return null
@@ -0,0 +1,5 @@
@kotlin.concurrent.<caret>
// INVOCATION_COUNT: 2
// ABSENT: Deprecated
// ABSENT: Volatile
@@ -791,6 +791,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public static class Annotations extends AbstractJSBasicCompletionTest { public static class Annotations extends AbstractJSBasicCompletionTest {
@TestMetadata("AfterPackageName.kt")
public void testAfterPackageName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/annotations/AfterPackageName.kt");
doTest(fileName);
}
public void testAllFilesPresentInAnnotations() throws Exception { public void testAllFilesPresentInAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/annotations"), Pattern.compile("^(.+)\\.kt$"), true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/annotations"), Pattern.compile("^(.+)\\.kt$"), true);
} }
@@ -791,6 +791,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public static class Annotations extends AbstractJvmBasicCompletionTest { public static class Annotations extends AbstractJvmBasicCompletionTest {
@TestMetadata("AfterPackageName.kt")
public void testAfterPackageName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/annotations/AfterPackageName.kt");
doTest(fileName);
}
public void testAllFilesPresentInAnnotations() throws Exception { public void testAllFilesPresentInAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/annotations"), Pattern.compile("^(.+)\\.kt$"), true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/annotations"), Pattern.compile("^(.+)\\.kt$"), true);
} }