From 7d8a92aeb77e0ec23ff6ed235b04a09efa511ed0 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Wed, 20 May 2015 12:32:45 +0300 Subject: [PATCH] More correct code in class completion insert handler --- .../idea/completion/handlers/KotlinClassInsertHandler.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinClassInsertHandler.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinClassInsertHandler.kt index e63ae977563..1fe64b67dc9 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinClassInsertHandler.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinClassInsertHandler.kt @@ -51,7 +51,8 @@ object KotlinClassInsertHandler : BaseDeclarationInsertHandler() { val nameRef = token.getParent() as? JetNameReferenceExpression if (nameRef != null) { val bindingContext = nameRef.getResolutionFacade().analyze(nameRef, BodyResolveMode.PARTIAL) - val target = bindingContext[BindingContext.REFERENCE_TARGET, nameRef] as? ClassDescriptor + val target = bindingContext[BindingContext.SHORT_REFERENCE_TO_COMPANION_OBJECT, nameRef] + ?: bindingContext[BindingContext.REFERENCE_TARGET, nameRef] as? ClassDescriptor if (target != null && IdeDescriptorRenderers.SOURCE_CODE.renderClassifierName(target) == qualifiedName) return }