Fixed exception
This commit is contained in:
@@ -31,6 +31,7 @@ import org.jetbrains.jet.plugin.caches.resolve.getResolutionFacade
|
|||||||
import org.jetbrains.jet.lang.resolve.BindingContext
|
import org.jetbrains.jet.lang.resolve.BindingContext
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.BodyResolveMode
|
import org.jetbrains.jet.lang.resolve.lazy.BodyResolveMode
|
||||||
|
import org.jetbrains.jet.lang.descriptors.ClassKind
|
||||||
|
|
||||||
public object KotlinClassInsertHandler : BaseDeclarationInsertHandler() {
|
public object KotlinClassInsertHandler : BaseDeclarationInsertHandler() {
|
||||||
override fun handleInsert(context: InsertionContext, item: LookupElement) {
|
override fun handleInsert(context: InsertionContext, item: LookupElement) {
|
||||||
@@ -52,7 +53,13 @@ public object KotlinClassInsertHandler : BaseDeclarationInsertHandler() {
|
|||||||
if (nameRef != null) {
|
if (nameRef != null) {
|
||||||
val bindingContext = nameRef.getResolutionFacade().analyze(nameRef, BodyResolveMode.PARTIAL)
|
val bindingContext = nameRef.getResolutionFacade().analyze(nameRef, BodyResolveMode.PARTIAL)
|
||||||
val target = bindingContext[BindingContext.REFERENCE_TARGET, nameRef] as? ClassDescriptor
|
val target = bindingContext[BindingContext.REFERENCE_TARGET, nameRef] as? ClassDescriptor
|
||||||
if (target != null && DescriptorUtils.getFqNameSafe(target).asString() == qualifiedName) return
|
if (target != null) {
|
||||||
|
val realTarget = if (target.getKind() == ClassKind.CLASS_OBJECT)
|
||||||
|
target.getContainingDeclaration() as ClassDescriptor
|
||||||
|
else
|
||||||
|
target
|
||||||
|
if (DescriptorUtils.getFqName(realTarget).asString() == qualifiedName) return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val tempPrefix = if (nameRef != null)
|
val tempPrefix = if (nameRef != null)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class AClass {
|
||||||
|
class object {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
bar(<caret>)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: AClass
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class AClass {
|
||||||
|
class object {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
bar(AClass<caret>)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: AClass
|
||||||
+6
@@ -36,6 +36,12 @@ public class BasicCompletionHandlerTestGenerated extends AbstractBasicCompletion
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/handlers/basic"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/handlers/basic"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ClassWithClassObject.kt")
|
||||||
|
public void testClassWithClassObject() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/basic/ClassWithClassObject.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ExtensionReceiverTypeArg.kt")
|
@TestMetadata("ExtensionReceiverTypeArg.kt")
|
||||||
public void testExtensionReceiverTypeArg() throws Exception {
|
public void testExtensionReceiverTypeArg() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/basic/ExtensionReceiverTypeArg.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/basic/ExtensionReceiverTypeArg.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user