More elegant way to achieve the same + fixed KT-7746 Top level package name completion does not work inside class body

#KT-7746 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-07-16 00:41:54 +03:00
parent 82c9cd790e
commit c1b2ea0b48
7 changed files with 34 additions and 8 deletions
@@ -233,11 +233,11 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
private companion object {
object NonAnnotationClassifierExclude : DescriptorKindExclude {
override fun matches(descriptor: DeclarationDescriptor): Boolean {
return if (descriptor is ClassDescriptor)
descriptor.getKind() != ClassKind.ANNOTATION_CLASS
else
descriptor !is ClassifierDescriptor
if (descriptor !is ClassifierDescriptor) return false
return descriptor !is ClassDescriptor || descriptor.getKind() != ClassKind.ANNOTATION_CLASS
}
override val fullyExcludedDescriptorKinds: Int get() = 0
}
val ANNOTATION_TYPES_FILTER = DescriptorKindFilter(DescriptorKindFilter.NON_SINGLETON_CLASSIFIERS_MASK or DescriptorKindFilter.PACKAGES_MASK) exclude NonAnnotationClassifierExclude
@@ -0,0 +1,5 @@
class A {
kot<caret>
}
// EXIST: "kotlin"
@@ -865,6 +865,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
doTest(fileName);
}
@TestMetadata("TopLevelPackageInClassBody.kt")
public void testTopLevelPackageInClassBody() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/TopLevelPackageInClassBody.kt");
doTest(fileName);
}
@TestMetadata("TypeParameterFromOuterClass.kt")
public void testTypeParameterFromOuterClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/TypeParameterFromOuterClass.kt");
@@ -865,6 +865,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
doTest(fileName);
}
@TestMetadata("TopLevelPackageInClassBody.kt")
public void testTopLevelPackageInClassBody() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/TopLevelPackageInClassBody.kt");
doTest(fileName);
}
@TestMetadata("TypeParameterFromOuterClass.kt")
public void testTypeParameterFromOuterClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/TypeParameterFromOuterClass.kt");