One more class rename
This commit is contained in:
@@ -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
|
||||
|
||||
+3
-3
@@ -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<DeclarationLookupObject>().getName())
|
||||
private val LOG = Logger.getInstance("#" + javaClass<DeclarationDescriptorLookupObject>().getName())
|
||||
}
|
||||
}
|
||||
@@ -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 = ""
|
||||
|
||||
+2
-2
@@ -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<LookupElement> {
|
||||
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)
|
||||
|
||||
+2
-2
@@ -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<JetQualifiedExpression>()) != null &&
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user