More correct code in class completion insert handler

This commit is contained in:
Valentin Kipyatkov
2015-05-20 12:32:45 +03:00
parent d7c64d44b6
commit 7d8a92aeb7
@@ -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
}