diff --git a/idea/src/org/jetbrains/jet/plugin/completion/CompletionSorting.kt b/idea/src/org/jetbrains/jet/plugin/completion/CompletionSorting.kt index 23316d6c5db..de991ea204e 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/CompletionSorting.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/CompletionSorting.kt @@ -74,7 +74,7 @@ private object KindWeigher : LookupElementWeigher("kotlin.kind") { override fun weigh(element: LookupElement): Weight { val o = element.getObject() return when (o) { - is DeclarationLookupObject -> when (o.descriptor) { + is DeclarationDescriptorLookupObject -> when (o.descriptor) { is LocalVariableDescriptor, is ValueParameterDescriptor -> Weight.localOrParameter is PropertyDescriptor -> Weight.property is PackageViewDescriptor -> Weight.packages @@ -91,7 +91,7 @@ private object KindWeigher : LookupElementWeigher("kotlin.kind") { private object DeprecatedWeigher : LookupElementWeigher("kotlin.deprecated") { override fun weigh(element: LookupElement): Int { val o = element.getObject() - return if (o is DeclarationLookupObject && KotlinBuiltIns.getInstance().isDeprecated(o.descriptor)) 1 else 0 + return if (o is DeclarationDescriptorLookupObject && KotlinBuiltIns.getInstance().isDeprecated(o.descriptor)) 1 else 0 } } @@ -115,7 +115,7 @@ private class JetDeclarationRemotenessWeigher(private val file: JetFile) : Looku override fun weigh(element: LookupElement): Weight { val o = element.getObject() - if (o is DeclarationLookupObject) { + if (o is DeclarationDescriptorLookupObject) { val elementFile = o.psiElement?.getContainingFile() if (elementFile is JetFile && elementFile.getOriginalFile() == file) { return Weight.thisFile diff --git a/idea/src/org/jetbrains/jet/plugin/completion/DeclarationLookupObject.kt b/idea/src/org/jetbrains/jet/plugin/completion/DeclarationDescriptorLookupObject.kt similarity index 85% rename from idea/src/org/jetbrains/jet/plugin/completion/DeclarationLookupObject.kt rename to idea/src/org/jetbrains/jet/plugin/completion/DeclarationDescriptorLookupObject.kt index 30b00df3b58..5882827b1bd 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/DeclarationLookupObject.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/DeclarationDescriptorLookupObject.kt @@ -25,7 +25,7 @@ import org.jetbrains.jet.lang.resolve.lazy.KotlinCodeAnalyzer * Stores information about resolved descriptor and position of that descriptor. * Position will be used for sorting */ -public class DeclarationLookupObject(public val descriptor: DeclarationDescriptor, private val analyzer: KotlinCodeAnalyzer, public val psiElement: PsiElement?) { +public class DeclarationDescriptorLookupObject(public val descriptor: DeclarationDescriptor, private val analyzer: KotlinCodeAnalyzer, public val psiElement: PsiElement?) { override fun toString(): String { return super.toString() + " " + descriptor } @@ -38,7 +38,7 @@ public class DeclarationLookupObject(public val descriptor: DeclarationDescripto if (this identityEquals other) return true if (other == null || javaClass != other.javaClass) return false - val lookupObject = other as DeclarationLookupObject + val lookupObject = other as DeclarationDescriptorLookupObject if (analyzer != lookupObject.analyzer) { LOG.warn("Descriptors from different resolve sessions") @@ -49,6 +49,6 @@ public class DeclarationLookupObject(public val descriptor: DeclarationDescripto } class object { - private val LOG = Logger.getInstance("#" + javaClass().getName()) + private val LOG = Logger.getInstance("#" + javaClass().getName()) } } diff --git a/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt b/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt index 1a4a3a30f66..5cdbff17ac5 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/KotlinLookupElementFactory.kt @@ -65,7 +65,7 @@ public object KotlinLookupElementFactory { } val name = descriptor.getName().asString() - var element = LookupElementBuilder.create(DeclarationLookupObject(descriptor, analyzer, declaration), name) + var element = LookupElementBuilder.create(DeclarationDescriptorLookupObject(descriptor, analyzer, declaration), name) var presentableText = name var typeText = "" diff --git a/idea/src/org/jetbrains/jet/plugin/completion/handlers/BaseDeclarationInsertHandler.kt b/idea/src/org/jetbrains/jet/plugin/completion/handlers/BaseDeclarationInsertHandler.kt index 9ecac7ee1d1..26c05468c9d 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/handlers/BaseDeclarationInsertHandler.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/handlers/BaseDeclarationInsertHandler.kt @@ -19,13 +19,13 @@ package org.jetbrains.jet.plugin.completion.handlers import com.intellij.codeInsight.completion.InsertHandler import com.intellij.codeInsight.lookup.LookupElement import com.intellij.codeInsight.completion.InsertionContext -import org.jetbrains.jet.plugin.completion.DeclarationLookupObject +import org.jetbrains.jet.plugin.completion.DeclarationDescriptorLookupObject import com.intellij.openapi.util.TextRange import org.jetbrains.jet.plugin.util.IdeDescriptorRenderers open class BaseDeclarationInsertHandler : InsertHandler { override fun handleInsert(context: InsertionContext, item: LookupElement) { - val descriptor = (item.getObject() as? DeclarationLookupObject)?.descriptor + val descriptor = (item.getObject() as? DeclarationDescriptorLookupObject)?.descriptor if (descriptor != null) { val name = descriptor.getName() val nameInCode = IdeDescriptorRenderers.SOURCE_CODE.renderName(name) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt b/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt index 9d8bdfe43e0..3c2bb6e7455 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinCallableInsertHandler.kt @@ -34,7 +34,7 @@ import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper import com.intellij.openapi.editor.Document import org.jetbrains.jet.lang.types.JetType import com.intellij.openapi.util.TextRange -import org.jetbrains.jet.plugin.completion.DeclarationLookupObject +import org.jetbrains.jet.plugin.completion.DeclarationDescriptorLookupObject import org.jetbrains.jet.lang.descriptors.CallableDescriptor import org.jetbrains.jet.lang.psi.JetBinaryExpression import org.jetbrains.jet.lang.psi.JetSimpleNameExpression @@ -57,7 +57,7 @@ public abstract class JetCallableInsertHandler : BaseDeclarationInsertHandler() val file = context.getFile() val o = item.getObject() - if (file is JetFile && o is DeclarationLookupObject) { + if (file is JetFile && o is DeclarationDescriptorLookupObject) { val descriptor = o.descriptor as? CallableDescriptor if (descriptor != null) { if (PsiTreeUtil.getParentOfType(element, javaClass()) != null && diff --git a/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinClassInsertHandler.kt b/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinClassInsertHandler.kt index 9fbd92cc73c..8e623de5eca 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinClassInsertHandler.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/handlers/KotlinClassInsertHandler.kt @@ -22,7 +22,7 @@ import com.intellij.openapi.editor.Document import com.intellij.psi.PsiDocumentManager import org.jetbrains.jet.lang.psi.JetFile import org.jetbrains.jet.plugin.codeInsight.ShortenReferences -import org.jetbrains.jet.plugin.completion.DeclarationLookupObject +import org.jetbrains.jet.plugin.completion.DeclarationDescriptorLookupObject import org.jetbrains.jet.lang.descriptors.ClassDescriptor import org.jetbrains.jet.plugin.completion.qualifiedNameForSourceCode @@ -32,7 +32,7 @@ public object KotlinClassInsertHandler : BaseDeclarationInsertHandler() { val file = context.getFile() if (file is JetFile) { - val descriptor = (item.getObject() as DeclarationLookupObject).descriptor as ClassDescriptor + val descriptor = (item.getObject() as DeclarationDescriptorLookupObject).descriptor as ClassDescriptor val startOffset = context.getStartOffset() val document = context.getDocument() if (!isAfterDot(document, startOffset)) {